lazy_migrate 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yaml +43 -0
  3. data/.gitignore +4 -0
  4. data/.travis.yml +6 -0
  5. data/Appraisals +14 -0
  6. data/Gemfile.lock +150 -5
  7. data/Guardfile +39 -0
  8. data/README.md +56 -6
  9. data/Rakefile +1 -3
  10. data/bin/exe/lazy_migrate +14 -1
  11. data/gemfiles/.bundle/config +2 -0
  12. data/gemfiles/rails_5_1_5.gemfile +8 -0
  13. data/gemfiles/rails_5_1_5.gemfile.lock +170 -0
  14. data/gemfiles/rails_5_2_4_3.gemfile +8 -0
  15. data/gemfiles/rails_5_2_4_3.gemfile.lock +178 -0
  16. data/gemfiles/rails_6_0_3_4.gemfile +8 -0
  17. data/gemfiles/rails_6_0_3_4.gemfile.lock +194 -0
  18. data/github/demo.gif +0 -0
  19. data/lazy_migrate.gemspec +8 -2
  20. data/lib/lazy_migrate.rb +6 -2
  21. data/lib/lazy_migrate/client.rb +123 -0
  22. data/lib/lazy_migrate/migration.rb +14 -0
  23. data/lib/lazy_migrate/migrator_adapter.rb +144 -0
  24. data/lib/lazy_migrate/migrator_adapter_factory.rb +24 -0
  25. data/lib/lazy_migrate/new_migrator_adapter.rb +90 -0
  26. data/lib/lazy_migrate/old_migrator_adapter.rb +97 -0
  27. data/lib/lazy_migrate/version.rb +2 -1
  28. data/lib/tasks/lazy_migrate.rake +10 -0
  29. data/sorbet/config +2 -0
  30. data/sorbet/rbi/gems/actioncable.rbi +393 -0
  31. data/sorbet/rbi/gems/actionmailer.rbi +425 -0
  32. data/sorbet/rbi/gems/actionpack.rbi +3230 -0
  33. data/sorbet/rbi/gems/actionview.rbi +1153 -0
  34. data/sorbet/rbi/gems/activejob.rbi +282 -0
  35. data/sorbet/rbi/gems/activemodel.rbi +742 -0
  36. data/sorbet/rbi/gems/activerecord.rbi +4004 -0
  37. data/sorbet/rbi/gems/activestorage.rbi +174 -0
  38. data/sorbet/rbi/gems/activesupport.rbi +2300 -0
  39. data/sorbet/rbi/gems/appraisal.rbi +151 -0
  40. data/sorbet/rbi/gems/arel.rbi +1253 -0
  41. data/sorbet/rbi/gems/byebug.rbi +1041 -0
  42. data/sorbet/rbi/gems/coderay.rbi +92 -0
  43. data/sorbet/rbi/gems/concurrent-ruby.rbi +1586 -0
  44. data/sorbet/rbi/gems/crass.rbi +93 -0
  45. data/sorbet/rbi/gems/erubi.rbi +27 -0
  46. data/sorbet/rbi/gems/globalid.rbi +99 -0
  47. data/sorbet/rbi/gems/i18n.rbi +192 -0
  48. data/sorbet/rbi/gems/loofah.rbi +131 -0
  49. data/sorbet/rbi/gems/mail.rbi +1092 -0
  50. data/sorbet/rbi/gems/marcel.rbi +13 -0
  51. data/sorbet/rbi/gems/method_source.rbi +64 -0
  52. data/sorbet/rbi/gems/mini_mime.rbi +52 -0
  53. data/sorbet/rbi/gems/minitest.rbi +282 -0
  54. data/sorbet/rbi/gems/nio4r.rbi +68 -0
  55. data/sorbet/rbi/gems/nokogiri.rbi +1011 -0
  56. data/sorbet/rbi/gems/pastel.rbi +119 -0
  57. data/sorbet/rbi/gems/pry-byebug.rbi +155 -0
  58. data/sorbet/rbi/gems/pry.rbi +1949 -0
  59. data/sorbet/rbi/gems/rack-test.rbi +162 -0
  60. data/sorbet/rbi/gems/rack.rbi +525 -0
  61. data/sorbet/rbi/gems/rails-dom-testing.rbi +68 -0
  62. data/sorbet/rbi/gems/rails-html-sanitizer.rbi +92 -0
  63. data/sorbet/rbi/gems/railties.rbi +724 -0
  64. data/sorbet/rbi/gems/rake.rbi +666 -0
  65. data/sorbet/rbi/gems/rspec-core.rbi +1939 -0
  66. data/sorbet/rbi/gems/rspec-expectations.rbi +1123 -0
  67. data/sorbet/rbi/gems/rspec-mocks.rbi +1090 -0
  68. data/sorbet/rbi/gems/rspec-support.rbi +280 -0
  69. data/sorbet/rbi/gems/rspec.rbi +15 -0
  70. data/sorbet/rbi/gems/sprockets-rails.rbi +106 -0
  71. data/sorbet/rbi/gems/sprockets.rbi +755 -0
  72. data/sorbet/rbi/gems/sqlite3.rbi +354 -0
  73. data/sorbet/rbi/gems/thor.rbi +580 -0
  74. data/sorbet/rbi/gems/thread_safe.rbi +82 -0
  75. data/sorbet/rbi/gems/tty-color.rbi +44 -0
  76. data/sorbet/rbi/gems/tty-cursor.rbi +72 -0
  77. data/sorbet/rbi/gems/tty-prompt.rbi +531 -0
  78. data/sorbet/rbi/gems/tty-reader.rbi +176 -0
  79. data/sorbet/rbi/gems/tty-screen.rbi +66 -0
  80. data/sorbet/rbi/gems/tzinfo.rbi +406 -0
  81. data/sorbet/rbi/gems/websocket-driver.rbi +103 -0
  82. data/sorbet/rbi/gems/websocket-extensions.rbi +29 -0
  83. data/sorbet/rbi/gems/wisper.rbi +130 -0
  84. data/sorbet/rbi/hidden-definitions/errors.txt +7584 -0
  85. data/sorbet/rbi/hidden-definitions/hidden.rbi +13328 -0
  86. data/sorbet/rbi/sorbet-typed/lib/actionmailer/all/actionmailer.rbi +13 -0
  87. data/sorbet/rbi/sorbet-typed/lib/actionpack/all/actionpack.rbi +954 -0
  88. data/sorbet/rbi/sorbet-typed/lib/actionview/all/actionview.rbi +321 -0
  89. data/sorbet/rbi/sorbet-typed/lib/activemodel/all/activemodel.rbi +597 -0
  90. data/sorbet/rbi/sorbet-typed/lib/activerecord/<6/activerecord.rbi +13 -0
  91. data/sorbet/rbi/sorbet-typed/lib/activerecord/>=5.2/activerecord.rbi +16 -0
  92. data/sorbet/rbi/sorbet-typed/lib/activerecord/>=5/activerecord.rbi +53 -0
  93. data/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1454 -0
  94. data/sorbet/rbi/sorbet-typed/lib/activerecord/all/model_schema.rbi +79 -0
  95. data/sorbet/rbi/sorbet-typed/lib/activerecord/all/sanitization.rbi +36 -0
  96. data/sorbet/rbi/sorbet-typed/lib/activerecord/~>5.2.0/activerecord.rbi +447 -0
  97. data/sorbet/rbi/sorbet-typed/lib/activestorage/<=6.1/activestorage.rbi +82 -0
  98. data/sorbet/rbi/sorbet-typed/lib/activestorage/all/activestorage.rbi +177 -0
  99. data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +1431 -0
  100. data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +108 -0
  101. data/sorbet/rbi/sorbet-typed/lib/railties/all/railties.rbi +25 -0
  102. data/sorbet/rbi/todo.rbi +18 -0
  103. data/sorbet/rbi/user-defined/activerecord.rbi +56 -0
  104. metadata +182 -5
  105. data/lib/lazy_migrate/migrator.rb +0 -186
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c8943bd20a1ff8614e454704cb77a26e6881f47ebf1512ee8dac7614bcf4848
4
- data.tar.gz: 89a6dbb10ed7892906eb7e050f1e4ce4e957f168755afbe6f9472d4a572914d3
3
+ metadata.gz: 293e945f4a1763bcaba3ce55f09f43929f94288ec783582e46b3bcc2c8fac332
4
+ data.tar.gz: 6e8ab04284d88d631efc26fc4f81cb6d356bdba5568af5822c49c54a54bddef1
5
5
  SHA512:
6
- metadata.gz: 4c514da19fff93f8c2f8ec58dc23ebb0bc4f9de238119e7f032096a1b04f0fed2d92b9af8fa4e60d818261a6c2aadf18d236ba62d16ab7b70b26de8b826b0841
7
- data.tar.gz: b5e3935e9df4aeb226a30b53c19f77d89134bb05e3cbbb74c4a1aa684e67ee8664e7aae2f674f2676ae33e24337909daaf2f6e77946271c94b1a6b34d75a6122
6
+ metadata.gz: 27e9a879d1efeff1b3dfd319a90305290d2ca31dd8281878d7b94de03aaf6c9c3bb0c91c8d2b7c53c4d79a243ddbb742e4c22302bf30438ec3b67662b4df9822
7
+ data.tar.gz: 47c89687f8f6cb0649b878abfd3bbd0fa79dd82e9454f1973f0084c51dd664d3e6b156145cafd5fcf32f818619cfdc415f0d5cd0b04af7216e9be7bd76567cd0
@@ -0,0 +1,43 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+ paths-ignore:
8
+ - 'README.md'
9
+ push:
10
+ branches:
11
+ - master
12
+ paths-ignore:
13
+ - 'README.md'
14
+
15
+ jobs:
16
+ unit_tests:
17
+ name: Unit Tests
18
+ if: "contains(github.event.commits[0].message, '[ci skip]') == false"
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ os:
23
+ - ubuntu
24
+ ruby:
25
+ - 2.6
26
+ gemfile:
27
+ - gemfiles/rails_5_1_5.gemfile
28
+ - gemfiles/rails_5_2_4_3.gemfile
29
+ - gemfiles/rails_6_0_3_4.gemfile
30
+ env:
31
+ BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
32
+ runs-on: ${{ matrix.os }}-latest
33
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
34
+ steps:
35
+ - name: Checkout
36
+ uses: actions/checkout@v2
37
+ - name: Setup Ruby
38
+ uses: ruby/setup-ruby@v1
39
+ with:
40
+ ruby-version: ${{ matrix.ruby }}
41
+ bundler-cache: true
42
+ - name: Test
43
+ run: bundle exec rake spec
data/.gitignore CHANGED
@@ -9,3 +9,7 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ spec/support/rails_app_5_1_5/db/
14
+ spec/support/rails_app_5_2_4_3/db/
15
+ TODO.md
data/.travis.yml CHANGED
@@ -5,3 +5,9 @@ cache: bundler
5
5
  rvm:
