standalone_migrations 1.0.13 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -1
- data/Gemfile.lock +52 -15
- data/README.markdown +5 -4
- data/VERSION +1 -1
- data/example/.gitignore +5 -0
- data/example/Rakefile +9 -0
- data/example/db/config.yml +15 -0
- data/example/db/migrate/20120930053225_create_table_awesome_migration.rb +7 -0
- data/lib/standalone_migrations.rb +19 -0
- data/lib/standalone_migrations/configurator.rb +1 -1
- data/lib/standalone_migrations/generator.rb +11 -0
- data/lib/standalone_migrations/minimal_railtie_config.rb +10 -0
- data/lib/standalone_migrations/tasks.rb +34 -0
- data/lib/standalone_migrations/tasks/connection.rake +7 -0
- data/lib/standalone_migrations/tasks/db/new_migration.rake +10 -0
- data/lib/standalone_migrations/tasks/environment.rake +3 -0
- data/lib/tasks/standalone_migrations.rb +10 -111
- data/spec/standalone_migrations_spec.rb +9 -3
- data/standalone_migrations.gemspec +19 -5
- metadata +34 -7
    
        data/Gemfile
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,28 +1,58 @@ | |
| 1 1 | 
             
            GEM
         | 
| 2 2 | 
             
              remote: http://rubygems.org/
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                 | 
| 5 | 
            -
                   | 
| 4 | 
            +
                actionpack (3.2.8)
         | 
| 5 | 
            +
                  activemodel (= 3.2.8)
         | 
| 6 | 
            +
                  activesupport (= 3.2.8)
         | 
| 6 7 | 
             
                  builder (~> 3.0.0)
         | 
| 7 | 
            -
                   | 
| 8 | 
            -
             | 
| 9 | 
            -
                   | 
| 10 | 
            -
                   | 
| 11 | 
            -
                   | 
| 8 | 
            +
                  erubis (~> 2.7.0)
         | 
| 9 | 
            +
                  journey (~> 1.0.4)
         | 
| 10 | 
            +
                  rack (~> 1.4.0)
         | 
| 11 | 
            +
                  rack-cache (~> 1.2)
         | 
| 12 | 
            +
                  rack-test (~> 0.6.1)
         | 
| 13 | 
            +
                  sprockets (~> 2.1.3)
         | 
| 14 | 
            +
                activemodel (3.2.8)
         | 
| 15 | 
            +
                  activesupport (= 3.2.8)
         | 
| 16 | 
            +
                  builder (~> 3.0.0)
         | 
| 17 | 
            +
                activerecord (3.2.8)
         | 
| 18 | 
            +
                  activemodel (= 3.2.8)
         | 
| 19 | 
            +
                  activesupport (= 3.2.8)
         | 
| 20 | 
            +
                  arel (~> 3.0.2)
         | 
| 12 21 | 
             
                  tzinfo (~> 0.3.29)
         | 
