modular_migration 0.0.3 → 0.0.4

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: 1d8a580651c7729d0f976a2cd7fc53443d121bda
4
- data.tar.gz: 80d89150e42955680d6c7c1eb757c9dc225ec712
3
+ metadata.gz: 9ee82a97b2247dd6e5cde40b86ffb0aac2aaf90f
4
+ data.tar.gz: 8a4878a368ad3517f4546989c64a3e815ce21906
5
5
  SHA512:
6
- metadata.gz: 77fbcb863e9ed637a4f2cff044a1c200efeac70c379c650d785ed8b8e2c0a534c6d8f70103134023b87f25cd3795d01984977c3182e53e83f55e825f5ad3cc7c
7
- data.tar.gz: 204336294daaff1f0b4ea8baa3bb958ba5313072d88e4a880978c929103d0aadd8e96738640af5d16a39c5ff440da8efd98082d4fede77e2cc098697f8b9725d
6
+ metadata.gz: 26f02f991699aeb41049128adeaf10b65a81d94f2d9b829b4d4778cc0d4aff2834b5e03d5fb408725aaa82b1c7fd8471f0303a790dd83ba5d1798ac5263fba66
7
+ data.tar.gz: 133e11c231e6e2bc38a65c8258fe03ad3642779a2570aa324803b91de05026a0842711878456cb67707c65ba0f3050d921ed1fc6464ccb73c12fc117ffe7eb90
@@ -5,7 +5,7 @@ module ActiveRecord
5
5
  def create_migration_file
6
6
  set_local_assigns!
7
7
  validate_file_name! if self.respond_to?(:validate_file_name)
8
- if migration_action.match(/(add|remove)/)
8
+ if migration_action && migration_action.match(/(add|remove)/)
9
9
  table = table_name.singularize
10
10
  modular = table.gsub(/_/, '/').camelize.safe_constantize
11
11
  table = table.split('_')
@@ -20,12 +20,12 @@ module ActiveRecord
20
20
  end unless modular
21
21
  migration = modular ? modular.to_s.underscore : []
22
22
  end
23
- migration = join_tables.map(&:singularize).join('_') if migration_action.match(/join/)
24
- migration = FileUtils.mkdir_p(File.join("db", "migrate", migration)) if migration
25
- migration_file = File.join(migration.join('/'), "#{file_name}.rb")
26
- template_file = Rails.version.to_i < 4 ? 'migration.rb' : '../../migration/templates/create_table_migration.rb'
23
+ migration = join_tables.map(&:singularize).join('_') if migration_action && migration_action.match(/join/)
24
+ FileUtils.mkdir_p(File.join("db", "migrate", migration)) if migration
25
+ migration_file = File.join("db", "migrate", migration||"", "#{file_name}.rb")
26
+ template_file = Rails.version.to_i < 4 ? 'migration.rb' : @migration_template
27
27
  migration_template template_file, migration_file
28
- end
28
+ end
29
29
 
30
30
  end
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module ModularMigration
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modular_migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lijia Tong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-06 00:00:00.000000000 Z
11
+ date: 2014-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails