grancher 0.1 → 0.1.1
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.
- data/CHANGELOG +1 -0
- data/grancher.gemspec +4 -8
- data/lib/grancher.rb +28 -11
- metadata +22 -20
data/CHANGELOG
CHANGED
data/grancher.gemspec
CHANGED
@@ -2,36 +2,32 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{grancher}
|
5
|
-
s.version = "0.1"
|
5
|
+
s.version = "0.1.1"
|
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{
|
9
|
+
s.date = %q{2010-04-06}
|
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"]
|
13
13
|
s.files = ["CHANGELOG", "LICENSE", "README", "lib/grancher/task.rb", "lib/grancher.rb", "Rakefile", "Manifest", "grancher.gemspec"]
|
14
|
-
s.has_rdoc = true
|
15
14
|
s.homepage = %q{}
|
16
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Grancher", "--main", "README", "--main", "Grancher", "--title", "Grancher"]
|
17
16
|
s.require_paths = ["lib"]
|
18
17
|
s.rubyforge_project = %q{dojo}
|
19
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.6}
|
20
19
|
s.summary = %q{Easily copy folders and files to other Git branches}
|
21
20
|
|
22
21
|
if s.respond_to? :specification_version then
|
23
22
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
-
s.specification_version =
|
23
|
+
s.specification_version = 3
|
25
24
|
|
26
25
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
26
|
s.add_runtime_dependency(%q<gash>, [">= 0"])
|
28
|
-
s.add_development_dependency(%q<echoe>, [">= 0"])
|
29
27
|
else
|
30
28
|
s.add_dependency(%q<gash>, [">= 0"])
|
31
|
-
s.add_dependency(%q<echoe>, [">= 0"])
|
32
29
|
end
|
33
30
|
else
|
34
31
|
s.add_dependency(%q<gash>, [">= 0"])
|
35
|
-
s.add_dependency(%q<echoe>, [">= 0"])
|
36
32
|
end
|
37
33
|
end
|
data/lib/grancher.rb
CHANGED
@@ -9,8 +9,8 @@ require 'gash'
|
|
9
9
|
#
|
10
10
|
# require 'grancher'
|
11
11
|
# grancher = Grancher.new do |g|
|
12
|
-
# g.branch = 'gh-pages'
|
13
|
-
# g.push_to = 'origin'
|
12
|
+
# g.branch = 'gh-pages' # alternatively, g.refspec = 'ghpages:/refs/heads/ghpages'
|
13
|
+
# g.push_to = 'origin'
|
14
14
|
# g.repo = 'some_repo' # defaults to '.'
|
15
15
|
# g.message = 'Updated website' # defaults to 'Updated files.'
|
16
16
|
#
|
@@ -66,7 +66,7 @@ require 'gash'
|
|
66
66
|
#
|
67
67
|
#
|
68
68
|
class Grancher
|
69
|
-
attr_accessor :branch, :push_to, :repo, :message
|
69
|
+
attr_accessor :branch, :refspec, :push_to, :repo, :message
|
70
70
|
attr_reader :gash, :files, :directories
|
71
71
|
|
72
72
|
def initialize(&blk)
|
@@ -75,11 +75,12 @@ class Grancher
|
|
75
75
|
@keep = []
|
76
76
|
@repo = '.'
|
77
77
|
@message = 'Updated files.'
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
if block_given?
|
79
|
+
if blk.arity == 1
|
80
|
+
blk.call(self)
|
81
|
+
else
|
82
|
+
self.instance_eval(&blk)
|
83
|
+
end
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
@@ -100,17 +101,33 @@ class Grancher
|
|
100
101
|
|
101
102
|
# Keeps the files (or directories) given.
|
102
103
|
def keep(*files)
|
103
|
-
@keep.concat(files)
|
104
|
+
@keep.concat(files.flatten)
|
104
105
|
end
|
105
106
|
|
106
107
|
# Keep all the files in the branch.
|
107
108
|
def keep_all
|
108
109
|
@keep_all = true
|
109
110
|
end
|
110
|
-
|
111
|
+
|
112
|
+
# Full git refspec to push to. Setting g.refspec will replace g.branch. Used when the remote
|
113
|
+
# branch is different to the local branch. Any git refspec is valid ('man git-push' for details)
|
114
|
+
def refspec=(refspec)
|
115
|
+
if refspec =~ /^\+?(.*)(?:\:.*)$/
|
116
|
+
@branch = $1
|
117
|
+
else
|
118
|
+
raise ArgumentError, "refspec syntax error. Should be: branch:refs/heads/branch"
|
119
|
+
end
|
120
|
+
@refspec = refspec
|
121
|
+
end
|
122
|
+
|
123
|
+
def branch=(branch)
|
124
|
+
@refspec = "#{branch}:refs/heads/#{branch}"
|
125
|
+
@branch = branch
|
126
|
+
end
|
127
|
+
|
111
128
|
# Pushes the branch to the remote.
|
112
129
|
def push
|
113
|
-
gash.send(:git, 'push', @push_to, @
|
130
|
+
gash.send(:git, 'push', @push_to, @refspec)
|
114
131
|
end
|
115
132
|
|
116
133
|
# Commits the changes.
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grancher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Magnus Holm
|
@@ -9,29 +14,21 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-04-06 00:00:00 +01:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: gash
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: echoe
|
27
|
-
type: :development
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
30
24
|
requirements:
|
31
25
|
- - ">="
|
32
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
33
29
|
version: "0"
|
34
|
-
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
35
32
|
description: Easily copy folders and files to other Git branches
|
36
33
|
email: judofyr@gmail.com
|
37
34
|
executables: []
|
@@ -55,6 +52,8 @@ files:
|
|
55
52
|
- grancher.gemspec
|
56
53
|
has_rdoc: true
|
57
54
|
homepage: ""
|
55
|
+
licenses: []
|
56
|
+
|
58
57
|
post_install_message:
|
59
58
|
rdoc_options:
|
60
59
|
- --line-numbers
|
@@ -73,20 +72,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
72
|
requirements:
|
74
73
|
- - ">="
|
75
74
|
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 0
|
76
77
|
version: "0"
|
77
|
-
version:
|
78
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
+
segments:
|
83
|
+
- 1
|
84
|
+
- 2
|
82
85
|
version: "1.2"
|
83
|
-
version:
|
84
86
|
requirements: []
|
85
87
|
|
86
88
|
rubyforge_project: dojo
|
87
|
-
rubygems_version: 1.3.
|
89
|
+
rubygems_version: 1.3.6
|
88
90
|
signing_key:
|
89
|
-
specification_version:
|
91
|
+
specification_version: 3
|
90
92
|
summary: Easily copy folders and files to other Git branches
|
91
93
|
test_files: []
|
92
94
|
|