6
6
  - 2.6.3
7
7
  before_install: gem install bundler -v 2.0.2
8
+ gemfile:
9
+ - gemfiles/rails_5_1_5.gemfile
10
+ - gemfiles/rails_5_2_4_3.gemfile
11
+ - gemfiles/rails_6_0_3_4.gemfile
12
+ matrix:
13
+ fast_finish: true
data/Appraisals ADDED
@@ -0,0 +1,14 @@
1
+ appraise "rails_5_1_5" do
2
+ gem "rails", "5.1.5"
3
+ gem 'sqlite3', '~> 1.3.6'
4
+ end
5
+
6
+ appraise "rails_5_2_4_3" do
7
+ gem "rails", "5.2.4.3"
8
+ gem 'sqlite3', '~> 1.4.2'
9
+ end
10
+
11
+ appraise "rails_6_0_3_4" do
12
+ gem "rails", "6.0.3.4"
13
+ gem 'sqlite3', '~> 1.4.2'
14
+ end
data/Gemfile.lock CHANGED
@@ -1,21 +1,141 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lazy_migrate (0.1.0)
5
- tty-prompt
4
+ lazy_migrate (0.2.0)
5
+ sorbet-runtime
6
+ tty-prompt (~> 0.22.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
11
+ actioncable (6.0.3.4)
12
+ actionpack (= 6.0.3.4)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (6.0.3.4)
16
+ actionpack (= 6.0.3.4)
17
+ activejob (= 6.0.3.4)
18
+ activerecord (= 6.0.3.4)
19
+ activestorage (= 6.0.3.4)
20
+ activesupport (= 6.0.3.4)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.0.3.4)
23
+ actionpack (= 6.0.3.4)
24
+ actionview (= 6.0.3.4)
25
+ activejob (= 6.0.3.4)
26
+ mail (~> 2.5, >= 2.5.4)
27
+ rails-dom-testing (~> 2.0)
28
+ actionpack (6.0.3.4)
29
+ actionview (= 6.0.3.4)
30
+ activesupport (= 6.0.3.4)
31
+ rack (~> 2.0, >= 2.0.8)
32
+ rack-test (>= 0.6.3)
33
+ rails-dom-testing (~> 2.0)
34
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
+ actiontext (6.0.3.4)
36
+ actionpack (= 6.0.3.4)
37
+ activerecord (= 6.0.3.4)
38
+ activestorage (= 6.0.3.4)
39
+ activesupport (= 6.0.3.4)
40
+ nokogiri (>= 1.8.5)
41
+ actionview (6.0.3.4)
42
+ activesupport (= 6.0.3.4)
43
+ builder (~> 3.1)
44
+ erubi (~> 1.4)
45
+ rails-dom-testing (~> 2.0)
46
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
+ activejob (6.0.3.4)
48
+ activesupport (= 6.0.3.4)
49
+ globalid (>= 0.3.6)
50
+ activemodel (6.0.3.4)
51
+ activesupport (= 6.0.3.4)
52
+ activerecord (6.0.3.4)
53
+ activemodel (= 6.0.3.4)
54
+ activesupport (= 6.0.3.4)
55
+ activestorage (6.0.3.4)
56
+ actionpack (= 6.0.3.4)
57
+ activejob (= 6.0.3.4)
58
+ activerecord (= 6.0.3.4)
59
+ marcel (~> 0.3.1)
60
+ activesupport (6.0.3.4)
61
+ concurrent-ruby (~> 1.0, >= 1.0.2)
62
+ i18n (>= 0.7, < 2)
63
+ minitest (~> 5.1)
64
+ tzinfo (~> 1.1)
65
+ zeitwerk (~> 2.2, >= 2.2.2)
66
+ appraisal (2.3.0)
67
+ bundler
68
+ rake
69
+ thor (>= 0.14.0)
70
+ builder (3.2.4)
71
+ byebug (11.1.3)
72
+ coderay (1.1.3)
73
+ concurrent-ruby (1.1.7)
74
+ crass (1.0.6)
10
75
  diff-lcs (1.4.4)
