{"repo": "ib/xarchiver", "pr_number": 174, "title": "Don't make empty 'NEWS' or 'AUTHORS' files", "state": "closed", "merged_at": null, "additions": 2, "deletions": 4, "files_changed": ["autogen.sh"], "files_before": {"autogen.sh": "#!/bin/sh\n\ntest \"$BASH\" && set -o pipefail\n\necho > AUTHORS\necho > NEWS\nmkdir m4\n\necho -n \"Creating the build system... \"\n\nintltoolize --copy --force --automake || exit\nlibtoolize --copy --force --quiet || exit\naclocal || exit\nautoheader || exit\nautomake --copy --force-missing --add-missing --gnu 2>&1 | sed \"/installing/d\" || exit\nautoconf -Wno-obsolete || exit\n\necho \"done.\"\n\n# clean up in order to keep repository small\n# (will be needed if 'make dist' is used though)\nrm AUTHORS NEWS INSTALL aclocal.m4 intltool-extract.in intltool-merge.in intltool-update.in\nrm -f config.h.in~ configure~\nrm -r autom4te.cache m4\n"}, "files_after": {"autogen.sh": "#!/bin/sh\n\ntest \"$BASH\" && set -o pipefail\n\nmkdir m4\n\necho -n \"Creating the build system... \"\n\nintltoolize --copy --force --automake || exit\nlibtoolize --copy --force --quiet || exit\naclocal || exit\nautoheader || exit\nautomake --copy --force-missing --add-missing --gnu 2>&1 | sed \"/installing/d\" || exit\nautoconf -Wno-obsolete || exit\n\necho \"done.\"\n\n# clean up in order to keep repository small\n# (will be needed if 'make dist' is used though)\nrm INSTALL aclocal.m4 intltool-extract.in intltool-merge.in intltool-update.in\nrm -f config.h.in~ configure~\nrm -r autom4te.cache m4\n"}}
{"repo": "collectiveidea/migration_test_helper", "pr_number": 6, "title": "Rails 3.1 fixes", "state": "closed", "merged_at": null, "additions": 17, "deletions": 21, "files_changed": ["init.rb", "lib/migration_test_helper.rb", "test/helper.rb", "test/migration_test_helper_test.rb"], "files_before": {"init.rb": "if RAILS_ENV == 'test'\n require 'migration_test_helper'\n require 'test/unit'\n Test::Unit::TestCase.class_eval do\n include MigrationTestHelper\n end\nend\n", "lib/migration_test_helper.rb": "#--\n# Copyright (c) 2007 Micah Alles, Patrick Bacon, David Crosby\n# \n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n# \n# The above copyright notice and this permission notice shall be\n# included in all copies or substantial portions of the Software.\n# \n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n#++\n\nrequire 'test/unit/assertions'\n\nmodule MigrationTestHelper \n def self.migration_dir\n @migration_dir || File.expand_path(RAILS_ROOT + '/db/migrate')\n end\n\n #\n # sets the directory in which the migrations reside to be run with migrate\n #\n def self.migration_dir=(new_dir)\n @migration_dir = new_dir\n end\n\n #\n # verifies the schema exactly matches the one specified (schema_info does not have to be specified)\n # \n # assert_schema do |s|\n # s.table :dogs do |t|\n # t.column :id, :integer, :default => 2\n # t.column :name, :string\n # end\n # end\n #\n def assert_schema\n schema = Schema.new\n yield schema\n schema.verify\n end\n\n #\n # verifies a single table exactly matches the one specified\n # \n # assert_table :dogs do |t|\n # t.column :id, :integer, :default => 2\n # t.column :name, :string\n # end\n #\n def assert_table(name)\n table = Table.new(name)\n yield table\n table.verify\n end\n\n #\n # drops all tables in the database\n # \n def drop_all_tables\n ActiveRecord::Base.connection.tables.each do |table|\n ActiveRecord::Base.connection.drop_table(table)\n end\n end\n\n #\n # executes your migrations\n #\n # migrate # same as rake db:migrate\n #\n # Options are:\n # * :version - version to migrate to (same as VERSION=.. option to rake db:migrate)\n # * :verbose - print migration status messages to STDOUT, defaults to false\n # \n def migrate(opts={})\n old_verbose = ActiveRecord::Migration.verbose\n ActiveRecord::Migration.verbose = opts[:verbose].nil? ? false : opts[:verbose]\n version = opts[:version] ? opts[:version].to_i : nil\n ActiveRecord::Migrator.migrate(MigrationTestHelper.migration_dir, version)\n ensure\n ActiveRecord::Migration.verbose = old_verbose\n end\n\n module Connection #:nodoc:\n def conn\n ActiveRecord::Base.connection\n end\n end\n\n class Schema\n include Connection\n include Test::Unit::Assertions\n\n def initialize #:nodoc:\n @tables = []\n end\n\n def table(name)\n table = Table.new(name)\n yield table\n table.verify\n @tables << table\n end\n\n def verify #:nodoc:\n actual_tables = conn.tables.reject {|t| t == 'schema_info' || t == 'schema_migrations'}\n expected_tables = @tables.map {|t| t.name }\n assert_equal expected_tables.sort, actual_tables.sort, 'wrong tables in schema'\n end\n end\n\n class Table\n include Connection\n include Test::Unit::Assertions\n attr_reader :name\n\n def initialize(name) #:nodoc:\n @name = name.to_s\n @columns = []\n @indexes = []\n assert conn.tables.include?(@name), \"table <#{@name}> not found in schema\"\n end\n\n def column(colname,type,options={})\n colname = colname.to_s\n @columns << colname\n col = conn.columns(name).find {|c| c.name == colname }\n assert_not_nil col, \"column <#{colname}> not found in table <#{self.name}>\"\n assert_equal type, col.type, \"wrong type for column <#{colname}> in table <#{name}>\"\n options.each do |k,v|\n k = k.to_sym; actual = col.send(k); actual = actual.is_a?(String) ? actual.sub(/'$/,'').sub(/^'/,'') : actual\n assert_equal v, actual, \"column <#{colname}> in table <#{name}> has wrong :#{k}\"\n end\n end\n\n def index(column_name, options = {})\n @indexes << \"name <#{options[:name]}> columns <#{Array(column_name).join(\",\")}> unique <#{options[:unique] == true}>\" \n end\n\n def verify #:nodoc:\n actual_columns = conn.columns(name).map {|c| c.name }\n assert_equal @columns.sort, actual_columns.sort, \"wrong columns for table: <#{name}>\"\n\n actual_indexes = conn.indexes(@name).collect { |i| \"name <#{i.name}> columns <#{i.columns.join(\",\")}> unique <#{i.unique}>\" }\n assert_equal @indexes.sort, actual_indexes.sort, \"wrong indexes for table: <#{name}>\"\n end\n \n def method_missing(type, *columns)\n options = columns.extract_options!\n columns.each do |colname|\n column colname, type, options\n end\n end\n end\nend\n", "test/helper.rb": "ENV[\"RAILS_ENV\"] = \"test\"\nrequire File.expand_path(File.dirname(__FILE__) + '/../../../../config/environment')\nrequire 'logger'\nrequire 'fileutils'\nrequire 'test_help'\n\nplugin_path = RAILS_ROOT + \"/vendor/plugins/migration_test_helper\"\n\nconfig_location = File.expand_path(plugin_path + \"/test/config/database.yml\")\n\nconfig = YAML::load(ERB.new(IO.read(config_location)).result)\nActiveRecord::Base.logger = Logger.new(plugin_path + \"/test/log/test.log\")\nActiveRecord::Base.establish_connection(config['test'])\n\nTest::Unit::TestCase.fixture_path = plugin_path + \"/test/fixtures/\"\n\n$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)\n\nclass Test::Unit::TestCase\n include FileUtils\n def plugin_path(path)\n File.expand_path(File.dirname(__FILE__) + '/../' + path) \n end\n\n def load_default_schema\n ActiveRecord::Migration.suppress_messages do\n schema_file = plugin_path(\"/test/db/schema.rb\")\n load(schema_file) if File.exist?(schema_file)\n end\n end\n\n def migration_test_path\n File.expand_path(RAILS_ROOT + \"/test/migration\")\n end\n\n def run_in_rails_root(command)\n cd RAILS_ROOT do\n @output = `#{command}`\n end\n end\n\n def check_output(string_or_regexp)\n assert_not_nil @output, \"No output collected\"\n case string_or_regexp\n when String\n assert_match(/#{Regexp.escape(string_or_regexp)}/, @output)\n when Regexp\n assert_match(string_or_regexp, @output)\n else\n raise \"Can't check output using oddball object #{string_or_regexp.inspect}\"\n end\n end\n \n def rm_migration_test_path\n rm_rf migration_test_path\n end\n\n def self.should(behave,&block)\n return unless running_in_foundry\n @context ||= nil\n @context_setup ||= nil\n context_string = @context.nil? ? '' : @context + ' '\n mname = \"test #{context_string}should #{behave}\"\n context_setup = @context_setup\n if block_given?\n define_method(mname) do\n instance_eval(&context_setup) unless context_setup.nil?\n instance_eval(&block)\n end \n else\n puts \">>> UNIMPLEMENTED CASE: #{name.sub(/Test$/,'')} should #{behave}\"\n end\n end\n\nend\n", "test/migration_test_helper_test.rb": "require File.expand_path(File.dirname(__FILE__) + '/helper') \n\nclass MigrationTestHelperTest < Test::Unit::TestCase\n\n def setup\n load_default_schema\n MigrationTestHelper.migration_dir = plugin_path('test/db/migrate_good')\n end\n\n #\n # HELPERS\n #\n def see_failure(pattern='')\n err = assert_raise(Test::Unit::AssertionFailedError) do\n yield\n end\n assert_match(/#{pattern}/mi, err.message) \n end\n\n def see_no_failure\n assert_nothing_raised do\n yield\n end\n end\n\n def declare_columns_on_table(t)\n t.column :id, :integer\n t.column :tail, :string, :default => 'top dog', :limit => 187\n end\n \n #\n # TESTS\n #\n def test_assert_schema_should_not_fail_if_schema_is_matched\n see_no_failure do\n assert_schema do |s|\n s.table :dogs do |t|\n\t declare_columns_on_table(t)\n\t t.index :tail, :name => 'index_tail_on_dogs'\n end\n\n end\n end\n end\n\n def test_assert_schema_should_fail_if_a_table_is_not_specified\n see_failure 'wrong tables in schema.*dogs' do\n assert_schema do |s|\n end\n end\n end\n\n def test_assert_schema_should_fail_if_a_table_is_not_found\n see_failure 'table \n * There are two ways to use String
format, and instantiates a {@link java.util.Date} object. \n * \n * StringToTime
to parse dates: \n * \n *
\n * StringToTime
with {@link #StringToTime(Object)}
The static methods provide a UNIX-style timestamp, a {@link java.util.Date} instance, or a \n * {@link java.util.Calendar} instance. In the event the time expression provided is invalid, \n * these methods return Boolean.FALSE
.
Instances of StringToTime
inherit from {@link java.util.Date}; so, when instantiated\n * with an expression that the algorithm recognizes, the resulting instance of StringToTime
\n * can be passed to any method or caller requiring a {@link java.util.Date} object. Unlike the static methods,\n * attempting to create a StringToTime
instance with an invalid expression of time \n * results in a {@link StringToTimeException}.
All expressions are case-insensitive.
\n * \n *now
(equal to new Date()
)today
(equal to StringToTime(\"00:00:00.000\")
)midnight
(equal to StringToTime(\"00:00:00.000 +24 hours\")
)morning
or this morning
(by default, equal toStringToTime(\"07:00:00.000\")
)noon
(by default, equal to StringToTime(\"12:00:00.000\")
afternoon
or this afternoon
(by default, equal to StringToTime(\"13:00:00.000\")
evening
or this evening
(by default, equal to StringToTime(\"17:00:00.000\")
tonight
(by default, equal to StringToTime(\"20:00:00.000\")
tomorrow
(by default, equal to StringToTime(\"now +24 hours\")
)tomorrow morning
(by default, equal to StringToTime(\"morning +24 hours\")
)noon tomorrow
or tomorrow noon
(by default, equal to StringToTime(\"noon +24 hours\")
)tomorrow afternoon
(by default, equal to StringToTime(\"afternoon +24 hours\")
)yesterday
(by default, equal to StringToTime(\"now -24 hours\")
)yesterday
and morning
, noon
, afternoon
, and evening
October 26, 1981
or Oct 26, 1981
October 26
or Oct 26
26 October 1981
26 Oct 1981
26 Oct 81
10/26/1981
or 10-26-1981
10/26/81
or 10-26-81
1981/10/26
or 1981-10-26
10/26
or 10-26
false
*/\n\tprivate Object date;\n\t\n\t\n\tpublic StringToTime() {\n\t\tsuper();\n\t\tthis.date = new Date(this.getTime());\n\t}\n\t\n\tpublic StringToTime(Date date) {\n\t\tsuper(date.getTime());\n\t\tthis.date = new Date(this.getTime());\n\t}\n\t\n\tpublic StringToTime(Object dateTimeString) {\n\t\tthis(dateTimeString, new Date(), defaultSimpleDateFormat);\n\t}\n\t\n\tpublic StringToTime(Object dateTimeString, String simpleDateFormat) {\n\t\tthis(dateTimeString, new Date(), simpleDateFormat);\n\t}\n\t\n\tpublic StringToTime(Object dateTimeString, Date now) {\n\t\tthis(dateTimeString, now, defaultSimpleDateFormat);\n\t}\n\t\n\tpublic StringToTime(Object dateTimeString, Long now) {\n\t\tthis(dateTimeString, new Date(now), defaultSimpleDateFormat);\n\t}\n\t\n\tpublic StringToTime(Object dateTimeString, Integer now) {\n\t\tthis(dateTimeString, new Date(new Long(now)), defaultSimpleDateFormat);\n\t}\n\t\n\tpublic StringToTime(Object dateTimeString, Date now, String simpleDateFormat) {\n\t\tsuper(0);\n\t\tassert dateTimeString != null;\n assert now != null;\n assert simpleDateFormat != null;\n\t\t\n\t\tthis.dateTimeString = dateTimeString;\n\t\tthis.simpleDateFormat = simpleDateFormat;\n\t\t\n\t\tdate = StringToTime.date(dateTimeString, now);\n\t\tif (!Boolean.FALSE.equals(date))\n\t\t\tsetTime(((Date) date).getTime());\n\t\telse\n\t\t\tthrow new StringToTimeException(dateTimeString);\n\t}\n\t\n\t/**\n\t * @return {@link java.util.Date#getTime()}\n\t */\n\tpublic long getTime() {\n\t\treturn super.getTime();\n\t}\n\t\n\t/**\n\t * @return Calendar set to timestamp {@link java.util.Date#getTime()}\n\t */\n\tpublic Calendar getCal() {\n\t\tCalendar cal = Calendar.getInstance();\n\t\tcal.setTimeInMillis(super.getTime());\n\t\treturn cal;\n\t}\n\t\n\t/**\n\t * @param simpleDateFormat\n\t * @see {@link SimpleDateFormat}\n\t * @return Date formatted according to simpleDateFormat
\n\t */\n\tpublic String format(String simpleDateFormat) {\n\t\treturn new SimpleDateFormat(simpleDateFormat).format(this);\n\t}\n\t\n\t/**\n\t * @return If {@link #simpleDateFormat} provided in constructor, then attempts to format date
\n\t * accordingly; otherwise, returns the String
value of {@link java.util.Date#getTime()}.\n\t */\n\tpublic String toString() {\n\t\tif (simpleDateFormat != null)\n\t\t\treturn new SimpleDateFormat(simpleDateFormat).format(this);\n\t\telse\n\t\t\treturn new SimpleDateFormat(\"yyyy/dd/MM\").format(this); //String.valueOf(super.getTime());\n\t}\n\t\n\t\n\t/**\n\t * A single parameter version of {@link #time(String, Date)}, passing a new instance of {@link java.util.Date} as the\n\t * second parameter.\n\t * @param dateTimeString\n\t * @return A {@link java.lang.Long} timestamp representative of dateTimeString
, or {@link java.lang.Boolean} false
.\n\t * @see #time(String, Date)\n\t */\n\tpublic static Object time(Object dateTimeString) {\n\t\treturn time(dateTimeString, new Date());\n\t}\n\t\n\t/**\n\t * Parse dateTimeString
and produce a timestamp. \n\t * @param dateTimeString\n\t * @param now \n\t * @return now
.now
.\n\t * String
format, and returns a timestamp or {@link DateTime}\n * object.\n * \n * \n * All expressions are case-insensitive.\n *
\n * \n *now
(equal to new Date()
)today
(equal to StringToTime(\"00:00:00.000\")
)midnight
(equal to\n * StringToTime(\"00:00:00.000 +24 hours\")
)morning
or this morning
(by default, equal to\n * StringToTime(\"07:00:00.000\")
)noon
(by default, equal to\n * StringToTime(\"12:00:00.000\")
afternoon
or this afternoon
(by default, equal\n * to StringToTime(\"13:00:00.000\")
evening
or this evening
(by default, equal to\n * StringToTime(\"17:00:00.000\")
tonight
(by default, equal to\n * StringToTime(\"20:00:00.000\")
tomorrow
(by default, equal to\n * StringToTime(\"now +24 hours\")
)tomorrow morning
(by default, equal to\n * StringToTime(\"morning +24 hours\")
)noon tomorrow
or tomorrow noon
(by default,\n * equal to StringToTime(\"noon +24 hours\")
)tomorrow afternoon
(by default, equal to\n * StringToTime(\"afternoon +24 hours\")
)yesterday
(by default, equal to\n * StringToTime(\"now -24 hours\")
)yesterday
and morning
,\n * noon
, afternoon
, and evening
October 26, 1981
or Oct 26, 1981
October 26
or Oct 26
26 October 1981
26 Oct 1981
26 Oct 81
10/26/1981
or 10-26-1981
10/26/81
or 10-26-81
1981/10/26
or 1981-10-26
10/26
or 10-26
\n\t\t\t\t\t\t\tNo configuration files could be found. Check that\n\t\t\t\t\t\t\t\".$this->tiny_mce_config_path.\"
\n\t\t\t\t\t\t\tis readable and contains at least one configuration file.\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\tNo configuration files could be found. Check that\n\t\t\t\t\t\t\t\".$this->tiny_mce_config_path.\"
\n\t\t\t\t\t\t\tis readable and contains at least one configuration file.\n\t\t\t\t\t\t
\r\n Demonstrate use of the various types of Google layers.\r\n
\r\n \r\n \r\n\r\n \r\n", "demos/selectmenu/refresh.html": "\n\n\t\n\t\n\t