plugin_migrator 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 069b81fa2280bbbe47c1861252e8d63f494cc783
4
- data.tar.gz: 7df7e19ee60db363a49d4e2dbd5788738b56a749
3
+ metadata.gz: 9490d948515c0313e17cd43db9c1b6e23f515113
4
+ data.tar.gz: aef92e26d403f7e2fcbaa7ff6e8a1e3a77844fd8
5
5
  SHA512:
6
- metadata.gz: e8b51cb61a7b0d8c224a6ce259fc7f258e89ea1f6948d1572e3ee8610c31a14b8bbbd265fb4884c99184ef55cbab4665c629dd8a639e8abbe5fb773cb80ae159
7
- data.tar.gz: 53050cab29a230dbbf0e804da60ef2d4ac2b31aaf43e9d0f611306ab2de474e08f50622957496e93c822a18c917d42d7d8e40aa57862bd6e8c2220755f5b383c
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
- Dir.foreach(plugin_migrator_path) do |file|
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
@@ -1,3 +1,3 @@
1
1
  module PluginMigrator
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  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.2
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: 2014-11-06 00:00:00.000000000 Z
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.4.0
103
+ rubygems_version: 2.2.2
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Migrate plugin DB easily.