hookup 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.markdown +4 -0
- data/hookup.gemspec +1 -1
- data/lib/hookup.rb +25 -5
- metadata +6 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a003ee5a9f2e61b570aaf4d4006b37ac6269ced76eee42df20ab78ac930764de
|
4
|
+
data.tar.gz: 2c76b14b8d34af3b719051ca21ff175e9ad1209d99ec1bc3cc2e2123f4f851d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7f7534b3ee8417f509699c602184156bb5347616c0904fff55245ac8c7a8ab5ce53cd9f64fa7c16d2d4d5b57c03f32d590385fc170fd9db64e5bdee1fd7a812
|
7
|
+
data.tar.gz: 28cfa49a9e6f3c06461ff5c04cc43fb14383812fbb966961e3e70567390cbd099ba5f1bf5067cfca960fc995615011b37f8ff734691be7a2fed2a5bc8ad02d53
|
data/README.markdown
CHANGED
data/hookup.gemspec
CHANGED
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(
|
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
|
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} (
|
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
|
+
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:
|
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
|
-
|
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:
|