grancher 0.1.2 → 0.1.3

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 (4) hide show
  1. data/CHANGELOG +1 -0
  2. data/grancher.gemspec +2 -2
  3. data/lib/grancher.rb +18 -1
  4. metadata +3 -3
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v0.1.3 Commit the changes when all files are removed.
1
2
  v0.1.2 Include hidden files that start in a period (.).
2
3
  v0.1.1 Allows full git refspec to push to (in place of g.branch). Other minor fixes.
3
4
  v0.1. First version.
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{grancher}
5
- s.version = "0.1.2"
5
+ s.version = "0.1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Magnus Holm"]
9
- s.date = %q{2010-04-07}
9
+ s.date = %q{2010-04-08}
10
10
  s.description = %q{Easily copy folders and files to other Git branches}
11
11
  s.email = %q{judofyr@gmail.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/grancher/task.rb", "lib/grancher.rb"]
@@ -65,6 +65,17 @@ require 'gash'
65
65
  # end
66
66
  #
67
67
  #
68
+
69
+ class Gash
70
+ def commit(msg, opts={})
71
+ puts opts.inspect
72
+ return unless changed? || opts[:force]
73
+ commit = commit_tree(to_tree!, msg)
74
+ @sha1 = git_tree_sha1
75
+ commit
76
+ end
77
+ end
78
+
68
79
  class Grancher
69
80
  attr_accessor :branch, :refspec, :push_to, :repo, :message
70
81
  attr_reader :gash, :files, :directories
@@ -132,7 +143,13 @@ class Grancher
132
143
 
133
144
  # Commits the changes.
134
145
  def commit(message = nil)
135
- build.commit(message || message())
146
+ old_keys = gash.keys
147
+ build
148
+ if gash.keys.sort == old_keys.sort
149
+ gash.commit(message || message())
150
+ else
151
+ gash.commit(message || message(), :force => true)
152
+ end
136
153
  end
137
154
 
138
155
  private
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Magnus Holm
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-07 00:00:00 +01:00
17
+ date: 2010-04-08 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency