hummingbird 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/.gitignore +16 -0
  2. data/.travis.yml +4 -0
  3. data/CONTRIBUTING.md +7 -0
  4. data/Gemfile +15 -0
  5. data/Guardfile +9 -0
  6. data/LICENSE +20 -0
  7. data/README.md +134 -0
  8. data/Rakefile +10 -0
  9. data/hummingbird.gemspec +31 -0
  10. data/lib/hummingbird/configuration.rb +35 -0
  11. data/lib/hummingbird/database.rb +31 -0
  12. data/lib/hummingbird/plan.rb +75 -0
  13. data/lib/hummingbird/plan_error.rb +11 -0
  14. data/lib/hummingbird/version.rb +3 -0
  15. data/lib/hummingbird.rb +7 -0
  16. data/test/fixtures/basic_config.yml +6 -0
  17. data/test/fixtures/no_basedir_config.yml +3 -0
  18. data/test/fixtures/no_basedir_user_config.yml +3 -0
  19. data/test/fixtures/no_connection_string_config.yml +5 -0
  20. data/test/fixtures/no_migrations_dir_config.yml +3 -0
  21. data/test/fixtures/no_migrations_dir_user_config.yml +3 -0
  22. data/test/fixtures/no_migrations_table_config.yml +4 -0
  23. data/test/fixtures/no_planfile_config.yml +3 -0
  24. data/test/fixtures/no_planfile_user_config.yml +3 -0
  25. data/test/fixtures/plan/basic.plan +4 -0
  26. data/test/fixtures/sql/migrations/basic/file1.sql +1 -0
  27. data/test/fixtures/sql/migrations/basic/file2.sql +1 -0
  28. data/test/fixtures/sql/migrations/basic/file3.sql +1 -0
  29. data/test/fixtures/sql/migrations/basic/file4.sql +1 -0
  30. data/test/fixtures/sql/migrations_table.sql +4 -0
  31. data/test/fixtures/user_config.yml +4 -0
  32. data/test/lib/hummingbird/configuration_test.rb +153 -0
  33. data/test/lib/hummingbird/database_test.rb +100 -0
  34. data/test/lib/hummingbird/plan_test.rb +230 -0
  35. data/test/lib/hummingbird/version_test.rb +7 -0
  36. data/test/test_helper.rb +66 -0
  37. data/test/test_helper_test.rb +41 -0
  38. metadata +237 -0
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ describe Hummingbird do
4
+ it "defines VERSION" do
5
+ Hummingbird::VERSION.wont_be_nil
6
+ end
7
+ end
@@ -0,0 +1,66 @@
1
+ require 'simplecov'
2
+
3
+ SimpleCov.start do
4
+ add_filter '/test'
5
+ end
6
+ SimpleCov.command_name 'test'
7
+
8
+ require 'minitest/autorun'
9
+ require 'minitest/pride'
10
+ require 'hummingbird'
11
+ require 'tempfile'
12
+ require 'set'
13
+
14
+ FIXTURE_DIR = File.expand_path(File.join(File.dirname(__FILE__),'fixtures'))
15
+
16
+ class MiniTest::Unit::TestCase
17
+ def setup
18
+ Thread.current[:minitest_hummingbird_tempfiles] = []
19
+ Thread.current[:minitest_hummingbird_tempdirs] = []
20
+ end
21
+
22
+ def teardown
23
+ Thread.current[:minitest_hummingbird_tempfiles].each(&:unlink)
24
+ Thread.current[:minitest_hummingbird_tempdirs].each {|d| FileUtils.remove_entry_secure(d)}
25
+ end
26
+
27
+ def tempfile
28
+ f = Tempfile.new('minitest_hummingbird')
29
+ Thread.current[:minitest_hummingbird_tempfiles] << f
30
+ f
31
+ end
32
+
33
+ def tempdir
34
+ d = Dir.mktmpdir
35
+ Thread.current[:minitest_hummingbird_tempdirs] << d
36
+ d
37
+ end
38
+
39
+ def path_to_fixture(*name)
40
+ File.join(FIXTURE_DIR, *name)
41
+ end
42
+
43
+ def read_fixture(*name)
44
+ File.read path_to_fixture(*name)
45
+ end
46
+
47
+ def copy_fixture_to(fixture, dest)
48
+ FileUtils.cp(path_to_fixture(fixture), dest)
49
+ end
50
+
51
+ def assert_set_equal(exp, act, msg = nil)
52
+ exp_set = exp.to_set
53
+ act_set = act.to_set
54
+
55
+ msg = message(msg,'') do
56
+ m = <<-EOM
57
+ Expected set equality:
58
+ Expected: #{mu_pp(exp)}
59
+ Actual: #{mu_pp(act)}
60
+ Extra: #{mu_pp((act_set - exp_set).to_a)}
61
+ Missing: #{mu_pp((exp_set - act_set).to_a)}
62
+ EOM
63
+ end
64
+ assert exp_set == act_set, msg
65
+ end
66
+ end
@@ -0,0 +1,41 @@
1
+ require 'test_helper'
2
+
3
+ describe 'test_helper' do
4
+ describe 'assert_set_equal' do
5
+ it 'considers two empty sets equal' do
6
+ assert_set_equal [], []
7
+ end
8
+
9
+ it 'considers two non-empty equal sets equal' do
10
+ assert_set_equal [1,2,3], [1,2,3]
11
+ end
12
+
13
+ it 'considers a set missing members as not equal' do
14
+ e = assert_raises MiniTest::Assertion do
15
+ assert_set_equal [1,2,3], [1,3]
16
+ end
17
+
18
+ assert_equal <<-EOM, e.to_s
19
+ Expected set equality:
20
+ Expected: [1, 2, 3]
21
+ Actual: [1, 3]
22
+ Extra: []
23
+ Missing: [2]
24
+ EOM
25
+ end
26
+
27
+ it 'considers a set with extra members as not equal' do
28
+ e = assert_raises MiniTest::Assertion do
29
+ assert_set_equal [1,2,3], [1,2,3,4]
30
+ end
31
+
32
+ assert_equal <<-EOM, e.to_s
33
+ Expected set equality:
34
+ Expected: [1, 2, 3]
35
+ Actual: [1, 2, 3, 4]
36
+ Extra: [4]
37
+ Missing: []
38
+ EOM
39
+ end
40
+ end
41
+ end
metadata ADDED
@@ -0,0 +1,237 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hummingbird
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jacob Helwig
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sequel
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: optimism
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: minitest
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
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-minitest
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'
110
+ - !ruby/object:Gem::Dependency
111
+ name: simplecov
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: sqlite3
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ description: Write your DB migrations in SQL and run them, hold the magic.
143
+ email:
144
+ - jacob@technosorcery.net
145
+ executables: []
146
+ extensions: []
147
+ extra_rdoc_files: []
148
+ files:
149
+ - .gitignore
150
+ - .travis.yml
151
+ - CONTRIBUTING.md
152
+ - Gemfile
153
+ - Guardfile
154
+ - LICENSE
155
+ - README.md
156
+ - Rakefile
157
+ - hummingbird.gemspec
158
+ - lib/hummingbird.rb
159
+ - lib/hummingbird/configuration.rb
160
+ - lib/hummingbird/database.rb
161
+ - lib/hummingbird/plan.rb
162
+ - lib/hummingbird/plan_error.rb
163
+ - lib/hummingbird/version.rb
164
+ - test/fixtures/basic_config.yml
165
+ - test/fixtures/no_basedir_config.yml
166
+ - test/fixtures/no_basedir_user_config.yml
167
+ - test/fixtures/no_connection_string_config.yml
168
+ - test/fixtures/no_migrations_dir_config.yml
169
+ - test/fixtures/no_migrations_dir_user_config.yml
170
+ - test/fixtures/no_migrations_table_config.yml
171
+ - test/fixtures/no_planfile_config.yml
172
+ - test/fixtures/no_planfile_user_config.yml
173
+ - test/fixtures/plan/basic.plan
174
+ - test/fixtures/sql/migrations/basic/file1.sql
175
+ - test/fixtures/sql/migrations/basic/file2.sql
176
+ - test/fixtures/sql/migrations/basic/file3.sql
177
+ - test/fixtures/sql/migrations/basic/file4.sql
178
+ - test/fixtures/sql/migrations_table.sql
179
+ - test/fixtures/user_config.yml
180
+ - test/lib/hummingbird/configuration_test.rb
181
+ - test/lib/hummingbird/database_test.rb
182
+ - test/lib/hummingbird/plan_test.rb
183
+ - test/lib/hummingbird/version_test.rb
184
+ - test/test_helper.rb
185
+ - test/test_helper_test.rb
186
+ homepage: http://github.com/jhelwig/hummingbird
187
+ licenses:
188
+ - MIT
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ! '>='
197
+ - !ruby/object:Gem::Version
198
+ version: 1.8.7
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
+ none: false
201
+ requirements:
202
+ - - ! '>='
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ segments:
206
+ - 0
207
+ hash: -1062239906783200272
208
+ requirements: []
209
+ rubyforge_project:
210
+ rubygems_version: 1.8.24
211
+ signing_key:
212
+ specification_version: 3
213
+ summary: No DSL, as little magic as possible. Write your DB migrations in SQL, and
214
+ run them in the order specified by a plan file.
215
+ test_files:
216
+ - test/fixtures/basic_config.yml
217
+ - test/fixtures/no_basedir_config.yml
218
+ - test/fixtures/no_basedir_user_config.yml
219
+ - test/fixtures/no_connection_string_config.yml
220
+ - test/fixtures/no_migrations_dir_config.yml
221
+ - test/fixtures/no_migrations_dir_user_config.yml
222
+ - test/fixtures/no_migrations_table_config.yml
223
+ - test/fixtures/no_planfile_config.yml
224
+ - test/fixtures/no_planfile_user_config.yml
225
+ - test/fixtures/plan/basic.plan
226
+ - test/fixtures/sql/migrations/basic/file1.sql
227
+ - test/fixtures/sql/migrations/basic/file2.sql
228
+ - test/fixtures/sql/migrations/basic/file3.sql
229
+ - test/fixtures/sql/migrations/basic/file4.sql
230
+ - test/fixtures/sql/migrations_table.sql
231
+ - test/fixtures/user_config.yml
232
+ - test/lib/hummingbird/configuration_test.rb
233
+ - test/lib/hummingbird/database_test.rb
234
+ - test/lib/hummingbird/plan_test.rb
235
+ - test/lib/hummingbird/version_test.rb
236
+ - test/test_helper.rb
237
+ - test/test_helper_test.rb