hookup 1.2.4 → 1.2.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 21d8368abed9ca30e0bf5b42f4a9940dc4a168a3
4
- data.tar.gz: ff0246d9aa5d3e003e60c63238d052934814f13c
2
+ SHA256:
3
+ metadata.gz: a003ee5a9f2e61b570aaf4d4006b37ac6269ced76eee42df20ab78ac930764de
4
+ data.tar.gz: 2c76b14b8d34af3b719051ca21ff175e9ad1209d99ec1bc3cc2e2123f4f851d1
5
5
  SHA512:
6
- metadata.gz: fc6771c38811c794949497c737921954978e668280f7943cb1a97102afe3bf55114c13976b427961f3d68e9e1c806c52d0b158e185c5b87f4cbc88fa520ccbc2
7
- data.tar.gz: 75e885ad88596ba381bec73023938d3b9105eb673569dde15bf677384ec7e6b1845b98c7b4c7f53690a0a74131e98b618367a36e58e65c86e90a4c8b2e9cd543
6
+ metadata.gz: a7f7534b3ee8417f509699c602184156bb5347616c0904fff55245ac8c7a8ab5ce53cd9f64fa7c16d2d4d5b57c03f32d590385fc170fd9db64e5bdee1fd7a812
7
+ data.tar.gz: 28cfa49a9e6f3c06461ff5c04cc43fb14383812fbb966961e3e70567390cbd099ba5f1bf5067cfca960fc995615011b37f8ff734691be7a2fed2a5bc8ad02d53
data/README.markdown CHANGED
@@ -53,6 +53,10 @@ the two versions.
53
53
  Set the `SKIP_HOOKUP` environment variable to skip hookup.
54
54
 
55
55
  SKIP_HOOKUP=1 git checkout master
56
+
57
+ ### Removing Hookup
58
+
59
+ hookup remove
56
60
 
57
61
  ChangeLog
58
62
  ---------
data/hookup.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "hookup"
5
- s.version = "1.2.4"
5
+ s.version = "1.2.5"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Tim Pope"]
8
8
  s.email = ["code@tp"+'ope.net']
data/lib/hookup.rb CHANGED
@@ -41,22 +41,34 @@ class Hookup
41
41
  @git_dir
42
42
  end
43
43
 
44
+ def bundler?
45
+ !!ENV['BUNDLE_GEMFILE']
46
+ end
47
+
48
+ def make_command(command)
49
+ bundler? ? command.insert(0, "bundle exec ") : command
50
+ end
51
+
44
52
  def post_checkout_file
45
53
  File.join(git_dir, 'hooks', 'post-checkout')
46
54
  end
47
55
 
56
+ def info_attributes_file
57
+ File.join(git_dir, 'info', 'attributes')
58
+ end
59
+
48
60
  def install
49
61
  append(post_checkout_file, 0777) do |body, f|
50
62
  f.puts "#!/bin/bash" unless body
51
- f.puts %(hookup post-checkout "$@") if body !~ /hookup/
63
+ f.puts make_command(%(hookup post-checkout "$@")) if body !~ /hookup/
52
64
  end
53
65
 
54
- append(File.join(git_dir, 'info', 'attributes')) do |body, f|
66
+ append(info_attributes_file) do |body, f|
55
67
  map = 'db/schema.rb merge=railsschema'
56
68
  f.puts map unless body.to_s.include?(map)
57
69
  end
58
70
 
59
- system 'git', 'config', 'merge.railsschema.driver', 'hookup resolve-schema %A %O %B %L'
71
+ system 'git', 'config', 'merge.railsschema.driver', make_command('hookup resolve-schema %A %O %B %L')
60
72
 
61
73
  puts "Hooked up!"
62
74
  end
@@ -66,6 +78,12 @@ class Hookup
66
78
  body.reject! { |item| item =~ /hookup/ }
67
79
  File.open(post_checkout_file, 'w') { |file| file.puts body.join }
68
80
 
81
+ body = IO.readlines(info_attributes_file)
82
+ body.reject! { |item| item =~ /railsschema/ }
83
+ File.open(info_attributes_file, 'w') { |file| file.puts body.join }
84
+
85
+ system 'git', 'config', '--unset', 'merge.railsschema.driver'
86
+
69
87
  puts "Hookup removed!"
70
88
  end
71
89
 
@@ -212,7 +230,9 @@ class Hookup
212
230
 
213
231
  def rake(*args)
214
232
  Dir.chdir(working_dir) do
215
- if bundler?
233
+ if File.executable?('bin/rake')
234
+ system 'bin/rake', *args
235
+ elsif bundler?
216
236
  system 'bundle', 'exec', 'rake', *args
217
237
  else
218
238
  system 'rake', *args
@@ -239,7 +259,7 @@ class Hookup
239
259
 
240
260
  def resolve_schema_version(body, version)
241
261
  asd = "ActiveRecord::Schema.define"
242
- body.sub!(/^<+ .*\n#{asd}\(#{version} (\d+)\) do\n=+\n#{asd}\(#{version} (\d+)\) do\n>+ .*/) do
262
+ body.sub!(/^<+ .*\n#{asd}\(#{version} ([0-9_]+)\) do\n=+\n#{asd}\(#{version} ([0-9_]+)\) do\n>+ .*/) do
243
263
  "#{asd}(#{version} #{[$1, $2].max}) do"
244
264
  end
245
265
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pope
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-19 00:00:00.000000000 Z
11
+ date: 2022-06-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Automatically bundle and migrate your Rails app when switching branches,
14
14
  merging upstream changes, and bisecting.
@@ -19,7 +19,7 @@ executables:
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
- - .gitignore
22
+ - ".gitignore"
23
23
  - Gemfile
24
24
  - MIT-LICENSE
25
25
  - README.markdown
@@ -36,19 +36,17 @@ require_paths:
36
36
  - lib
37
37
  required_ruby_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  required_rubygems_version: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  requirements: []
48
- rubyforge_project: hookup
49
- rubygems_version: 2.3.0
48
+ rubygems_version: 3.1.4
50
49
  signing_key:
51
50
  specification_version: 4
52
51
  summary: Automate the bundle/migration tedium of Rails with Git hooks
53
52
  test_files: []
54
- has_rdoc: