grancher 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGELOG +1 -0
  2. data/Manifest +3 -3
  3. data/grancher.gemspec +4 -4
  4. data/lib/grancher.rb +18 -3
  5. metadata +7 -7
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v0.1.5 Support tagging.
1
2
  v0.1.4 Removed log line.
2
3
  v0.1.3 Commit the changes when all files are removed.
3
4
  v0.1.2 Include hidden files that start in a period (.).
data/Manifest CHANGED
@@ -1,7 +1,7 @@
1
1
  CHANGELOG
2
2
  LICENSE
3
+ Manifest
3
4
  README
4
- lib/grancher/task.rb
5
- lib/grancher.rb
6
5
  Rakefile
7
- Manifest
6
+ lib/grancher.rb
7
+ lib/grancher/task.rb
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{grancher}
5
- s.version = "0.1.4"
5
+ s.version = "0.1.5"
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-08}
9
+ s.date = %q{2010-04-19}
10
10
  s.description = %q{Easily copy folders and files to other Git branches}
11
11
  s.email = %q{judofyr@gmail.com}
12
- s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/grancher/task.rb", "lib/grancher.rb"]
13
- s.files = ["CHANGELOG", "LICENSE", "README", "lib/grancher/task.rb", "lib/grancher.rb", "Rakefile", "Manifest", "grancher.gemspec"]
12
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/grancher.rb", "lib/grancher/task.rb"]
13
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "lib/grancher.rb", "lib/grancher/task.rb", "grancher.gemspec"]
14
14
  s.homepage = %q{}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Grancher", "--main", "README", "--main", "Grancher", "--title", "Grancher"]
16
16
  s.require_paths = ["lib"]
@@ -9,7 +9,7 @@ require 'gash'
9
9
  #
10
10
  # require 'grancher'
11
11
  # grancher = Grancher.new do |g|
12
- # g.branch = 'gh-pages' # alternatively, g.refspec = 'ghpages:/refs/heads/ghpages'
12
+ # g.branch = 'gh-pages' # alternatively, g.refspec = 'ghpages:refs/heads/ghpages'
13
13
  # g.push_to = 'origin'
14
14
  # g.repo = 'some_repo' # defaults to '.'
15
15
  # g.message = 'Updated website' # defaults to 'Updated files.'
@@ -76,7 +76,7 @@ class Gash
76
76
  end
77
77
 
78
78
  class Grancher
79
- attr_accessor :branch, :refspec, :push_to, :repo, :message
79
+ attr_accessor :branch, :refspec, :push_to, :repo, :message, :tags
80
80
  attr_reader :gash, :files, :directories
81
81
 
82
82
  def initialize(&blk)
@@ -85,6 +85,7 @@ class Grancher
85
85
  @keep = []
86
86
  @repo = '.'
87
87
  @message = 'Updated files.'
88
+ @tags = []
88
89
  if block_given?
89
90
  if blk.arity == 1
90
91
  blk.call(self)
@@ -135,9 +136,23 @@ class Grancher
135
136
  @branch = branch
136
137
  end
137
138
 
139
+ # Tag the most recent checked-out commit
140
+ def tag(tag, tag_msg="", commit=nil)
141
+ @tags << tag
142
+ if commit
143
+ gash.send(:git, 'tag', '-f', '-a', '-m', tag_msg, tag, commit)
144
+ else
145
+ gash.send(:git, 'tag', '-f', '-a', '-m', tag_msg, tag)
146
+ end
147
+ end
148
+
138
149
  # Pushes the branch to the remote.
139
150
  def push
140
- gash.send(:git, 'push', @push_to, @refspec)
151
+ if @tags.empty?
152
+ gash.send(:git, 'push', @push_to, @refspec)
153
+ else
154
+ gash.send(:git, 'push', '--tags', @push_to, @refspec)
155
+ end
141
156
  end
142
157
 
143
158
  # Commits the changes.
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
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-08 00:00:00 +01:00
17
+ date: 2010-04-19 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -39,16 +39,16 @@ extra_rdoc_files:
39
39
  - CHANGELOG
40
40
  - LICENSE
41
41
  - README
42
- - lib/grancher/task.rb
43
42
  - lib/grancher.rb
43
+ - lib/grancher/task.rb
44
44
  files:
45
45
  - CHANGELOG
46
46
  - LICENSE
47
+ - Manifest
47
48
  - README
48
- - lib/grancher/task.rb
49
- - lib/grancher.rb
50
49
  - Rakefile
51
- - Manifest
50
+ - lib/grancher.rb
51
+ - lib/grancher/task.rb
52
52
  - grancher.gemspec
53
53
  has_rdoc: true
54
54
  homepage: ""