dbmanager 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/CHANGELOG.md +8 -0
  2. data/Guardfile +25 -0
  3. data/README.md +34 -19
  4. data/Rakefile +1 -1
  5. data/dbmanager.gemspec +4 -1
  6. data/features/dump.feature +17 -0
  7. data/features/rake_tasks.feature +20 -0
  8. data/features/readme.md +121 -0
  9. data/features/step_definitions/dump_steps.rb +14 -0
  10. data/features/step_definitions/rake_tasks_steps.rb +18 -0
  11. data/features/support/dummy_app_initialization.rb +21 -0
  12. data/features/support/env.rb +0 -0
  13. data/lib/dbmanager.rb +13 -10
  14. data/lib/dbmanager/adapters.rb +6 -0
  15. data/lib/dbmanager/adapters/mysql.rb +10 -0
  16. data/lib/dbmanager/version.rb +1 -1
  17. data/lib/tasks/dbmanager.rake +2 -0
  18. data/rails_generators/dbmanager/dbmanager_generator.rb +1 -5
  19. data/spec/dummy/.gitignore +21 -0
  20. data/spec/dummy/Gemfile +12 -0
  21. data/spec/dummy/README.rdoc +261 -0
  22. data/spec/dummy/Rakefile +7 -0
  23. data/spec/dummy/app/assets/images/rails.png +0 -0
  24. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  25. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  26. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  27. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  28. data/spec/dummy/app/mailers/.gitkeep +0 -0
  29. data/spec/dummy/app/models/.gitkeep +0 -0
  30. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  31. data/spec/dummy/config.ru +4 -0
  32. data/spec/dummy/config/application.rb +62 -0
  33. data/spec/dummy/config/boot.rb +6 -0
  34. data/spec/dummy/config/database.yml +11 -0
  35. data/spec/dummy/config/environment.rb +5 -0
  36. data/spec/dummy/config/environments/development.rb +37 -0
  37. data/spec/dummy/config/environments/production.rb +67 -0
  38. data/spec/dummy/config/environments/test.rb +37 -0
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/dummy/config/initializers/inflections.rb +15 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  43. data/spec/dummy/config/initializers/session_store.rb +8 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +5 -0
  46. data/spec/dummy/config/routes.rb +58 -0
  47. data/spec/dummy/db/schema.rb +16 -0
  48. data/spec/dummy/db/seeds.rb +7 -0
  49. data/spec/dummy/doc/README_FOR_APP +2 -0
  50. data/spec/dummy/lib/assets/.gitkeep +0 -0
  51. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  52. data/spec/dummy/log/.gitkeep +0 -0
  53. data/spec/dummy/public/404.html +26 -0
  54. data/spec/dummy/public/422.html +26 -0
  55. data/spec/dummy/public/500.html +25 -0
  56. data/spec/dummy/public/favicon.ico +0 -0
  57. data/spec/dummy/public/index.html +241 -0
  58. data/spec/dummy/public/robots.txt +5 -0
  59. data/spec/dummy/script/rails +6 -0
  60. data/spec/dummy/test/fixtures/.gitkeep +0 -0
  61. data/spec/dummy/test/functional/.gitkeep +0 -0
  62. data/spec/dummy/test/integration/.gitkeep +0 -0
  63. data/spec/dummy/test/performance/browsing_test.rb +12 -0
  64. data/spec/dummy/test/test_helper.rb +13 -0
  65. data/spec/dummy/test/unit/.gitkeep +0 -0
  66. data/spec/dummy/vendor/assets/javascripts/.gitkeep +0 -0
  67. data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  68. data/spec/dummy/vendor/plugins/.gitkeep +0 -0
  69. data/spec/fixtures/{config → rails/config}/database.yml +0 -0
  70. data/spec/fixtures/{config → rails/config}/dbmanager_override.yml +0 -0
  71. data/spec/lib/adapters/mysql_spec.rb +25 -6
  72. data/spec/lib/importable_spec.rb +1 -1
  73. data/spec/lib/yml_parser_spec.rb +1 -1
  74. data/spec/spec_helper.rb +1 -1
  75. metadata +177 -8
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
File without changes
File without changes
File without changes
@@ -0,0 +1,12 @@
1
+ require 'test_helper'
2
+ require 'rails/performance_test_help'
3
+
4
+ class BrowsingTest < ActionDispatch::PerformanceTest
5
+ # Refer to the documentation for all available options
6
+ # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
7
+ # :output => 'tmp/performance', :formats => [:flat] }
8
+
9
+ def test_homepage
10
+ get '/'
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
+ #
8
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
+ # -- they do not yet inherit this setting
10
+ fixtures :all
11
+
12
+ # Add more helper methods to be used by all tests here...
13
+ end
File without changes
File without changes
@@ -48,12 +48,12 @@ module Dbmanager
48
48
  describe Importer do
49
49
  describe 'an importer instance' do
50
50
  before { Time.stub! :now => Time.parse('2012/03/23 12:30:32') }
51
- let(:target) { Environment.new :protected => false, :name => 'beta', :username => 'beta_user' }
52
51
  let(:source) { Environment.new :protected => false, :name => 'development', :username => 'root' }
52
+ let(:target) { Environment.new :protected => false, :name => 'beta', :username => 'beta_user' }
53
53
  let(:tmp_file) { '/some/arbitrary/path' }
54
54
  subject { Importer.new source, target, tmp_file }
55
55
 
56
- it 'has target and source attribute methods' do
56
+ it 'has target, source and tmp_file attribute methods' do
57
57
  %w[source target tmp_file].each { |m| subject.should respond_to m }
58
58
  end
59
59
 
@@ -63,23 +63,42 @@ module Dbmanager
63
63
  end
64
64
  end
65
65
 
66
+ describe '#create_db_if_missing_command' do
67
+ it 'returns expected command' do
68
+ subject.create_db_if_missing_command.should == 'bundle exec rake db:create RAILS_ENV=beta'
69
+ end
70
+ end
71
+
66
72
  describe '#remove_tmp_file' do
67
73
  it 'tries to remove the temporary file' do
68
- Dbmanager.should_receive(:execute).with("rm #{subject.tmp_file}")
74
+ Dbmanager.should_receive(:execute).with('rm /some/arbitrary/path')
69
75
  subject.remove_tmp_file
70
76
  end
71
77
  end
72
78
 
79
+ describe '#bundle' do
80
+ it 'returns "bundle exec" when bundler is present' do
81
+ Dbmanager.should_receive(:execute).and_return true
82
+ subject.bundle.should == 'bundle exec'
83
+ end
84
+
85
+ it 'returns nil when bundler is missing' do
86
+ Dbmanager.should_receive(:execute).and_return false
87
+ subject.bundle.should be_nil
88
+ end
89
+ end
90
+
73
91
  describe '#run' do
74
- it 'dumps the db' do
92
+ it 'create ad Dumper that will dump the db' do
75
93
  Dbmanager.stub!(:execute! => nil)
76
94
  Dumper.should_receive(:new).and_return(mock.as_null_object)
77
95
  subject.run
78
96
  end
79
97
 
80
- it 'imports the db' do
81
- Dumper.stub! :new => mock.as_null_object
98
+ it 'creates the db if missing and then imports the db' do
99
+ Dumper.stub!(:new => mock.as_null_object)
82
100
  subject.stub!(:remove_tmp_file => true)
101
+ Dbmanager.should_receive(:execute!).with(subject.create_db_if_missing_command)
83
102
  Dbmanager.should_receive(:execute!).with(subject.import_command)
84
103
  subject.run
85
104
  end
@@ -72,7 +72,7 @@ module Dbmanager
72
72
  describe '#tmp_file' do
73
73
  it 'includes expected path' do
74
74
  Time.stub :now => Time.parse('1974/09/20 14:12:33')
75
- subject.tmp_file.should =~ Regexp.new('dbmanager/spec/fixtures/tmp/740920141233')
75
+ subject.tmp_file.should =~ Regexp.new('dbmanager/spec/fixtures/rails/tmp/740920141233')
76
76
  end
77
77
  end
78
78
  end
@@ -39,7 +39,7 @@ module Dbmanager
39
39
  end
40
40
 
41
41
  context 'when there is a dbmanager_override file' do
42
- context 'whe the file is empty' do
42
+ context 'when the file is empty' do
43
43
  it 'doesnt raise any error' do
44
44
  YAML.stub!(:load => nil)
45
45
  expect { YmlParser.config }.to_not raise_error
@@ -11,5 +11,5 @@ def fixture_path
11
11
  end
12
12
 
13
13
  def stub_rails_root
14
- Dbmanager.stub! :rails_root => fixture_path
14
+ Dbmanager.stub! :rails_root => "#{fixture_path}/rails"
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbmanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-17 00:00:00.000000000 Z
12
+ date: 2012-10-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -59,6 +59,54 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: cucumber
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: guard-rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: guard-cucumber
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
62
110
  description: helps manage db dumps and imports via rake tasks
63
111
  email:
64
112
  - andrea.longhi@mikamai.com
@@ -69,11 +117,20 @@ files:
69
117
  - .gitignore
70
118
  - CHANGELOG.md
71
119
  - Gemfile
120
+ - Guardfile
72
121
  - LICENSE
73
122
  - README.md