76
+ erubi (1.9.0)
77
+ globalid (0.4.2)
78
+ activesupport (>= 4.2.0)
79
+ i18n (1.8.5)
80
+ concurrent-ruby (~> 1.0)
81
+ loofah (2.7.0)
82
+ crass (~> 1.0.2)
83
+ nokogiri (>= 1.5.9)
84
+ mail (2.7.1)
85
+ mini_mime (>= 0.1.1)
86
+ marcel (0.3.3)
87
+ mimemagic (~> 0.3.2)
88
+ method_source (1.0.0)
89
+ mimemagic (0.3.5)
90
+ mini_mime (1.0.2)
91
+ mini_portile2 (2.4.0)
92
+ minitest (5.14.2)
93
+ nio4r (2.5.4)
94
+ nokogiri (1.10.10)
95
+ mini_portile2 (~> 2.4.0)
11
96
  pastel (0.8.0)
12
97
  tty-color (~> 0.5)
98
+ pry (0.13.1)
99
+ coderay (~> 1.1)
100
+ method_source (~> 1.0)
101
+ pry-byebug (3.9.0)
102
+ byebug (~> 11.0)
103
+ pry (~> 0.13.0)
104
+ rack (2.2.3)
105
+ rack-test (1.1.0)
106
+ rack (>= 1.0, < 3)
107
+ rails (6.0.3.4)
108
+ actioncable (= 6.0.3.4)
109
+ actionmailbox (= 6.0.3.4)
110
+ actionmailer (= 6.0.3.4)
111
+ actionpack (= 6.0.3.4)
112
+ actiontext (= 6.0.3.4)
113
+ actionview (= 6.0.3.4)
114
+ activejob (= 6.0.3.4)
115
+ activemodel (= 6.0.3.4)
116
+ activerecord (= 6.0.3.4)
117
+ activestorage (= 6.0.3.4)
118
+ activesupport (= 6.0.3.4)
119
+ bundler (>= 1.3.0)
120
+ railties (= 6.0.3.4)
121
+ sprockets-rails (>= 2.0.0)
122
+ rails-dom-testing (2.0.3)
123
+ activesupport (>= 4.2.0)
124
+ nokogiri (>= 1.6)
125
+ rails-html-sanitizer (1.3.0)
126
+ loofah (~> 2.3)
127
+ railties (6.0.3.4)
128
+ actionpack (= 6.0.3.4)
129
+ activesupport (= 6.0.3.4)
130
+ method_source
131
+ rake (>= 0.8.7)
132
+ thor (>= 0.20.3, < 2.0)
13
133
  rake (13.0.1)
