plugin_migrator 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/lib/plugin_migrator/migrations_helper.rb +12 -6
- data/lib/plugin_migrator/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9490d948515c0313e17cd43db9c1b6e23f515113
         | 
| 4 | 
            +
              data.tar.gz: aef92e26d403f7e2fcbaa7ff6e8a1e3a77844fd8
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2275b9703397d6168f991bfdd20533cd558362f499722c4dacb6a292315bf683dc30f913ed19f824a655155fc439609ca23c24853e17a51591b1ee272c5990b9
         | 
| 7 | 
            +
              data.tar.gz: 721edd7ee2be56403c31c6b8c14cabd928b8c22915bb5de4a24b229622ad49fb63a931bf2fdd7b7fba48d968fee8d17d9517379cc9c90cbd4c6ae1bc106e17d1
         | 
| @@ -1,29 +1,35 @@ | |
| 1 1 | 
             
            class PluginMigrator::MigrationsHelper
         | 
| 2 2 | 
             
              def migrations
         | 
| 3 3 | 
             
                version_helper = ::PluginMigrator::VersionHelper.new
         | 
| 4 | 
            -
             | 
| 4 | 
            +
             | 
| 5 5 | 
             
                Gem.loaded_specs.values.each do |gem_i|
         | 
| 6 6 | 
             
                  gem_path = gem_i.gem_dir
         | 
| 7 7 | 
             
                  plugin_migrator_path = "#{gem_path}/db/plugin_migrate"
         | 
| 8 8 | 
             
                  next unless File.exists?(plugin_migrator_path)
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                   | 
| 9 | 
            +
             | 
| 10 | 
            +
                  migrations_for_path(plugin_migrator_path).each do |file|
         | 
| 11 11 | 
             
                    match = file.match(/^(\d+)_(.+)\.rb$/)
         | 
| 12 12 | 
             
                    next unless match
         | 
| 13 | 
            -
             | 
| 13 | 
            +
             | 
| 14 14 | 
             
                    migration_path = "#{plugin_migrator_path}/#{file}"
         | 
| 15 15 | 
             
                    migration_class_name = StringCases.snake_to_camel(match[2])
         | 
| 16 16 | 
             
                    migration_version = match[1].to_i
         | 
| 17 | 
            -
             | 
| 17 | 
            +
             | 
| 18 18 | 
             
                    migration = ::PluginMigrator::Migration.new(
         | 
| 19 19 | 
             
                      :path => migration_path,
         | 
| 20 20 | 
             
                      :version => migration_version,
         | 
| 21 21 | 
             
                      :class_name => migration_class_name,
         | 
| 22 22 | 
             
                      :version_helper => version_helper
         | 
| 23 23 | 
             
                    )
         | 
| 24 | 
            -
             | 
| 24 | 
            +
             | 
| 25 25 | 
             
                    yield migration
         | 
| 26 26 | 
             
                  end
         | 
| 27 27 | 
             
                end
         | 
| 28 28 | 
             
              end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              def migrations_for_path(path)
         | 
| 31 | 
            +
                Dir.new(path).to_a.sort { |dir1, dir2| dir1 <=> dir2 }.select do |file|
         | 
| 32 | 
            +
                  File.extname(file) == '.rb'
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
              end
         | 
| 29 35 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: plugin_migrator
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Kasper Johansen
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-05-08 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| @@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 100 100 | 
             
                  version: '0'
         | 
| 101 101 | 
             
            requirements: []
         | 
| 102 102 | 
             
            rubyforge_project: 
         | 
| 103 | 
            -
            rubygems_version: 2. | 
| 103 | 
            +
            rubygems_version: 2.2.2
         | 
| 104 104 | 
             
            signing_key: 
         | 
| 105 105 | 
             
            specification_version: 4
         | 
| 106 106 | 
             
            summary: Migrate plugin DB easily.
         |