74
123
  - Rakefile
75
124
  - dbmanager.gemspec
125
+ - features/dump.feature
126
+ - features/rake_tasks.feature
127
+ - features/readme.md
128
+ - features/step_definitions/dump_steps.rb
129
+ - features/step_definitions/rake_tasks_steps.rb
130
+ - features/support/dummy_app_initialization.rb
131
+ - features/support/env.rb
76
132
  - lib/dbmanager.rb
133
+ - lib/dbmanager/adapters.rb
77
134
  - lib/dbmanager/adapters/mysql.rb
78
135
  - lib/dbmanager/adapters/mysql2.rb
79
136
  - lib/dbmanager/dumpable.rb
@@ -85,9 +142,59 @@ files:
85
142
  - lib/tasks/dbmanager.rake
86
143
  - rails_generators/dbmanager/USAGE
87
144
  - rails_generators/dbmanager/dbmanager_generator.rb
145
+ - spec/dummy/.gitignore
146
+ - spec/dummy/Gemfile
147
+ - spec/dummy/README.rdoc
148
+ - spec/dummy/Rakefile
149
+ - spec/dummy/app/assets/images/rails.png
150
+ - spec/dummy/app/assets/javascripts/application.js
151
+ - spec/dummy/app/assets/stylesheets/application.css
152
+ - spec/dummy/app/controllers/application_controller.rb
153
+ - spec/dummy/app/helpers/application_helper.rb
154
+ - spec/dummy/app/mailers/.gitkeep
155
+ - spec/dummy/app/models/.gitkeep
156
+ - spec/dummy/app/views/layouts/application.html.erb
157
+ - spec/dummy/config.ru
158
+ - spec/dummy/config/application.rb
159
+ - spec/dummy/config/boot.rb
160
+ - spec/dummy/config/database.yml
161
+ - spec/dummy/config/environment.rb
162
+ - spec/dummy/config/environments/development.rb
163
+ - spec/dummy/config/environments/production.rb
164
+ - spec/dummy/config/environments/test.rb
165
+ - spec/dummy/config/initializers/backtrace_silencers.rb
166
+ - spec/dummy/config/initializers/inflections.rb
167
+ - spec/dummy/config/initializers/mime_types.rb
168
+ - spec/dummy/config/initializers/secret_token.rb
169
+ - spec/dummy/config/initializers/session_store.rb
170
+ - spec/dummy/config/initializers/wrap_parameters.rb
171
+ - spec/dummy/config/locales/en.yml
172
+ - spec/dummy/config/routes.rb
173
+ - spec/dummy/db/schema.rb
174
+ - spec/dummy/db/seeds.rb
175
+ - spec/dummy/doc/README_FOR_APP
176
+ - spec/dummy/lib/assets/.gitkeep
177
+ - spec/dummy/lib/tasks/.gitkeep
178
+ - spec/dummy/log/.gitkeep
179
+ - spec/dummy/public/404.html
180
+ - spec/dummy/public/422.html
181
+ - spec/dummy/public/500.html
182
+ - spec/dummy/public/favicon.ico
183
+ - spec/dummy/public/index.html
184
+ - spec/dummy/public/robots.txt
185
+ - spec/dummy/script/rails
186
+ - spec/dummy/test/fixtures/.gitkeep
187
+ - spec/dummy/test/functional/.gitkeep
188
+ - spec/dummy/test/integration/.gitkeep
189
+ - spec/dummy/test/performance/browsing_test.rb
190
+ - spec/dummy/test/test_helper.rb
191
+ - spec/dummy/test/unit/.gitkeep
192
+ - spec/dummy/vendor/assets/javascripts/.gitkeep
193
+ - spec/dummy/vendor/assets/stylesheets/.gitkeep
194
+ - spec/dummy/vendor/plugins/.gitkeep
88
195
  - spec/fixtures/adapter_sample.rb
89
- - spec/fixtures/config/database.yml
90
- - spec/fixtures/config/dbmanager_override.yml
196
+ - spec/fixtures/rails/config/database.yml
197
+ - spec/fixtures/rails/config/dbmanager_override.yml
91
198
  - spec/lib/adapters/mysql_spec.rb
92
199
  - spec/lib/dbmanager_spec.rb
93
200
  - spec/lib/dumpable_spec.rb
@@ -97,7 +204,7 @@ files:
97
204
  - spec/lib/yml_parser_spec.rb
98
205
  - spec/spec_helper.rb
99
206
  - spec/support/std_stub.rb
100
- homepage: ''
207
+ homepage: https://github.com/spaghetticode/dbmanager
101
208
  licenses: []
102
209
  post_install_message:
103
210
  rdoc_options: []
