repo_manager 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemfiles +1 -1
- data/.gitignore +0 -1
- data/Gemfile.lock +61 -55
- data/HISTORY.markdown +5 -0
- data/LICENSE +1 -1
- data/README.markdown +1 -4
- data/Rakefile +0 -27
- data/VERSION +1 -1
- data/features/actions/git.feature +7 -4
- data/features/actions/help.feature +13 -0
- data/features/actions/task.feature +13 -0
- data/lib/repo_manager/actions/base_action.rb +24 -21
- data/lib/repo_manager/actions/help_action.rb +20 -0
- data/lib/repo_manager/actions/task_action.rb +10 -1
- data/lib/repo_manager/app.rb +6 -6
- data/lib/repo_manager/assets/base_asset.rb +1 -1
- data/lib/repo_manager/core/hash.rb +19 -0
- data/lib/repo_manager/extensions/hash.rb +1 -1
- data/lib/repo_manager/settings.rb +1 -1
- data/lib/repo_manager/tasks/task_manager.rb +17 -4
- data/lib/repo_manager/tasks/thor_helper.rb +1 -1
- data/lib/repo_manager/views/base_view.rb +1 -1
- data/repo_manager.gemspec +11 -13
- data/spec/basic_app/actions/basic_action_spec.rb +122 -0
- metadata +222 -267
- data/.yardopts +0 -11
data/.gemfiles
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
.gitattributes
|
3
3
|
.gitignore
|
4
4
|
.rspec
|
5
|
-
.yardopts
|
6
5
|
Gemfile
|
7
6
|
Gemfile.lock
|
8
7
|
Guardfile
|
@@ -104,6 +103,7 @@ lib/repo_manager/views/templates/default.slim
|
|
104
103
|
lib/repo_manager/views/view_helper.rb
|
105
104
|
repo_manager.gemspec
|
106
105
|
spec/basic_app/actions/action_helper_spec.rb
|
106
|
+
spec/basic_app/actions/basic_action_spec.rb
|
107
107
|
spec/basic_app/assets/base_asset_spec.rb
|
108
108
|
spec/basic_app/core_spec.rb
|
109
109
|
spec/basic_app/settings_spec.rb
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
repo_manager (0.7.
|
4
|
+
repo_manager (0.7.3)
|
5
5
|
chronic (>= 0.6.5)
|
6
6
|
git (= 1.2.5)
|
7
7
|
logging (>= 1.6.2)
|
8
|
-
mustache (
|
9
|
-
slim (
|
10
|
-
term-ansicolor (
|
11
|
-
thor (
|
8
|
+
mustache (= 0.99.4)
|
9
|
+
slim (~> 1.0.4)
|
10
|
+
term-ansicolor (~> 1.0.4)
|
11
|
+
thor (>= 0.15.0)
|
12
|
+
tins (~> 1.6.0)
|
12
13
|
|
13
14
|
GEM
|
14
15
|
remote: http://rubygems.org/
|
@@ -21,79 +22,84 @@ GEM
|
|
21
22
|
rspec (>= 2.6.0)
|
22
23
|
bcat (0.6.2)
|
23
24
|
rack (~> 1.0)
|
24
|
-
builder (3.
|
25
|
-
childprocess (0.3.
|
26
|
-
ffi (~> 1.0.6)
|
27
|
-
chronic (0.
|
25
|
+
builder (3.1.4)
|
26
|
+
childprocess (0.3.6)
|
27
|
+
ffi (~> 1.0, >= 1.0.6)
|
28
|
+
chronic (0.10.2)
|
29
|
+
coderay (1.0.8)
|
28
30
|
cucumber (1.2.1)
|
29
31
|
builder (>= 2.1.2)
|
30
32
|
diff-lcs (>= 1.1.3)
|
31
33
|
gherkin (~> 2.11.0)
|
32
34
|
json (>= 1.4.6)
|
33
35
|
diff-lcs (1.1.3)
|
34
|
-
ffi (1.0
|
35
|
-
gherkin (2.11.
|
36
|
-
json (>= 1.4.6)
|
37
|
-
gherkin (2.11.1-x86-mingw32)
|
36
|
+
ffi (1.2.0)
|
37
|
+
gherkin (2.11.5)
|
38
38
|
json (>= 1.4.6)
|
39
39
|
git (1.2.5)
|
40
|
-
guard (1.
|
41
|
-
|
40
|
+
guard (1.5.4)
|
41
|
+
listen (>= 0.4.2)
|
42
|
+
lumberjack (>= 1.0.2)
|
43
|
+
pry (>= 0.9.10)
|
42
44
|
thor (>= 0.14.6)
|
43
|
-
guard-cucumber (
|
45
|
+
guard-cucumber (1.2.2)
|
44
46
|
cucumber (>= 1.2.0)
|
45
|
-
guard (>=
|
46
|
-
guard-rspec (
|
47
|
-
guard (>=
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
guard (>= 1.1.0)
|
48
|
+
guard-rspec (2.3.0)
|
49
|
+
guard (>= 1.1)
|
50
|
+
rspec (~> 2.11)
|
51
|
+
json (2.1.0)
|
52
|
+
libnotify (0.8.0)
|
53
|
+
ffi (>= 1.0.11)
|
54
|
+
listen (0.6.0)
|
55
|
+
little-plugger (1.1.4)
|
56
|
+
logging (2.2.2)
|
57
|
+
little-plugger (~> 1.1)
|
58
|
+
multi_json (~> 1.10)
|
59
|
+
lumberjack (1.0.2)
|
60
|
+
method_source (0.8.1)
|
61
|
+
multi_json (1.12.2)
|
54
62
|
mustache (0.99.4)
|
55
|
-
|
56
|
-
|
63
|
+
pry (0.9.10)
|
64
|
+
coderay (~> 1.0.5)
|
65
|
+
method_source (~> 0.8)
|
66
|
+
slop (~> 3.3.1)
|
67
|
+
rack (1.6.8)
|
68
|
+
rake (10.0.2)
|
57
69
|
rdiscount (1.6.8)
|
58
|
-
|
59
|
-
|
60
|
-
rspec-
|
61
|
-
rspec-
|
62
|
-
|
63
|
-
rspec-
|
64
|
-
rspec-expectations (2.10.0)
|
70
|
+
rspec (2.12.0)
|
71
|
+
rspec-core (~> 2.12.0)
|
72
|
+
rspec-expectations (~> 2.12.0)
|
73
|
+
rspec-mocks (~> 2.12.0)
|
74
|
+
rspec-core (2.12.0)
|
75
|
+
rspec-expectations (2.12.0)
|
65
76
|
diff-lcs (~> 1.1.3)
|
66
|
-
rspec-mocks (2.
|
67
|
-
slim (1.
|
68
|
-
temple (~> 0.4
|
69
|
-
tilt (~> 1.3.
|
70
|
-
|
77
|
+
rspec-mocks (2.12.0)
|
78
|
+
slim (1.0.4)
|
79
|
+
temple (~> 0.3.4)
|
80
|
+
tilt (~> 1.3.2)
|
81
|
+
slop (3.3.3)
|
82
|
+
temple (0.3.5)
|
71
83
|
term-ansicolor (1.0.7)
|
72
|
-
thor (0.
|
73
|
-
tilt (1.3.
|
74
|
-
|
75
|
-
yard (0.8.2.1)
|
76
|
-
yard-cucumber (2.2.0)
|
77
|
-
cucumber (>= 0.7.5)
|
78
|
-
gherkin (>= 2.2.9)
|
79
|
-
yard (>= 0.8.1)
|
84
|
+
thor (0.16.0)
|
85
|
+
tilt (1.3.7)
|
86
|
+
tins (1.6.0)
|
80
87
|
|
81
88
|
PLATFORMS
|
82
89
|
ruby
|
83
|
-
x86-mingw32
|
84
90
|
|
85
91
|
DEPENDENCIES
|
86
92
|
aruba (= 0.4.5)
|
87
93
|
bundler (>= 1.0.14)
|
88
|
-
cucumber (
|
89
|
-
guard (
|
90
|
-
guard-cucumber (
|
91
|
-
guard-rspec (
|
94
|
+
cucumber (>= 1.0)
|
95
|
+
guard (>= 1.0.3)
|
96
|
+
guard-cucumber (>= 0.8)
|
97
|
+
guard-rspec (>= 0.7)
|
92
98
|
libnotify
|
93
99
|
rake (>= 0.8.7)
|
94
|
-
redcarpet (>= 1.17.2)
|
95
100
|
repo_manager!
|
96
101
|
rspec (>= 2.6.0)
|
97
102
|
win32console
|
98
|
-
|
99
|
-
|
103
|
+
|
104
|
+
BUNDLED WITH
|
105
|
+
1.16.0
|
data/HISTORY.markdown
CHANGED
@@ -7,6 +7,11 @@ Most recent changes are at the top
|
|
7
7
|
Changes
|
8
8
|
-------
|
9
9
|
|
10
|
+
### 0.7.3 - 12/21/2017 ###
|
11
|
+
|
12
|
+
* Update and remove dependencies with known security issues
|
13
|
+
* Add 'help --actions' and 'tasks --tasks --bare' to facilitate CLI completion of actions and tasks (BasicApp)
|
14
|
+
|
10
15
|
### 0.7.2 - 08/07/2012 ###
|
11
16
|
|
12
17
|
* Bugfix: correct add:asset task generating incorrect paths on Win32
|
data/LICENSE
CHANGED
data/README.markdown
CHANGED
@@ -53,7 +53,7 @@ Getting started with RepoManager
|
|
53
53
|
dependencies
|
54
54
|
|
55
55
|
git > 1.7
|
56
|
-
ruby 1.87
|
56
|
+
ruby > 1.87 && ruby < 2.0
|
57
57
|
|
58
58
|
installation via gem
|
59
59
|
|
@@ -168,9 +168,6 @@ bundle exec rake -T
|
|
168
168
|
|
169
169
|
rake build # Build repo_manager-0.7.1.gem into the pkg directory
|
170
170
|
rake cucumber # Run Cucumber features
|
171
|
-
rake doc:clean # Remove generated documenation
|
172
|
-
rake doc:generate # Generate YARD Documentation
|
173
|
-
rake doc:undocumented # List undocumented objects
|
174
171
|
rake gemfiles # Generate .gemfiles via 'git ls-files'
|
175
172
|
rake install # Build and install repo_manager-0.7.1.gem into system gems
|
176
173
|
rake release # Create tag v0.7.1 and build and push repo_manager-0.7.1.gem to Rubygems
|
data/Rakefile
CHANGED
@@ -35,33 +35,6 @@ task :test => [:spec, :cucumber]
|
|
35
35
|
|
36
36
|
task :default => :test
|
37
37
|
|
38
|
-
namespace :doc do
|
39
|
-
|
40
|
-
doc_version = File.open(File.join(File.dirname(__FILE__), 'VERSION'), "r") { |f| f.read }
|
41
|
-
project_root = File.expand_path(File.dirname(__FILE__))
|
42
|
-
doc_destination = File.join(project_root, 'rdoc')
|
43
|
-
|
44
|
-
require 'yard'
|
45
|
-
|
46
|
-
YARD::Rake::YardocTask.new(:generate) do |yt|
|
47
|
-
yt.options = ['--output-dir', doc_destination,
|
48
|
-
'--title', "RepoManager #{doc_version} Documentation",
|
49
|
-
'--main', "README.markdown"
|
50
|
-
]
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "Remove generated documenation"
|
54
|
-
task :clean do
|
55
|
-
rm_r doc_destination if File.exists?(doc_destination)
|
56
|
-
end
|
57
|
-
|
58
|
-
desc "List undocumented objects"
|
59
|
-
task :undocumented do
|
60
|
-
system('yard stats --list-undoc')
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
38
|
# put the gemfiles task in the bundler dependency chain
|
66
39
|
task :build => [:gemfiles]
|
67
40
|
task :install => [:gemfiles]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.3
|
@@ -149,10 +149,13 @@ Feature: Running an arbitrary git command
|
|
149
149
|
"""
|
150
150
|
test1
|
151
151
|
# On branch master
|
152
|
-
nothing to commit
|
152
|
+
nothing to commit
|
153
|
+
"""
|
154
|
+
And the output should contain:
|
155
|
+
"""
|
153
156
|
test2
|
154
157
|
# On branch master
|
155
|
-
nothing to commit
|
158
|
+
nothing to commit
|
156
159
|
"""
|
157
160
|
|
158
161
|
Scenario: Run 'git status --porcelain' on each repo with no changes shows nothing on stdout
|
@@ -265,9 +268,9 @@ Feature: Running an arbitrary git command
|
|
265
268
|
| new_stuff.txt | A | tmp/* |
|
266
269
|
When I run `repo commit -m 'automatic commit via repo_manager' --repos test1`
|
267
270
|
Then the exit status should be 0
|
268
|
-
And the output should
|
271
|
+
And the output should match:
|
269
272
|
"""
|
270
|
-
1 files changed, 1
|
273
|
+
1 files? changed, 1 insertion
|
271
274
|
"""
|
272
275
|
|
273
276
|
Scenario: Running a git command that is not whitelisted
|
@@ -51,3 +51,16 @@ Feature: Show help on actions
|
|
51
51
|
"""
|
52
52
|
invalid help action
|
53
53
|
"""
|
54
|
+
|
55
|
+
Scenario: Returning a list of actions for CLI completion
|
56
|
+
When I run `repo help --actions`
|
57
|
+
Then the exit status should be 0
|
58
|
+
And the output should contain:
|
59
|
+
"""
|
60
|
+
help
|
61
|
+
list
|
62
|
+
task
|
63
|
+
path
|
64
|
+
status
|
65
|
+
git
|
66
|
+
"""
|
@@ -80,6 +80,19 @@ Feature: Invoke external tasks, normally Thor tasks.
|
|
80
80
|
repo test:init
|
81
81
|
"""
|
82
82
|
|
83
|
+
Scenario: Listings available tasks bare for Bash completion
|
84
|
+
When I run `repo task --tasks --bare`
|
85
|
+
Then the exit status should be 0
|
86
|
+
And the output should not contain:
|
87
|
+
"""
|
88
|
+
repo test:init
|
89
|
+
"""
|
90
|
+
And the output should match:
|
91
|
+
"""
|
92
|
+
test:init
|
93
|
+
repo_manager:test_b:hello
|
94
|
+
"""
|
95
|
+
|
83
96
|
Scenario: Show help for a given task
|
84
97
|
When I run `repo task help test:init`
|
85
98
|
Then the exit status should be 0
|
@@ -12,6 +12,7 @@ module RepoManager
|
|
12
12
|
|
13
13
|
# An abstract superclass for basic action functionality
|
14
14
|
class BaseAction
|
15
|
+
|
15
16
|
# main configuration hash
|
16
17
|
attr_reader :configuration
|
17
18
|
|
@@ -33,11 +34,11 @@ class BaseAction
|
|
33
34
|
# bin wrapper option parser object
|
34
35
|
attr_accessor :option_parser
|
35
36
|
|
36
|
-
def initialize(args=[],
|
37
|
-
@configuration =
|
38
|
-
@options = configuration[:options] || {}
|
39
|
-
@args = args
|
40
|
-
logger.debug "initialize with args: #{args.inspect}"
|
37
|
+
def initialize(args=[], config={})
|
38
|
+
@configuration = config.deep_clone
|
39
|
+
@options = @configuration[:options] || {}
|
40
|
+
@args = args.dup
|
41
|
+
logger.debug "initialize with args: #{@args.inspect}"
|
41
42
|
end
|
42
43
|
|
43
44
|
# Parse generic action options for all decendant actions
|
@@ -46,7 +47,7 @@ def initialize(args=[], configuration={})
|
|
46
47
|
def parse_options(parser_configuration = {})
|
47
48
|
raise_on_invalid_option = parser_configuration.has_key?(:raise_on_invalid_option) ? parser_configuration[:raise_on_invalid_option] : true
|
48
49
|
parse_base_options = parser_configuration.has_key?(:parse_base_options) ? parser_configuration[:parse_base_options] : true
|
49
|
-
logger.debug "
|
50
|
+
logger.debug "parsing args: #{@args.inspect}, raise_on_invalid_option: #{raise_on_invalid_option}, parse_base_options: #{parse_base_options}"
|
50
51
|
|
51
52
|
@option_parser ||= OptionParser.new
|
52
53
|
|
@@ -89,9 +90,9 @@ def parse_options(parser_configuration = {})
|
|
89
90
|
# (first pass doesn't know about action specific options), find all
|
90
91
|
# action options that may come after the action/subcommand (options
|
91
92
|
# before subcommand have already been processed) and its args
|
92
|
-
logger.debug "
|
93
|
+
logger.debug "args before reprocessing: #{@args.inspect}"
|
93
94
|
begin
|
94
|
-
option_parser.order!(args)
|
95
|
+
option_parser.order!(@args)
|
95
96
|
rescue OptionParser::InvalidOption => e
|
96
97
|
if raise_on_invalid_option
|
97
98
|
puts "option error: #{e}"
|
@@ -100,18 +101,18 @@ def parse_options(parser_configuration = {})
|
|
100
101
|
else
|
101
102
|
# parse and consume until we hit an unknown option (not arg), put it back so it
|
102
103
|
# can be shifted into the new array
|
103
|
-
e.recover(args)
|
104
|
+
e.recover(@args)
|
104
105
|
end
|
105
106
|
end
|
106
|
-
logger.debug "
|
107
|
+
logger.debug "args before unknown collection: #{@args.inspect}"
|
107
108
|
|
108
109
|
unknown_args = []
|
109
|
-
while unknown_arg = args.shift
|
110
|
-
logger.debug "
|
110
|
+
while unknown_arg = @args.shift
|
111
|
+
logger.debug "unknown_arg: #{unknown_arg.inspect}"
|
111
112
|
unknown_args << unknown_arg
|
112
113
|
begin
|
113
114
|
# consume options and stop at an arg
|
114
|
-
option_parser.order!(args)
|
115
|
+
option_parser.order!(@args)
|
115
116
|
rescue OptionParser::InvalidOption => e
|
116
117
|
if raise_on_invalid_option
|
117
118
|
puts "option error: #{e}"
|
@@ -120,14 +121,16 @@ def parse_options(parser_configuration = {})
|
|
120
121
|
else
|
121
122
|
# parse and consume until we hit an unknown option (not arg), put it back so it
|
122
123
|
# can be shifted into the new array
|
123
|
-
e.recover(args)
|
124
|
+
e.recover(@args)
|
124
125
|
end
|
125
126
|
end
|
126
127
|
end
|
127
|
-
logger.debug "
|
128
|
+
logger.debug "args after unknown collection: #{@args.inspect}"
|
128
129
|
|
129
130
|
@args = unknown_args.dup
|
130
|
-
logger.debug "
|
131
|
+
logger.debug "args after reprocessing: #{@args.inspect}"
|
132
|
+
logger.debug "configuration after reprocessing: #{@configuration.inspect}"
|
133
|
+
logger.debug "options after reprocessing: #{@options.inspect}"
|
131
134
|
|
132
135
|
option_parser
|
133
136
|
end
|
@@ -156,7 +159,7 @@ def write_to_output(content)
|
|
156
159
|
logger.info "existing file not overwritten. To overwrite automatically, use the '--force' option."
|
157
160
|
end
|
158
161
|
else
|
159
|
-
logger.debug "
|
162
|
+
logger.debug "writing to STDOUT"
|
160
163
|
print content
|
161
164
|
end
|
162
165
|
return 0
|
@@ -181,7 +184,7 @@ def asset_type
|
|
181
184
|
# asset options separated from assets to make it easier to override assets
|
182
185
|
def asset_options
|
183
186
|
# include all base action options
|
184
|
-
result = options.
|
187
|
+
result = options.deep_clone
|
185
188
|
|
186
189
|
# anything left on the command line should be filters as all options have
|
187
190
|
# been consumed, for pass through options, filters must be ignored by overwritting them
|
@@ -213,10 +216,10 @@ def items
|
|
213
216
|
#
|
214
217
|
# @return [String] suitable for displaying on STDOUT or writing to a file
|
215
218
|
def render(view_options=configuration)
|
216
|
-
logger.debug "
|
219
|
+
logger.debug "rendering"
|
217
220
|
result = ""
|
218
221
|
if template
|
219
|
-
logger.debug "
|
222
|
+
logger.debug "rendering with template : #{template}"
|
220
223
|
view = AppView.new(items, view_options)
|
221
224
|
view.template = template
|
222
225
|
result = view.render
|
@@ -225,7 +228,7 @@ def render(view_options=configuration)
|
|
225
228
|
result += "\n" unless index == 0
|
226
229
|
result += item.name.green + ":\n"
|
227
230
|
if item.respond_to?(:attributes)
|
228
|
-
attributes = item.attributes.
|
231
|
+
attributes = item.attributes.deep_clone
|
229
232
|
result += attributes.recursively_stringify_keys!.to_conf.gsub(/\s+$/, '') # strip trailing whitespace from YAML
|
230
233
|
result += "\n"
|
231
234
|
end
|