hookup 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) Tim Pope
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown CHANGED
@@ -20,7 +20,7 @@ Bundling
20
20
  --------
21
21
 
22
22
  Each time your current HEAD changes, hookup checks to see if your
23
- `Gemfile`, `Gemfile.lock`, or gem spec has changed. If so it runs
23
+ `Gemfile`, `Gemfile.lock`, or gem spec has changed. If so, it runs
24
24
  `bundle check`, and if that indicates any dependencies are unsatisfied,
25
25
  it runs `bundle install`.
26
26
 
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.0.0"
5
+ s.version = "1.0.2"
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
@@ -58,6 +58,8 @@ class Hookup
58
58
  end
59
59
 
60
60
  def bundle(old, new, *args)
61
+ return if args.first == '0'
62
+
61
63
  return unless File.exist?('Gemfile')
62
64
  if %x{git diff --name-only #{old} #{new}} =~ /^Gemfile|\.gemspec$/
63
65
  begin
@@ -83,22 +85,28 @@ class Hookup
83
85
  end
84
86
 
85
87
  migrations = %x{git diff --name-status #{old} #{new} -- db/migrate}.scan(/.+/).map {|l| l.split(/\t/) }
86
-
87
- migrations.select {|(t,f)| %w(D M).include?(t)}.reverse.each do |type, file|
88
- begin
89
- system 'git', 'checkout', old, '--', file
90
- system 'rake', 'db:migrate:down', "VERSION=#{File.basename(file)}"
91
- ensure
92
- if type == 'D'
93
- system 'git', 'rm', '--force', '--quiet', '--', file
94
- else
95
- system 'git', 'checkout', new, '--', file
88
+ begin
89
+ migrations.select {|(t,f)| %w(D M).include?(t)}.reverse.each do |type, file|
90
+ begin
91
+ system 'git', 'checkout', old, '--', file
92
+ unless system 'rake', 'db:migrate:down', "VERSION=#{File.basename(file)}"
93
+ raise Error, "Failed to rollback #{File.basename(file)}. Consider rake db:setup"
94
+ end
95
+ ensure
96
+ if type == 'D'
97
+ system 'git', 'rm', '--force', '--quiet', '--', file
98
+ else
99
+ system 'git', 'checkout', new, '--', file
100
+ end
96
101
  end
97
102
  end
98
- end
99
103
 
100
- if migrations.any? {|(t,f)| %w(A M).include?(t)}
101
- system 'rake', 'db:migrate'
104
+ if migrations.any? {|(t,f)| %w(A M).include?(t)}
105
+ system 'rake', 'db:migrate'
106
+ end
107
+
108
+ ensure
109
+ system 'git', 'checkout', '--', 'db/schema.rb' if migrations.any?
102
110
  end
103
111
  end
104
112
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hookup
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 19
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 0
9
- version: 1.0.0
9
+ - 2
10
+ version: 1.0.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Tim Pope
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-04-08 00:00:00 -04:00
18
+ date: 2011-05-09 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -30,6 +31,7 @@ extra_rdoc_files: []
30
31
  files:
31
32
  - .gitignore
32
33
  - Gemfile
34
+ - MIT-LICENSE
33
35
  - README.markdown
34
36
  - Rakefile
35
37
  - bin/hookup
@@ -49,6 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
49
51
  requirements:
50
52
  - - ">="
51
53
  - !ruby/object:Gem::Version
54
+ hash: 3
52
55
  segments:
53
56
  - 0
54
57
  version: "0"
@@ -57,13 +60,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
60
  requirements:
58
61
  - - ">="
59
62
  - !ruby/object:Gem::Version
63
+ hash: 3
60
64
  segments:
61
65
  - 0
62
66
  version: "0"
63
67
  requirements: []
64
68
 
65
69
  rubyforge_project: hookup
66
- rubygems_version: 1.3.7
70
+ rubygems_version: 1.4.2
67
71
  signing_key:
68
72
  specification_version: 3
69
73
  summary: Automate the bundle/migration tedium of Rails with Git hooks