14
134
  rspec (3.9.0)
15
135
  rspec-core (~> 3.9.0)
16
136
  rspec-expectations (~> 3.9.0)
17
137
  rspec-mocks (~> 3.9.0)
18
- rspec-core (3.9.2)
138
+ rspec-core (3.9.3)
19
139
  rspec-support (~> 3.9.3)
20
140
  rspec-expectations (3.9.2)
21
141
  diff-lcs (>= 1.2.0, < 2.0)
@@ -24,7 +144,21 @@ GEM
24
144
  diff-lcs (>= 1.2.0, < 2.0)
25
145
  rspec-support (~> 3.9.0)
26
146
  rspec-support (3.9.3)
27
- tty-color (0.5.1)
147
+ sorbet (0.5.5991)
148
+ sorbet-static (= 0.5.5991)
149
+ sorbet-runtime (0.5.5991)
150
+ sorbet-static (0.5.5991-universal-darwin-14)
151
+ sprockets (4.0.2)
152
+ concurrent-ruby (~> 1.0)
153
+ rack (> 1, < 3)
154
+ sprockets-rails (3.2.2)
155
+ actionpack (>= 4.0)
156
+ activesupport (>= 4.0)
157
+ sprockets (>= 3.0.0)
158
+ sqlite3 (1.4.2)
159
+ thor (1.0.1)
160
+ thread_safe (0.3.6)
161
+ tty-color (0.5.2)
28
162
  tty-cursor (0.7.1)
29
163
  tty-prompt (0.22.0)
30
164
  pastel (~> 0.8)
@@ -34,16 +168,27 @@ GEM
34
168
  tty-screen (~> 0.8)
35
169
  wisper (~> 2.0)
36
170
  tty-screen (0.8.1)
171
+ tzinfo (1.2.7)
172
+ thread_safe (~> 0.1)
173
+ websocket-driver (0.7.3)
174
+ websocket-extensions (>= 0.1.0)
175
+ websocket-extensions (0.1.5)
37
176
  wisper (2.0.1)
177
+ zeitwerk (2.4.0)
38
178
 
39
179
  PLATFORMS
40
180
  ruby
41
181
 
42
182
  DEPENDENCIES
183
+ appraisal
43
184
  bundler (~> 2.0)
44
185
  lazy_migrate!
186
+ pry-byebug (~> 3.9.0)
187
+ rails (~> 6.0.3)
45
188
  rake (~> 13.0)
46
189
  rspec (~> 3.0)
190
+ sorbet
191
+ sqlite3 (~> 1.4.2)
47
192
 
48
193
  BUNDLED WITH