@@ -109,12 +216,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
216
  - - ! '>='
110
217
  - !ruby/object:Gem::Version
111
218
  version: '0'
219
+ segments:
220
+ - 0
221
+ hash: 200730802332040638
112
222
  required_rubygems_version: !ruby/object:Gem::Requirement
113
223
  none: false
114
224
  requirements:
115
225
  - - ! '>='
116
226
  - !ruby/object:Gem::Version
117
227
  version: '0'
228
+ segments:
229
+ - 0
230
+ hash: 200730802332040638
118
231
  requirements: []
119
232
  rubyforge_project: dbmanager
120
233
  rubygems_version: 1.8.24
@@ -122,9 +235,66 @@ signing_key:
122
235
  specification_version: 3
123
236
  summary: database manager
124
237
  test_files:
238
+ - features/dump.feature
239
+ - features/rake_tasks.feature
240
+ - features/readme.md
241
+ - features/step_definitions/dump_steps.rb
242
+ - features/step_definitions/rake_tasks_steps.rb
243
+ - features/support/dummy_app_initialization.rb
244
+ - features/support/env.rb
245
+ - spec/dummy/.gitignore
246
+ - spec/dummy/Gemfile
247
+ - spec/dummy/README.rdoc
248
+ - spec/dummy/Rakefile
249
+ - spec/dummy/app/assets/images/rails.png
250
+ - spec/dummy/app/assets/javascripts/application.js
251
+ - spec/dummy/app/assets/stylesheets/application.css
252
+ - spec/dummy/app/controllers/application_controller.rb
253
+ - spec/dummy/app/helpers/application_helper.rb
254
+ - spec/dummy/app/mailers/.gitkeep
255
+ - spec/dummy/app/models/.gitkeep
256
+ - spec/dummy/app/views/layouts/application.html.erb
257
+ - spec/dummy/config.ru
258
+ - spec/dummy/config/application.rb
259
+ - spec/dummy/config/boot.rb
260
+ - spec/dummy/config/database.yml
261
+ - spec/dummy/config/environment.rb
262
+ - spec/dummy/config/environments/development.rb
263
+ - spec/dummy/config/environments/production.rb
264
+ - spec/dummy/config/environments/test.rb
265
+ - spec/dummy/config/initializers/backtrace_silencers.rb
266
+ - spec/dummy/config/initializers/inflections.rb
267
+ - spec/dummy/config/initializers/mime_types.rb
268
+ - spec/dummy/config/initializers/secret_token.rb
269
+ - spec/dummy/config/initializers/session_store.rb
270
+ - spec/dummy/config/initializers/wrap_parameters.rb
271
+ - spec/dummy/config/locales/en.yml
272
+ - spec/dummy/config/routes.rb
273
+ - spec/dummy/db/schema.rb
274
+ - spec/dummy/db/seeds.rb
275
+ - spec/dummy/doc/README_FOR_APP
276
+ - spec/dummy/lib/assets/.gitkeep
277
+ - spec/dummy/lib/tasks/.gitkeep
278
+ - spec/dummy/log/.gitkeep
279
+ - spec/dummy/public/404.html
280
+ - spec/dummy/public/422.html
281
+ - spec/dummy/public/500.html
282
+ - spec/dummy/public/favicon.ico
283
+ - spec/dummy/public/index.html
284
+ - spec/dummy/public/robots.txt
285
+ - spec/dummy/script/rails
286
+ - spec/dummy/test/fixtures/.gitkeep
287
+ - spec/dummy/test/functional/.gitkeep
288
+ - spec/dummy/test/integration/.gitkeep
289
+ - spec/dummy/test/performance/browsing_test.rb
290
+ - spec/dummy/test/test_helper.rb
291
+ - spec/dummy/test/unit/.gitkeep
292
+ - spec/dummy/vendor/assets/javascripts/.gitkeep
293
+ - spec/dummy/vendor/assets/stylesheets/.gitkeep
294
+ - spec/dummy/vendor/plugins/.gitkeep
125
295
  - spec/fixtures/adapter_sample.rb
126
- - spec/fixtures/config/database.yml
127
- - spec/fixtures/config/dbmanager_override.yml
296
+ - spec/fixtures/rails/config/database.yml
297
+ - spec/fixtures/rails/config/dbmanager_override.yml
128
298
  - spec/lib/adapters/mysql_spec.rb
129
299
  - spec/lib/dbmanager_spec.rb
130
300
  - spec/lib/dumpable_spec.rb
@@ -134,4 +304,3 @@ test_files:
134
304
  - spec/lib/yml_parser_spec.rb
135
305
  - spec/spec_helper.rb
136
306
  - spec/support/std_stub.rb
137
- has_rdoc: