right_git 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +3 -0
- data/LICENSE +20 -0
- data/README.rdoc +13 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/lib/right_git/git/branch.rb +137 -0
- data/lib/right_git/git/branch_collection.rb +107 -0
- data/lib/right_git/git/commit.rb +76 -0
- data/lib/right_git/git/repository.rb +368 -0
- data/lib/right_git/git/tag.rb +82 -0
- data/lib/right_git/git.rb +36 -0
- data/lib/right_git/shell/default.rb +191 -0
- data/lib/right_git/shell/interface.rb +74 -0
- data/lib/right_git/shell.rb +33 -0
- data/lib/right_git.rb +29 -0
- data/right_git.gemspec +61 -0
- metadata +191 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013 RightScale Inc
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
# ancestor
|
24
|
+
require 'right_git/shell'
|
25
|
+
|
26
|
+
# local
|
27
|
+
require 'logger'
|
28
|
+
|
29
|
+
module RightGit::Shell
|
30
|
+
|
31
|
+
# Interface for a shell intended to work with RightGit.
|
32
|
+
module Interface
|
33
|
+
|
34
|
+
# Provides a default logger object (overridable).
|
35
|
+
#
|
36
|
+
# @return [Logger] default logger for STDOUT
|
37
|
+
def default_logger
|
38
|
+
@default_logger ||= ::Logger.new(STDOUT)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Run the given command and print the output to stdout.
|
42
|
+
#
|
43
|
+
# Must be overridden.
|
44
|
+
#
|
45
|
+
# @param [String] cmd the shell command to run
|
46
|
+
# @param [Hash] options for execution
|
47
|
+
# @option options :directory [String] to use as working directory during command execution or nil
|
48
|
+
# @option options :logger [Logger] logger for shell execution (default = STDOUT)
|
49
|
+
# @option options :outstream [IO] output stream to receive STDOUT and STDERR from command (default = STDOUT)
|
50
|
+
# @option options :raise_on_failure [TrueClass|FalseClass] if true, wil raise a RuntimeError if the command does not end successfully (default), false to ignore errors
|
51
|
+
# @option options :set_env_vars [Hash] environment variables to set during execution (default = none set)
|
52
|
+
# @option options :clear_env_vars [Hash] environment variables to clear during execution (default = none cleared but see :clean_bundler_env)
|
53
|
+
#
|
54
|
+
# @return [Integer] exitstatus of the command
|
55
|
+
#
|
56
|
+
# @raise [ShellError] on failure only if :raise_on_failure is true
|
57
|
+
def execute(cmd, options = {})
|
58
|
+
raise NotImplementedError
|
59
|
+
end
|
60
|
+
|
61
|
+
# Invoke a shell command and return its output as a string, similar to
|
62
|
+
# backtick but defaulting to raising exception on failure.
|
63
|
+
#
|
64
|
+
# Must be overridden.
|
65
|
+
#
|
66
|
+
# @param [String] cmd command to execute
|
67
|
+
# @param [Hash] options for execution (see execute)
|
68
|
+
#
|
69
|
+
# @raise [ShellError] on failure only if :raise_on_failure is true
|
70
|
+
def output_for(cmd, options = {})
|
71
|
+
raise NotImplementedError
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013 RightScale Inc
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
# ancestor
|
24
|
+
require 'right_git'
|
25
|
+
|
26
|
+
module RightGit
|
27
|
+
module Shell
|
28
|
+
class ShellError < RightGitError; end
|
29
|
+
|
30
|
+
autoload :Default, 'right_git/shell/default'
|
31
|
+
autoload :Interface, 'right_git/shell/interface'
|
32
|
+
end
|
33
|
+
end
|
data/lib/right_git.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013 RightScale Inc
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
# Autoload everything possible
|
24
|
+
module RightGit
|
25
|
+
class RightGitError < StandardError; end
|
26
|
+
|
27
|
+
autoload :Git, 'right_git/git'
|
28
|
+
autoload :Shell, 'right_git/shell'
|
29
|
+
end
|
data/right_git.gemspec
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "right_git"
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Tony Spataro", "Scott Messier"]
|
12
|
+
s.date = "2013-11-13"
|
13
|
+
s.description = "An assortment of git-related classes created by RightScale."
|
14
|
+
s.email = "support@rightscale.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"CHANGELOG.rdoc",
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"lib/right_git.rb",
|
26
|
+
"lib/right_git/git.rb",
|
27
|
+
"lib/right_git/git/branch.rb",
|
28
|
+
"lib/right_git/git/branch_collection.rb",
|
29
|
+
"lib/right_git/git/commit.rb",
|
30
|
+
"lib/right_git/git/repository.rb",
|
31
|
+
"lib/right_git/git/tag.rb",
|
32
|
+
"lib/right_git/shell.rb",
|
33
|
+
"lib/right_git/shell/default.rb",
|
34
|
+
"lib/right_git/shell/interface.rb",
|
35
|
+
"right_git.gemspec"
|
36
|
+
]
|
37
|
+
s.homepage = "https://github.com/rightscale/right_git"
|
38
|
+
s.licenses = ["MIT"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = "1.8.25"
|
41
|
+
s.summary = "Reusable Git repository management code."
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_development_dependency(%q<rake>, ["< 0.10", ">= 0.8.7"])
|
48
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
49
|
+
s.add_development_dependency(%q<nokogiri>, ["= 1.5.6"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<rake>, ["< 0.10", ">= 0.8.7"])
|
52
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
53
|
+
s.add_dependency(%q<nokogiri>, ["= 1.5.6"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<rake>, ["< 0.10", ">= 0.8.7"])
|
57
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
58
|
+
s.add_dependency(%q<nokogiri>, ["= 1.5.6"])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: right_git
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tony Spataro
|
9
|
+
- Scott Messier
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-12-06 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: right_git
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: rake
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - <
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0.10'
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.8.7
|
42
|
+
type: :development
|
43
|
+
prerelease: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - <
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.10'
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.8.7
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: jeweler
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.8.3
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.8.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - '='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.5.6
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - '='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.5.6
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: rake
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - <
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0.10'
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.8.7
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - <
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.10'
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 0.8.7
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: jeweler
|
109
|
+
requirement: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ~>
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: 1.8.3
|
115
|
+
type: :development
|
116
|
+
prerelease: false
|
117
|
+
version_requirements: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ~>
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 1.8.3
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: nokogiri
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - '='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 1.5.6
|
131
|
+
type: :development
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.5.6
|
139
|
+
description: An assortment of git-related classes created by RightScale.
|
140
|
+
email: support@rightscale.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files:
|
144
|
+
- LICENSE
|
145
|
+
- README.rdoc
|
146
|
+
files:
|
147
|
+
- CHANGELOG.rdoc
|
148
|
+
- LICENSE
|
149
|
+
- README.rdoc
|
150
|
+
- Rakefile
|
151
|
+
- VERSION
|
152
|
+
- lib/right_git.rb
|
153
|
+
- lib/right_git/git.rb
|
154
|
+
- lib/right_git/git/branch.rb
|
155
|
+
- lib/right_git/git/branch_collection.rb
|
156
|
+
- lib/right_git/git/commit.rb
|
157
|
+
- lib/right_git/git/repository.rb
|
158
|
+
- lib/right_git/git/tag.rb
|
159
|
+
- lib/right_git/shell.rb
|
160
|
+
- lib/right_git/shell/default.rb
|
161
|
+
- lib/right_git/shell/interface.rb
|
162
|
+
- right_git.gemspec
|
163
|
+
homepage: https://github.com/rightscale/right_git
|
164
|
+
licenses:
|
165
|
+
- MIT
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options: []
|
168
|
+
require_paths:
|
169
|
+
- lib
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
segments:
|
177
|
+
- 0
|
178
|
+
hash: 1238626226747988428
|
179
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
181
|
+
requirements:
|
182
|
+
- - ! '>='
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '0'
|
185
|
+
requirements: []
|
186
|
+
rubyforge_project:
|
187
|
+
rubygems_version: 1.8.23
|
188
|
+
signing_key:
|
189
|
+
specification_version: 3
|
190
|
+
summary: Reusable Git repository management code.
|
191
|
+
test_files: []
|