| 13 | 
            -
                activesupport (3. | 
| 22 | 
            +
                activesupport (3.2.8)
         | 
| 23 | 
            +
                  i18n (~> 0.6)
         | 
| 14 24 | 
             
                  multi_json (~> 1.0)
         | 
| 15 | 
            -
                arel ( | 
| 16 | 
            -
                builder (3.0. | 
| 25 | 
            +
                arel (3.0.2)
         | 
| 26 | 
            +
                builder (3.0.3)
         | 
| 17 27 | 
             
                diff-lcs (1.1.3)
         | 
| 28 | 
            +
                erubis (2.7.0)
         | 
| 18 29 | 
             
                git (1.2.5)
         | 
| 19 | 
            -
                 | 
| 30 | 
            +
                hike (1.2.1)
         | 
| 31 | 
            +
                i18n (0.6.1)
         | 
| 20 32 | 
             
                jeweler (1.6.4)
         | 
| 21 33 | 
             
                  bundler (~> 1.0)
         | 
| 22 34 | 
             
                  git (>= 1.2.5)
         | 
| 23 35 | 
             
                  rake
         | 
| 24 | 
            -
                 | 
| 36 | 
            +
                journey (1.0.4)
         | 
| 37 | 
            +
                json (1.7.5)
         | 
| 38 | 
            +
                multi_json (1.3.6)
         | 
| 39 | 
            +
                rack (1.4.1)
         | 
| 40 | 
            +
                rack-cache (1.2)
         | 
| 41 | 
            +
                  rack (>= 0.4)
         | 
| 42 | 
            +
                rack-ssl (1.3.2)
         | 
| 43 | 
            +
                  rack
         | 
| 44 | 
            +
                rack-test (0.6.1)
         | 
| 45 | 
            +
                  rack (>= 1.0)
         | 
| 46 | 
            +
                railties (3.2.8)
         | 
| 47 | 
            +
                  actionpack (= 3.2.8)
         | 
| 48 | 
            +
                  activesupport (= 3.2.8)
         | 
| 49 | 
            +
                  rack-ssl (~> 1.3.2)
         | 
| 50 | 
            +
                  rake (>= 0.8.7)
         | 
| 51 | 
            +
                  rdoc (~> 3.4)
         | 
| 52 | 
            +
                  thor (>= 0.14.6, < 2.0)
         | 
| 25 53 | 
             
                rake (0.9.2.2)
         | 
| 54 | 
            +
                rdoc (3.12)
         | 
| 55 | 
            +
                  json (~> 1.4)
         | 
| 26 56 | 
             
                rspec (2.7.0)
         | 
| 27 57 | 
             
                  rspec-core (~> 2.7.0)
         | 
| 28 58 | 
             
                  rspec-expectations (~> 2.7.0)
         | 
| @@ -31,15 +61,22 @@ GEM | |
| 31 61 | 
             
                rspec-expectations (2.7.0)
         | 
| 32 62 | 
             
                  diff-lcs (~> 1.1.2)
         | 
| 33 63 | 
             
                rspec-mocks (2.7.0)
         | 
| 34 | 
            -
                 | 
| 35 | 
            -
             | 
| 64 | 
            +
                sprockets (2.1.3)
         | 
| 65 | 
            +
                  hike (~> 1.2)
         | 
| 66 | 
            +
                  rack (~> 1.0)
         | 
| 67 | 
            +
                  tilt (~> 1.1, != 1.3.0)
         | 
| 68 | 
            +
                sqlite3 (1.3.6)
         | 
| 69 | 
            +
                thor (0.16.0)
         | 
| 70 | 
            +
                tilt (1.3.3)
         | 
| 71 | 
            +
                tzinfo (0.3.33)
         | 
| 36 72 |  | 
| 37 73 | 
             
            PLATFORMS
         | 
| 38 74 | 
             
              ruby
         | 
| 39 75 |  | 
| 40 76 | 
             
            DEPENDENCIES
         | 
| 41 | 
            -
              activerecord ( | 
| 77 | 
            +
              activerecord (~> 3.2.6)
         | 
| 42 78 | 
             
              jeweler
         | 
| 79 | 
            +
              railties (~> 3.2.6)
         | 
| 43 80 | 
             
              rake
         | 
| 44 81 | 
             
              rspec (~> 2)
         | 
| 45 82 | 
             
              sqlite3
         | 
    
        data/README.markdown
    CHANGED
    
    | @@ -2,7 +2,7 @@ Rails migrations in non-Rails (and non Ruby) projects. | |
| 2 2 |  | 
| 3 3 | 
             
            WHAT'S NEW
         | 
| 4 4 | 
             
            ==========
         | 
| 5 | 
            -
            In the  | 
| 5 | 
            +
            In the 2.x release we have moved to using Rails 3 migrations instead of maintaining our own migration related code. Just about anything you can do with Rails 3 migrations you can now do with [Standalone Migrations](https://github.com/thuss/standalone-migrations) too! This removed 95% of the code we have to maintain. Big thanks to [Ricardo Valeriano](http://ricardovaleriano.com/) and [Michael Grosser](http://pragmatig.wordpress.com) for undertaking this major rewrite!
         | 
| 6 6 |  | 
| 7 7 | 
             
            CONTRIBUTE
         | 
| 8 8 | 
             
            ==========
         | 
| @@ -185,16 +185,17 @@ migration. | |
| 185 185 | 
             
            Contributors
         | 
| 186 186 | 
             
            ============
         | 
| 187 187 | 
             
             - [Todd Huss](http://gabrito.com/)
         | 
| 188 | 
            -
             - [Two Bit Labs](http://twobitlabs.com/)
         | 
| 189 | 
            -
             - [Class Monkeys](http://www.classmonkeys.com/) 
         | 
| 190 188 | 
             
             - [Michael Grosser](http://pragmatig.wordpress.com)
         | 
| 189 | 
            +
             - [Ricardo Valeriano](http://ricardovaleriano.com/)
         | 
| 190 | 
            +
             - [Two Bit Labs](http://twobitlabs.com/)
         | 
| 191 | 
            +
             - [ClassMonkeys](http://www.classmonkeys.com/) 
         | 
| 192 | 
            +
             - [Windandtides](http://windandtides.com/)
         | 
| 191 193 | 
             
             - [Eric Lindvall](http://bitmonkey.net)
         | 
| 192 194 | 
             
             - [Steve Hodgkiss](http://stevehodgkiss.com/)
         | 
| 193 195 | 
             
             - [Rich Meyers](https://github.com/richmeyers)
         | 
| 194 196 | 
             
             - [Wes Bailey](http://exposinggotchas.blogspot.com/)
         | 
| 195 197 | 
             
             - [Robert J. Berger](http://blog.ibd.com/)
         | 
| 196 198 | 
             
             - [Federico Builes](http://mheroin.com/)
         | 
| 197 | 
            -
             - [Ricardo Valeriano](http://ricardovaleriano.com/)
         | 
| 198 199 | 
             
             - [Gazler](http://blog.gazler.com/)
         | 
| 199 200 | 
             
             - [Yuu Yamashita](https://github.com/yyuu)
         | 
| 200 201 | 
             
             - [Koen Punt](http://www.koen.pt/)
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            2.0.0
         | 
    
        data/example/.gitignore
    ADDED
    
    
    
        data/example/Rakefile
    ADDED
    
    | @@ -0,0 +1,9 @@ | |
| 1 | 
            +
            # $LOAD_PATH handling not need if the standalone_migrations
         | 
| 2 | 
            +
            # gem is installed
         | 
| 3 | 
            +
            lib = File.expand_path("../../lib", __FILE__)
         | 
| 4 | 
            +
            $:.unshift lib unless $:.include?(lib)
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            require "standalone_migrations"
         | 
| 7 | 
            +
            StandaloneMigrations::Tasks.load_tasks
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            # and that's it!
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            development:
         | 
| 2 | 
            +
              adapter: sqlite3
         | 
| 3 | 
            +
              database: db/development.sqlite3
         | 
| 4 | 
            +
              pool: 5
         | 
| 5 | 
            +
              timeout: 5000
         | 
| 6 | 
            +
            test:
         | 
| 7 | 
            +
              adapter: sqlite3
         | 
| 8 | 
            +
              database: db/test.sqlite3
         | 
| 9 | 
            +
              pool: 5
         | 
| 10 | 
            +
              timeout: 5000
         | 
| 11 | 
            +
            production:
         | 
| 12 | 
            +
              adapter: sqlite3
         | 
| 13 | 
            +
              database: db/production.sqlite3
         | 
| 14 | 
            +
              pool: 5
         | 
| 15 | 
            +
              timeout: 5000
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            lib_path = File.expand_path("../", __FILE__)
         | 
| 2 | 
            +
            $:.unshift lib_path unless $:.include?(lib_path)
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            require "rubygems"
         | 
| 5 | 
            +
            require "rails"
         | 
| 6 | 
            +
            require "active_record"
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            require "standalone_migrations/configurator"
         | 
| 9 | 
            +
            require "standalone_migrations/generator"
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            railtie_app_path = "#{lib_path}/standalone_migrations/minimal_railtie_config"
         | 
| 12 | 
            +
            APP_PATH = File.expand_path(railtie_app_path,  __FILE__)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            require "standalone_migrations/minimal_railtie_config"
         | 
| 15 | 
            +
            require "standalone_migrations/tasks"
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            if !ENV["RAILS_ENV"]
         | 
| 18 | 
            +
              ENV["RAILS_ENV"] = ENV["DB"] || ENV["RACK_ENV"] || Rails.env || "development"
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            # these generators are backed by rails' generators
         | 
| 2 | 
            +
            require "rails/generators"
         | 
| 3 | 
            +
            module StandaloneMigrations
         | 
| 4 | 
            +
              class Generator
         | 
| 5 | 
            +
                def self.migration(name, options="")
         | 
| 6 | 
            +
                  generator_params = [name] + options.split(" ")
         | 
| 7 | 
            +
                  Rails::Generators.invoke "active_record:migration", generator_params,
         | 
| 8 | 
            +
                    destination_root: Rails.root
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
            end
         | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            module StandaloneMigrations
         | 
| 2 | 
            +
              class StandaloneMigrations::MinimalRailtieConfig < Rails::Application
         | 
| 3 | 
            +
                config.generators.options[:rails] = {orm: :active_record}
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                config.generators.options[:active_record] = {
         | 
| 6 | 
            +
                  migration: true,
         | 
| 7 | 
            +
                  timestamps: true
         | 
| 8 | 
            +
                }
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
            end
         | 
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            module StandaloneMigrations
         | 
| 2 | 
            +
              class Tasks
         | 
| 3 | 
            +
                class << self
         | 
| 4 | 
            +
                  def configure
         | 
| 5 | 
            +
                    Deprecations.new.call
         | 
| 6 | 
            +
                    config_database_file = Configurator.new.config
         | 
| 7 | 
            +
                    paths = Rails.application.config.paths
         | 
| 8 | 
            +
                    paths.add "config/database", :with => config_database_file
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  def load_tasks
         | 
| 12 | 
            +
                    configure
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    MinimalRailtieConfig.load_tasks
         | 
| 15 | 
            +
                    %w(
         | 
| 16 | 
            +
                      connection
         | 
| 17 | 
            +
                      environment
         | 
| 18 | 
            +
                      db/new_migration
         | 
| 19 | 
            +
                    ).each do
         | 
| 20 | 
            +
                      |task| load "standalone_migrations/tasks/#{task}.rake"
         | 
| 21 | 
            +
                    end
         | 
| 22 | 
            +
                    load "active_record/railties/databases.rake"
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              class Tasks::Deprecations
         | 
| 28 | 
            +
                def call
         | 
| 29 | 
            +
                  if File.directory?('db/migrations')
         | 
| 30 | 
            +
                    puts "DEPRECATED move your migrations into db/migrate"
         | 
| 31 | 
            +
                  end
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
            end
         | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            namespace :db do
         | 
| 2 | 
            +
              task :new_migration do |t|
         | 
| 3 | 
            +
                unless name = ENV['name']
         | 
| 4 | 
            +
                  puts "Error: must provide name of migration to generate."
         | 
| 5 | 
            +
                  puts "For example: rake #{t.name} name=add_field_to_form"
         | 
| 6 | 
            +
                  abort
         | 
| 7 | 
            +
                end
         | 
| 8 | 
            +
                StandaloneMigrations::Generator.migration name
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
            end
         | 
| @@ -1,111 +1,10 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            require  | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
            # | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
            def standalone_configurator
         | 
| 12 | 
            -
              @configurator ||= StandaloneMigrations::Configurator.new
         | 
| 13 | 
            -
            end
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            module Rails
         | 
| 16 | 
            -
              def self.env
         | 
| 17 | 
            -
                s = (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['DB'] || 'development').dup # env is frozen -> dup
         | 
| 18 | 
            -
                def s.development?; self == 'development';end
         | 
| 19 | 
            -
                s
         | 
| 20 | 
            -
              end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
              def self.root
         | 
| 23 | 
            -
                Pathname.new Dir.pwd
         | 
| 24 | 
            -
              end
         | 
| 25 | 
            -
             | 
| 26 | 
            -
              def self.application
         | 
| 27 | 
            -
                s = "fake_app"
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                def s.paths
         | 
| 30 | 
            -
                  {
         | 
| 31 | 
            -
                    "db/migrate"   => [standalone_configurator.migrate_dir],
         | 
| 32 | 
            -
                    "db/seeds.rb"  => [standalone_configurator.seeds],
         | 
| 33 | 
            -
                    "db/schema.rb" => [standalone_configurator.schema]
         | 
| 34 | 
            -
                  } 
         | 
| 35 | 
            -
                end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                def s.config
         | 
| 38 | 
            -
                  s = "fake_config"
         | 
| 39 | 
            -
                  def s.database_configuration
         | 
| 40 | 
            -
                    standalone_configurator.config_for_all
         | 
| 41 | 
            -
                  end
         | 
| 42 | 
            -
                  s
         | 
| 43 | 
            -
                end
         | 
| 44 | 
            -
                
         | 
| 45 | 
            -
                def s.load_seed
         | 
| 46 | 
            -
                  seed_file = paths["db/seeds.rb"].select{ |f| File.exists?(f) }.first
         | 
| 47 | 
            -
                  load(seed_file) if seed_file
         | 
| 48 | 
            -
                end
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                def s.eager_load!
         | 
| 51 | 
            -
                end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                s
         | 
| 54 | 
            -
              end
         | 
| 55 | 
            -
             | 
| 56 | 
            -
            end
         | 
| 57 | 
            -
             | 
| 58 | 
            -
            task(:rails_env){}
         | 
| 59 | 
            -
             | 
| 60 | 
            -
            task(:environment => "db:load_config") do
         | 
| 61 | 
            -
              ActiveRecord::Base.establish_connection standalone_configurator.config_for Rails.env
         | 
| 62 | 
            -
            end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
            load 'active_record/railties/databases.rake'
         | 
| 65 | 
            -
             | 
| 66 | 
            -
            namespace :db do
         | 
| 67 | 
            -
              task :load_config do
         | 
| 68 | 
            -
                ActiveRecord::Base.configurations = standalone_configurator.config_for_all
         | 
| 69 | 
            -
              end
         | 
| 70 | 
            -
             | 
| 71 | 
            -
              desc "Create a new migration"
         | 
| 72 | 
            -
              task :new_migration do |t|
         | 
| 73 | 
            -
                unless migration = ENV['name']
         | 
| 74 | 
            -
                  puts "Error: must provide name of migration to generate."
         | 
| 75 | 
            -
                  puts "For example: rake #{t.name} name=add_field_to_form"
         | 
| 76 | 
            -
                  abort
         | 
| 77 | 
            -
                end
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                file_contents = <<eof
         | 
| 80 | 
            -
            class #{class_name migration} < ActiveRecord::Migration
         | 
| 81 | 
            -
              def up
         | 
| 82 | 
            -
              end
         | 
| 83 | 
            -
             | 
| 84 | 
            -
              def down
         | 
| 85 | 
            -
                raise ActiveRecord::IrreversibleMigration
         | 
| 86 | 
            -
              end
         | 
| 87 | 
            -
            end
         | 
| 88 | 
            -
            eof
         | 
| 89 | 
            -
                filename = migration.underscore
         | 
| 90 | 
            -
                create_file file_name(filename), file_contents
         | 
| 91 | 
            -
                puts "Created migration #{file_name filename}"
         | 
| 92 | 
            -
              end
         | 
| 93 | 
            -
             | 
| 94 | 
            -
              def configurator
         | 
| 95 | 
            -
                standalone_configurator
         | 
| 96 | 
            -
              end
         | 
| 97 | 
            -
             | 
| 98 | 
            -
              def create_file file, contents
         | 
| 99 | 
            -
                path = File.dirname(file)
         | 
| 100 | 
            -
                FileUtils.mkdir_p path unless File.exists? path
         | 
| 101 | 
            -
                File.open(file, 'w') { |f| f.write contents }
         | 
| 102 | 
            -
              end
         | 
| 103 | 
            -
             | 
| 104 | 
            -
              def file_name migration
         | 
| 105 | 
            -
                File.join configurator.migrate_dir, "#{Time.now.utc.strftime '%Y%m%d%H%M%S'}_#{migration}.rb"
         | 
| 106 | 
            -
              end
         | 
| 107 | 
            -
             | 
| 108 | 
            -
              def class_name str
         | 
| 109 | 
            -
                str.underscore.camelize
         | 
| 110 | 
            -
              end
         | 
| 111 | 
            -
            end
         | 
| 1 | 
            +
            # I really think we should deprecate this file, seems to me that is
         | 
| 2 | 
            +
            # more explicit if the user require "standalone_migrations" and then
         | 
| 3 | 
            +
            # call the load_tasks methods in his Rakefile. But this only a
         | 
| 4 | 
            +
            # suggestion, and we can get rid of this comment if others on the
         | 
| 5 | 
            +
            # project don't agree with that
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            # Ricardo Valeriano
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            require File.expand_path("../../standalone_migrations", __FILE__)
         | 
| 10 | 
            +
            StandaloneMigrations::Tasks.load_tasks
         | 
| @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            describe 'Standalone migrations' do
         | 
| 2 | 
            +
             | 
| 2 3 | 
             
              def write(file, content)
         | 
| 3 4 | 
             
                raise "cannot write nil" unless file
         | 
| 4 5 | 
             
                file = tmp_file(file)
         | 
| @@ -40,7 +41,8 @@ describe 'Standalone migrations' do | |
| 40 41 | 
             
                write 'Rakefile', <<-TXT
         | 
| 41 42 | 
             
            $LOAD_PATH.unshift '#{File.expand_path('lib')}'
         | 
| 42 43 | 
             
            begin
         | 
| 43 | 
            -
              require  | 
| 44 | 
            +
              require "standalone_migrations"
         | 
| 45 | 
            +
              StandaloneMigrations::Tasks.load_tasks
         | 
| 44 46 | 
             
            rescue LoadError => e
         | 
| 45 47 | 
             
              puts "gem install standalone_migrations to get db:migrate:* tasks! (Error: \#{e})"
         | 
| 46 48 | 
             
            end
         | 
| @@ -87,6 +89,10 @@ test: | |
| 87 89 | 
             
                TXT
         | 
| 88 90 | 
             
              end
         | 
| 89 91 |  | 
| 92 | 
            +
              after(:all) do
         | 
| 93 | 
            +
                `rm -rf spec/tmp` if File.exist?('spec/tmp')
         | 
| 94 | 
            +
              end
         | 
| 95 | 
            +
             | 
| 90 96 | 
             
              it "warns of deprecated folder structure" do
         | 
| 91 97 | 
             
                warning = /DEPRECATED.* db\/migrate/
         | 
| 92 98 | 
             
                run("rake db:create").should_not =~ warning
         | 
| @@ -107,12 +113,12 @@ test: | |
| 107 113 | 
             
                end
         | 
| 108 114 |  | 
| 109 115 | 
             
                it "generates a new migration with this name and timestamp" do
         | 
| 110 | 
            -
                  run("rake db:new_migration name=test_abc").should =~ %r{ | 
| 116 | 
            +
                  run("rake db:new_migration name=test_abc").should =~ %r{create(.*)db/migrate/\d+_test_abc\.rb}
         | 
| 111 117 | 
             
                  run("ls db/migrate").should =~ /^\d+_test_abc.rb$/
         | 
| 112 118 | 
             
                end
         | 
| 113 119 |  | 
| 114 120 | 
             
                it "generates a new migration with the name converted to the Rails migration format" do
         | 
| 115 | 
            -
                  run("rake db:new_migration name=MyNiceModel").should =~ %r{ | 
| 121 | 
            +
                  run("rake db:new_migration name=MyNiceModel").should =~ %r{create(.*)db/migrate/\d+_my_nice_model\.rb}
         | 
| 116 122 | 
             
                  read(migration('my_nice_model')).should =~ /class MyNiceModel/
         | 
| 117 123 | 
             
                  run("ls db/migrate").should =~ /^\d+_my_nice_model.rb$/
         | 
| 118 124 | 
             
                end
         | 
| @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = "standalone_migrations"
         | 
| 8 | 
            -
              s.version = " | 
| 8 | 
            +
              s.version = "2.0.0"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Todd Huss", "Michael Grosser"]
         | 
| 12 | 
            -
              s.date = "2012- | 
| 12 | 
            +
              s.date = "2012-10-01"
         | 
| 13 13 | 
             
              s.email = "thuss@gabrito.com"
         | 
| 14 14 | 
             
              s.extra_rdoc_files = [
         | 
| 15 15 | 
             
                "README.markdown"
         | 
| @@ -21,7 +21,18 @@ Gem::Specification.new do |s| | |
| 21 21 | 
             
                "README.markdown",
         | 
| 22 22 | 
             
                "Rakefile",
         | 
| 23 23 | 
             
                "VERSION",
         | 
| 24 | 
            +
                "example/.gitignore",
         | 
| 25 | 
            +
                "example/Rakefile",
         | 
| 26 | 
            +
                "example/db/config.yml",
         | 
| 27 | 
            +
                "example/db/migrate/20120930053225_create_table_awesome_migration.rb",
         | 
| 28 | 
            +
                "lib/standalone_migrations.rb",
         | 
| 24 29 | 
             
                "lib/standalone_migrations/configurator.rb",
         | 
| 30 | 
            +
                "lib/standalone_migrations/generator.rb",
         | 
| 31 | 
            +
                "lib/standalone_migrations/minimal_railtie_config.rb",
         | 
| 32 | 
            +
                "lib/standalone_migrations/tasks.rb",
         | 
| 33 | 
            +
                "lib/standalone_migrations/tasks/connection.rake",
         | 
| 34 | 
            +
                "lib/standalone_migrations/tasks/db/new_migration.rake",
         | 
| 35 | 
            +
                "lib/standalone_migrations/tasks/environment.rake",
         | 
| 25 36 | 
             
                "lib/tasks/standalone_migrations.rb",
         | 
| 26 37 | 
             
                "spec/spec_helper.rb",
         | 
| 27 38 | 
             
                "spec/standalone_migrations/configurator_spec.rb",
         | 
| @@ -42,14 +53,17 @@ Gem::Specification.new do |s| | |
| 42 53 |  | 
| 43 54 | 
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 44 55 | 
             
                  s.add_runtime_dependency(%q<rake>, [">= 0"])
         | 
| 45 | 
            -
                  s.add_runtime_dependency(%q<activerecord>, [" | 
| 56 | 
            +
                  s.add_runtime_dependency(%q<activerecord>, ["~> 3.2.6"])
         | 
| 57 | 
            +
                  s.add_runtime_dependency(%q<railties>, ["~> 3.2.6"])
         | 
| 46 58 | 
             
                else
         | 
| 47 59 | 
             
                  s.add_dependency(%q<rake>, [">= 0"])
         | 
| 48 | 
            -
                  s.add_dependency(%q<activerecord>, [" | 
| 60 | 
            +
                  s.add_dependency(%q<activerecord>, ["~> 3.2.6"])
         | 
| 61 | 
            +
                  s.add_dependency(%q<railties>, ["~> 3.2.6"])
         | 
| 49 62 | 
             
                end
         | 
| 50 63 | 
             
              else
         | 
| 51 64 | 
             
                s.add_dependency(%q<rake>, [">= 0"])
         | 
| 52 | 
            -
                s.add_dependency(%q<activerecord>, [" | 
| 65 | 
            +
                s.add_dependency(%q<activerecord>, ["~> 3.2.6"])
         | 
| 66 | 
            +
                s.add_dependency(%q<railties>, ["~> 3.2.6"])
         | 
| 53 67 | 
             
              end
         | 
| 54 68 | 
             
            end
         | 
| 55 69 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: standalone_migrations
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 2.0.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -10,7 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date: 2012- | 
| 13 | 
            +
            date: 2012-10-01 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: rake
         | 
| @@ -33,17 +33,33 @@ dependencies: | |
| 33 33 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 34 34 | 
             
                none: false
         | 
| 35 35 | 
             
                requirements:
         | 
| 36 | 
            -
                - -  | 
| 36 | 
            +
                - - ~>
         | 
| 37 37 | 
             
                  - !ruby/object:Gem::Version
         | 
| 38 | 
            -
                    version:  | 
| 38 | 
            +
                    version: 3.2.6
         | 
| 39 39 | 
             
              type: :runtime
         | 
| 40 40 | 
             
              prerelease: false
         | 
| 41 41 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 42 42 | 
             
                none: false
         | 
| 43 43 | 
             
                requirements:
         | 
| 44 | 
            -
                - -  | 
| 44 | 
            +
                - - ~>
         | 
| 45 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            +
                    version: 3.2.6
         | 
| 47 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 48 | 
            +
              name: railties
         | 
| 49 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 50 | 
            +
                none: false
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - ~>
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: 3.2.6
         | 
| 55 | 
            +
              type: :runtime
         | 
| 56 | 
            +
              prerelease: false
         | 
| 57 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                none: false
         | 
| 59 | 
            +
                requirements:
         | 
| 60 | 
            +
                - - ~>
         | 
| 45 61 | 
             
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            -
                    version:  | 
| 62 | 
            +
                    version: 3.2.6
         | 
| 47 63 | 
             
            description: 
         | 
| 48 64 | 
             
            email: thuss@gabrito.com
         | 
| 49 65 | 
             
            executables: []
         | 
| @@ -57,7 +73,18 @@ files: | |
| 57 73 | 
             
            - README.markdown
         | 
| 58 74 | 
             
            - Rakefile
         | 
| 59 75 | 
             
            - VERSION
         | 
| 76 | 
            +
            - example/.gitignore
         | 
| 77 | 
            +
            - example/Rakefile
         | 
| 78 | 
            +
            - example/db/config.yml
         | 
| 79 | 
            +
            - example/db/migrate/20120930053225_create_table_awesome_migration.rb
         | 
| 80 | 
            +
            - lib/standalone_migrations.rb
         | 
| 60 81 | 
             
            - lib/standalone_migrations/configurator.rb
         | 
| 82 | 
            +
            - lib/standalone_migrations/generator.rb
         | 
| 83 | 
            +
            - lib/standalone_migrations/minimal_railtie_config.rb
         | 
| 84 | 
            +
            - lib/standalone_migrations/tasks.rb
         | 
| 85 | 
            +
            - lib/standalone_migrations/tasks/connection.rake
         | 
| 86 | 
            +
            - lib/standalone_migrations/tasks/db/new_migration.rake
         | 
| 87 | 
            +
            - lib/standalone_migrations/tasks/environment.rake
         | 
| 61 88 | 
             
            - lib/tasks/standalone_migrations.rb
         | 
| 62 89 | 
             
            - spec/spec_helper.rb
         | 
| 63 90 | 
             
            - spec/standalone_migrations/configurator_spec.rb
         | 
| @@ -81,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 81 108 | 
             
                  version: '0'
         | 
| 82 109 | 
             
                  segments:
         | 
| 83 110 | 
             
                  - 0
         | 
| 84 | 
            -
                  hash:  | 
| 111 | 
            +
                  hash: -1535312621073270014
         | 
| 85 112 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 86 113 | 
             
              none: false
         | 
| 87 114 | 
             
              requirements:
         |