standalone_migrations 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -56,11 +56,11 @@ Add database configuration to `db/config.yml` in your projects base directory e.
56
56
  #### If you really want to, you can just execute raw SQL:
57
57
 
58
58
  ```ruby
59
- def self.up
59
+ def up
60
60
  execute "insert into foo values (123,'something');"
61
61
  end
62
62
 
63
- def self.down
63
+ def down
64
64
  execute "delete from foo where field='something';"
65
65
  end
66
66
  ```
@@ -99,12 +99,12 @@ named .standalone_migrations in the root of your project containing
99
99
  the following:
100
100
 
101
101
  ```yaml
102
- db:
103
- seeds: db/seeds.rb
104
- migrate: db/migrate
105
- schema: db/schema.rb
106
- config:
107
- database: db/config.yml
102
+ db:
103
+ seeds: db/seeds.rb
104
+ migrate: db/migrate
105
+ schema: db/schema.rb
106
+ config:
107
+ database: db/config.yml
108
108
  ```
109
109
 
110
110
  These are the configurable options available. You can omit any of
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
@@ -1,10 +1,18 @@
1
1
  namespace :db do
2
- task :new_migration do |t|
3
- unless name = ENV['name']
2
+ task :new_migration, :name, :options do |t, args|
3
+ name = args[:name] || ENV['name']
4
+ options = args[:options] || ENV['options']
5
+
6
+ unless name
4
7
  puts "Error: must provide name of migration to generate."
5
8
  puts "For example: rake #{t.name} name=add_field_to_form"
6
9
  abort
7
10
  end
8
- StandaloneMigrations::Generator.migration name
11
+
12
+ if options
13
+ StandaloneMigrations::Generator.migration name, options.gsub('/', ' ')
14
+ else
15
+ StandaloneMigrations::Generator.migration name
16
+ end
9
17
  end
10
18
  end
@@ -112,9 +112,14 @@ test:
112
112
  lambda{ run("rake db:new_migration") }.should raise_error(/name=/)
113
113
  end
114
114
 
115
- it "generates a new migration with this name and timestamp" do
116
- run("rake db:new_migration name=test_abc").should =~ %r{create(.*)db/migrate/\d+_test_abc\.rb}
117
- run("ls db/migrate").should =~ /^\d+_test_abc.rb$/
115
+ it "generates a new migration with this name from ENV and timestamp" do
116
+ run("rake db:new_migration name=test_abc_env").should =~ %r{create(.*)db/migrate/\d+_test_abc_env\.rb}
117
+ run("ls db/migrate").should =~ /^\d+_test_abc_env.rb$/
118
+ end
119
+
120
+ it "generates a new migration with this name from args and timestamp" do
121
+ run("rake db:new_migration[test_abc_args]").should =~ %r{create(.*)db/migrate/\d+_test_abc_args\.rb}
122
+ run("ls db/migrate").should =~ /^\d+_test_abc_args.rb$/
118
123
  end
119
124
 
120
125
  it "generates a new migration with the name converted to the Rails migration format" do
@@ -122,7 +127,16 @@ test:
122
127
  read(migration('my_nice_model')).should =~ /class MyNiceModel/
123
128
  run("ls db/migrate").should =~ /^\d+_my_nice_model.rb$/
124
129
  end
125
-
130
+
131
+ it "generates a new migration with name and options from ENV" do
132
+ run("rake db:new_migration name=add_name_and_email_to_users options='name:string email:string'")
133
+ read(migration('add_name_and_email_to_users')).should =~ /add_column :users, :name, :string\n\s*add_column :users, :email, :string/
134
+ end
135
+
136
+ it "generates a new migration with name and options from args" do
137
+ run("rake db:new_migration[add_website_and_username_to_users,website:string/username:string]")
138
+ read(migration('add_website_and_username_to_users')).should =~ /add_column :users, :website, :string\n\s*add_column :users, :username, :string/
139
+ end
126
140
  end
127
141
 
128
142
  describe 'db:version' do
@@ -261,7 +275,7 @@ test:
261
275
  run('rake db:test:purge')
262
276
  end
263
277
  end
264
-
278
+
265
279
  describe "db:seed" do
266
280
  it "loads" do
267
281
  write("db/seeds.rb", "puts 'LOADEDDD'")
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "standalone_migrations"
8
- s.version = "2.0.0"
8
+ s.version = "2.0.1"
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-10-01"
12
+ s.date = "2012-10-02"
13
13
  s.email = "thuss@gabrito.com"
14
14
  s.extra_rdoc_files = [
15
15
  "README.markdown"
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
45
45
  ]
46
46
  s.homepage = "http://github.com/thuss/standalone-migrations"
47
47
  s.require_paths = ["lib"]
48
- s.rubygems_version = "1.8.24"
48
+ s.rubygems_version = "1.8.11"
49
49
  s.summary = "A thin wrapper to use Rails Migrations in non Rails projects"
50
50
 
51
51
  if s.respond_to? :specification_version then
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: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-01 00:00:00.000000000 Z
13
+ date: 2012-10-02 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
- requirement: !ruby/object:Gem::Requirement
17
+ requirement: &70287492308120 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,15 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ! '>='
29
- - !ruby/object:Gem::Version
30
- version: '0'
25
+ version_requirements: *70287492308120
31
26
  - !ruby/object:Gem::Dependency
32
27
  name: activerecord
33
- requirement: !ruby/object:Gem::Requirement
28
+ requirement: &70287492300920 !ruby/object:Gem::Requirement
34
29
  none: false
35
30
  requirements:
36
31
  - - ~>
@@ -38,15 +33,10 @@ dependencies:
38
33
  version: 3.2.6
39
34
  type: :runtime
40
35
  prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ~>
45
- - !ruby/object:Gem::Version
46
- version: 3.2.6
36
+ version_requirements: *70287492300920
47
37
  - !ruby/object:Gem::Dependency
48
38
  name: railties
49
- requirement: !ruby/object:Gem::Requirement
39
+ requirement: &70287492299360 !ruby/object:Gem::Requirement
50
40
  none: false
51
41
  requirements:
52
42
  - - ~>
@@ -54,12 +44,7 @@ dependencies:
54
44
  version: 3.2.6
55
45
  type: :runtime
56
46
  prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: 3.2.6
47
+ version_requirements: *70287492299360
63
48
  description:
64
49
  email: thuss@gabrito.com
65
50
  executables: []
@@ -108,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
93
  version: '0'
109
94
  segments:
110
95
  - 0
111
- hash: -1535312621073270014
96
+ hash: 1481260314297933148
112
97
  required_rubygems_version: !ruby/object:Gem::Requirement
113
98
  none: false
114
99
  requirements:
@@ -117,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
102
  version: '0'
118
103
  requirements: []
119
104
  rubyforge_project:
120
- rubygems_version: 1.8.24
105
+ rubygems_version: 1.8.11
121
106
  signing_key:
122
107
  specification_version: 3
123
108
  summary: A thin wrapper to use Rails Migrations in non Rails projects