49
- 2.0.2
194
+ 2.1.4
data/Guardfile ADDED
@@ -0,0 +1,39 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # RSpec files
32
+ rspec = dsl.rspec
33
+ watch(rspec.spec_helper) { rspec.spec_dir }
34
+ watch(rspec.spec_files)
35
+
36
+ # Ruby files
37
+ ruby = dsl.ruby
38
+ dsl.watch_spec_files_for(ruby.lib_files)
39
+ end
data/README.md CHANGED
@@ -1,8 +1,18 @@
1
1
  # LazyMigrate
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/lazy_migrate`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Easily manage rails migrations with a mini UI that can be invoked in your console or on the command line.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ![](/github/demo.gif)
6
+
7
+ I am sick and tired of having to manually copy and paste version numbers from my migration filenames whenever I have to do anything more complicated than `rails db:migrate`! So I made a gem that easily plugs into a rails app and makes it all a little easier.
8
+
9
+ Although most of this just forwards the commands directly to rails, one feature goes a step beyond. If you have ever pulled the latest changes on master only to find that somebody managed to merge a migration before you merged yours, you may be familiar with the dance of:
10
+ 1) `down`'ing your migration
11
+ 2) obtaining a new version timestamp
12
+ 3) replacing the version in your migration's filename
13
+ 4) up'ing the migration again
14
+
15
+ This gem lets you do all that with the press of a button (via the `bring to top` option), so you don't need to break a sweat trying to merge your migration before somebody else beats you to the punch.
6
16
 
7
17
  ## Installation
8
18
 
@@ -14,7 +24,7 @@ gem 'lazy_migrate'
14
24
 
15
25
  And then execute:
16
26
 
17
- $ bundle
27
+ $ bundle install
18
28
 
19
29
  Or install it yourself as:
20
30
 
@@ -22,17 +32,57 @@ Or install it yourself as:
22
32
 
23
33
  ## Usage
24
34
 
25
- TODO: Write usage instructions here
35
+ From within a rails console, go
36
+
37
+ ```ruby
38
+ LazyMigrate.run
39
+ ```
40
+
41
+ You can also invoke lazy_migrate as a rake task either by adding the following to your Rails app Rakefile:
42
+
43
+ ```ruby
44
+ spec = Gem::Specification.find_by_name('lazy_migrate')
45
+ load "#{spec.gem_dir}/lib/tasks/lazy_migrate.rake"
46
+ ```
47
+
48
+ Or by creating a rake task yourself like so:
49
+
50
+ ```ruby
51
+ # in lib/tasks/lazy_migrate.rake
52
+ # frozen_string_literal: true
53
+
54
+ require 'lazy_migrate'
55
+
56
+ namespace :lazy_migrate do
57
+ desc 'runs lazy_migrate'
58
+ task run: :environment do
59
+ LazyMigrate.run
60
+ end
61
+ end
62
+
63
+ ```
26
64
 
27
65
  ## Development
28
66
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
67
+ After checking out the repo, run `bin/setup` to install dependencies.
68
+
30
69
 
31
70
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
71
 
72
+ We use [Appraisal](https://github.com/thoughtbot/appraisal) to test the gem against different rails version like so:
73
+
74
+ ```
75
+ bundle exec appraisal
76
+
77
+ bundle exec appraisal rails_5_1_5 rspec
78
+ bundle exec appraisal rails_5_2_4_3 install
79
+ ```
80
+
33
81
  ## Contributing
34
82
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lazy_migrate.
83
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jesseduffield/lazy_migrate.
84
+ If anybody wants this to work with the [Data Migrate](https://rubygems.org/gems/data_migrate/versions/1.2.0) gem let me know, currently it's only for schema migrations.
85
+ Hope you like types! Cos this gem uses [Sorbet](https://sorbet.org/).
36
86
 
37
87
  ## License
38
88
 
data/Rakefile CHANGED
@@ -6,6 +6,4 @@ RSpec::Core::RakeTask.new(:spec)
6
6
 
7
7
  task default: :spec
8
8
 
9
- task :run do
10
- LazyMigrate.run
11
- end
9
+ import "./lib/tasks/lazy_migrate.rake"
data/bin/exe/lazy_migrate CHANGED
@@ -1,4 +1,17 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
4
+ until File.exist?('Gemfile')
5
+ Dir.chdir('..')
6
+
7
+ at_root = Dir.getwd == File.dirname(Dir.getwd)
8
+ if at_root
9
+ puts "Must be run in a rails project"
10
+ exit
11
+ end
12
+ end
13
+
14
+ require './config/environment'
3
15
  require 'lazy_migrate'
4
- LazyMigrate.run
16
+
17
+ LazyMigrate.run