cider_ci-support 1.1.0.pre.beta.3 → 1.1.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +83 -0
- data/Rakefile +1 -2
- data/bin/cider-ci_coverage +131 -124
- data/bin/cider-ci_flay +20 -27
- data/bin/cider-ci_flog +24 -34
- data/cider_ci-support.gemspec +15 -15
- data/lib/cider_ci/support.rb +1 -1
- data/lib/cider_ci/support/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11d24ff036b756f6464c54c8a3e5d99666b5ffce
|
4
|
+
data.tar.gz: c0a3b182202113a11272f484d2ecc2f944452e30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b01c64889c9a6039464e2e89e48d64e3ed43340cff565b631c108bf16661bff9a3e8fc255feff63bd3b51d8b6fc8deebd76ccc8d7f143ff286ef77cceec234b2
|
7
|
+
data.tar.gz: 0447a5befd8d1dbd11a82ec71cbd599e9aaf8bd644b86149db237293de4e06c7101d345feb10b0960bfc86c18d1b76b32df770587b0a92ac8ac0d3b085452b39
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2015-01-06 15:11:15 +0100 using RuboCop version 0.28.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 7
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Max: 50
|
11
|
+
|
12
|
+
# Offense count: 9
|
13
|
+
# Configuration parameters: CountComments.
|
14
|
+
Metrics/MethodLength:
|
15
|
+
Max: 29
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
Style/AccessorMethodName:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
# Offense count: 2
|
22
|
+
Style/ClassAndModuleCamelCase:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
# Offense count: 2
|
26
|
+
Style/Documentation:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# Offense count: 3
|
30
|
+
# Configuration parameters: Exclude.
|
31
|
+
Style/FileName:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
# Offense count: 1
|
35
|
+
# Configuration parameters: MinBodyLength.
|
36
|
+
Style/GuardClause:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
# Offense count: 1
|
40
|
+
# Configuration parameters: MaxLineLength.
|
41
|
+
Style/IfUnlessModifier:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
# Offense count: 5
|
45
|
+
Style/MultilineBlockChain:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
# Offense count: 2
|
49
|
+
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
50
|
+
Style/Next:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
# Offense count: 1
|
54
|
+
Style/RescueModifier:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
# Offense count: 7
|
58
|
+
# Cop supports --auto-correct.
|
59
|
+
# Configuration parameters: AllowAsExpressionSeparator.
|
60
|
+
Style/Semicolon:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
# Offense count: 1
|
64
|
+
# Cop supports --auto-correct.
|
65
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
66
|
+
Style/SignalException:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
# Offense count: 1
|
70
|
+
# Cop supports --auto-correct.
|
71
|
+
Style/SpecialGlobalVars:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
# Offense count: 1
|
75
|
+
# Cop supports --auto-correct.
|
76
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
77
|
+
Style/StringLiterals:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
# Offense count: 1
|
81
|
+
# Cop supports --auto-correct.
|
82
|
+
Style/TrailingWhitespace:
|
83
|
+
Enabled: false
|
data/Rakefile
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/cider-ci_coverage
CHANGED
@@ -8,8 +8,7 @@
|
|
8
8
|
#
|
9
9
|
###############################################################################
|
10
10
|
|
11
|
-
|
12
|
-
# Planned features for the future:
|
11
|
+
# Planned features for the future:
|
13
12
|
#
|
14
13
|
# * upload result to cider-ci (attachments to the tree_id)
|
15
14
|
|
@@ -23,45 +22,44 @@ require 'thread/pool'
|
|
23
22
|
require 'mime/types'
|
24
23
|
require 'open-uri'
|
25
24
|
|
26
|
-
#require 'pry'
|
27
|
-
|
28
25
|
###############################################################################
|
29
26
|
# Download from Cider-CI
|
30
27
|
###############################################################################
|
31
28
|
|
32
|
-
def connect
|
33
|
-
|
34
|
-
conn.basic_auth(username,password)
|
35
|
-
conn.ssl.verify= false
|
29
|
+
def connect(base_url, username, password)
|
30
|
+
JSON_ROA::Client.connect base_url do |conn|
|
31
|
+
conn.basic_auth(username, password)
|
32
|
+
conn.ssl.verify = false
|
36
33
|
end
|
37
34
|
end
|
38
35
|
|
39
|
-
def get_execution_resource
|
40
|
-
root.relation('execution').get('id' => execution_id
|
41
|
-
end
|
36
|
+
def get_execution_resource(root, execution_id)
|
37
|
+
root.relation('execution').get('id' => execution_id)
|
38
|
+
end
|
42
39
|
|
43
|
-
def get_and_convert_resultset_attachments
|
44
|
-
print
|
40
|
+
def get_and_convert_resultset_attachments(root, tree_id, thread_pool_size)
|
41
|
+
print 'download_resultset_attachments'; STDOUT.flush
|
45
42
|
pool = Thread.pool thread_pool_size
|
46
|
-
root.relation(
|
47
|
-
.map(&:get).map do |execution|
|
48
|
-
execution.relation('tasks').get(
|
43
|
+
root.relation('executions').get('treeid' => tree_id).collection \
|
44
|
+
.map(&:get).map do |execution|
|
45
|
+
execution.relation('tasks').get('state' => 'passed').collection\
|
49
46
|
.map do |task_relation|
|
50
|
-
Thread.future pool do
|
51
|
-
print
|
52
|
-
task_relation.get
|
53
|
-
.get(
|
54
|
-
print
|
47
|
+
Thread.future pool do
|
48
|
+
print '.'; STDOUT.flush
|
49
|
+
task_relation.get.relation('trials') \
|
50
|
+
.get('state' => 'passed').collection.map(&:get).map do |trial|
|
51
|
+
print '.'; STDOUT.flush
|
55
52
|
trial.relation('trial-attachments') \
|
56
53
|
.get.collection.map do |tar|
|
57
|
-
trial_attachment_resource= tar.get
|
58
|
-
print
|
59
|
-
if (working_dir= trial.data['scripts'] \
|
60
|
-
.map{|
|
61
|
-
|
62
|
-
print
|
63
|
-
resultset= trial_attachment_resource \
|
64
|
-
|
54
|
+
trial_attachment_resource = tar.get
|
55
|
+
print '.'; STDOUT.flush
|
56
|
+
if (working_dir = trial.data['scripts'] \
|
57
|
+
.map { |_k, v| v['working_dir'] }.compact.first) \
|
58
|
+
&& (trial_attachment_resource.data['path'] =~ /resultset\.json/)
|
59
|
+
print '*'; STDOUT.flush
|
60
|
+
resultset = trial_attachment_resource \
|
61
|
+
.relation('trial-attachment-data-stream') \
|
62
|
+
.get.response.body
|
65
63
|
convert_resultset resultset, working_dir
|
66
64
|
end
|
67
65
|
end
|
@@ -71,104 +69,97 @@ def get_and_convert_resultset_attachments root, tree_id, thread_pool_size
|
|
71
69
|
end.flatten.compact
|
72
70
|
end
|
73
71
|
|
74
|
-
|
75
72
|
###############################################################################
|
76
|
-
# Upload
|
73
|
+
# Upload
|
77
74
|
###############################################################################
|
78
75
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
if content_type
|
85
|
-
|
86
|
-
root.relation(
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
print "*"; STDOUT.flush
|
76
|
+
def upload_as_tree_attachments(root, tree_id)
|
77
|
+
print 'upload_as_tree_attachments'; STDOUT.flush
|
78
|
+
|
79
|
+
Dir.glob('coverage/**/*').each do |filename|
|
80
|
+
content_type = MIME::Types.of(filename).first.content_type rescue nil
|
81
|
+
if content_type
|
82
|
+
Faraday::UploadIO.new(filename, content_type)
|
83
|
+
root.relation('tree-attachment-data-stream').put(
|
84
|
+
{ 'treeid' => tree_id, 'path' => filename },
|
85
|
+
File.open(filename, 'rb').read, 'content-type' => content_type)
|
86
|
+
print '*'; STDOUT.flush
|
91
87
|
end
|
92
88
|
end
|
93
|
-
puts
|
89
|
+
puts ''
|
94
90
|
end
|
95
91
|
|
96
|
-
|
97
92
|
###############################################################################
|
98
93
|
# Simplev cov
|
99
94
|
###############################################################################
|
100
95
|
|
101
|
-
|
102
|
-
def convert_resultset resultset, working_dir
|
96
|
+
def convert_resultset(resultset, working_dir)
|
103
97
|
SimpleCov::JSON.parse(resultset.to_json).map do |command_name, data|
|
104
|
-
[
|
98
|
+
[command_name, data.map do |k, v|
|
105
99
|
case k
|
106
|
-
when
|
107
|
-
[
|
108
|
-
[(FileUtils.pwd + filename[working_dir.length,filename.length]) \
|
100
|
+
when 'coverage'
|
101
|
+
[k, v.map do |filename, file_coverage|
|
102
|
+
[(FileUtils.pwd + filename[working_dir.length, filename.length]) \
|
109
103
|
, file_coverage]
|
110
|
-
end.instance_eval{Hash[self]}
|
111
|
-
else
|
112
|
-
[k,v]
|
104
|
+
end.instance_eval { Hash[self] }]
|
105
|
+
else
|
106
|
+
[k, v]
|
113
107
|
end
|
114
|
-
end.instance_eval {Hash[self]}
|
115
|
-
end.instance_eval{Hash[self]}.instance_eval
|
108
|
+
end.instance_eval { Hash[self] }]
|
109
|
+
end.instance_eval { Hash[self] }.instance_eval do
|
110
|
+
SimpleCov::Result.from_hash(self)
|
111
|
+
end
|
116
112
|
end
|
117
113
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
resultsets.reduce({}) do |agg,resultset|
|
114
|
+
def reduce_resultsets(resultsets)
|
115
|
+
puts 'reduce_resultsets'
|
116
|
+
resultsets.reduce({}) do |agg, resultset|
|
122
117
|
resultset.original_result.merge_resultset(agg)
|
123
118
|
end
|
124
119
|
end
|
125
120
|
|
126
|
-
|
127
121
|
def init_simple_cov
|
128
|
-
SimpleCov.add_group
|
129
|
-
SimpleCov.add_group
|
130
|
-
SimpleCov.add_group
|
131
|
-
SimpleCov.add_group
|
132
|
-
SimpleCov.add_group
|
133
|
-
SimpleCov.add_group
|
122
|
+
SimpleCov.add_group 'Models', 'app/models'
|
123
|
+
SimpleCov.add_group 'Controllers', 'app/controllers'
|
124
|
+
SimpleCov.add_group 'Views', 'app/views'
|
125
|
+
SimpleCov.add_group 'Helpers', 'app/helpers'
|
126
|
+
SimpleCov.add_group 'Factories', 'factories'
|
127
|
+
SimpleCov.add_group 'Libraries', 'app/lib'
|
134
128
|
end
|
135
129
|
|
136
|
-
|
137
130
|
###############################################################################
|
138
131
|
# Run
|
139
132
|
###############################################################################
|
140
133
|
|
141
|
-
def run_coverage
|
142
|
-
get_and_convert_resultset_attachments(
|
143
|
-
.instance_eval do
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
134
|
+
def run_coverage(root, tree_id, thrad_pool_size)
|
135
|
+
get_and_convert_resultset_attachments(
|
136
|
+
root, tree_id, thrad_pool_size).instance_eval do
|
137
|
+
reduce_resultsets self
|
138
|
+
end.instance_eval do
|
139
|
+
if self.empty?
|
140
|
+
fail ScriptError, 'the collected and reduced coverage result is empty'
|
141
|
+
end
|
142
|
+
init_simple_cov
|
143
|
+
SimpleCov::Result.new self
|
144
|
+
end.instance_eval do
|
145
|
+
SimpleCov::Formatter::HTMLFormatter.new.format self
|
146
|
+
self
|
147
|
+
end
|
153
148
|
end
|
154
149
|
|
155
|
-
|
156
150
|
###############################################################################
|
157
151
|
# Options, main ....
|
158
152
|
###############################################################################
|
159
153
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
optparse = OptionParser.new do |opts|
|
165
|
-
opts.banner = "Usage: cider-ci_coverage"
|
154
|
+
def parse_options(options)
|
155
|
+
OptionParser.new do |opts|
|
156
|
+
opts.banner = 'Usage: cider-ci_coverage'
|
166
157
|
|
167
158
|
opts.on('-a', '--api-url API-URL') do |url|
|
168
|
-
options.api_url= url
|
159
|
+
options.api_url = url
|
169
160
|
end
|
170
161
|
|
171
|
-
opts.on('-e', '--execution EXECUTION_ID',
|
162
|
+
opts.on('-e', '--execution EXECUTION_ID',
|
172
163
|
'Execution ID to retrieve coverage for') do |exid|
|
173
164
|
options.execution_id = exid
|
174
165
|
end
|
@@ -182,34 +173,32 @@ def parse_options options
|
|
182
173
|
end
|
183
174
|
|
184
175
|
opts.on('-p', '--password PASSWORD', String) do |p|
|
185
|
-
options.password= p
|
176
|
+
options.password = p
|
186
177
|
end
|
187
178
|
|
188
|
-
opts.on('-u', '--upload') do
|
189
|
-
options.upload= true
|
179
|
+
opts.on('-u', '--upload') do
|
180
|
+
options.upload = true
|
190
181
|
end
|
191
182
|
|
192
183
|
opts.on('-l', '--limit N', Integer) do |l|
|
193
|
-
options.limit= l
|
184
|
+
options.limit = l
|
194
185
|
end
|
195
|
-
|
196
186
|
end.parse!
|
197
187
|
|
198
188
|
options
|
199
189
|
end
|
200
190
|
|
201
|
-
|
202
|
-
def assert_correct_tree_id execution
|
191
|
+
def assert_correct_tree_id(execution)
|
203
192
|
if execution.data['tree_id'] != `git log -n 1 --pretty=%T`.strip
|
204
|
-
|
193
|
+
fail ScriptError, 'you must be on the same tree_id as the execution'
|
205
194
|
end
|
206
195
|
end
|
207
196
|
|
208
197
|
def get_current_tree_id
|
209
|
-
begin
|
210
|
-
tree_id= `"git" "log" "-n" "1" "--pretty=%T"`.strip
|
198
|
+
begin
|
199
|
+
tree_id = `"git" "log" "-n" "1" "--pretty=%T"`.strip
|
211
200
|
rescue _
|
212
|
-
raise ScriptError,
|
201
|
+
raise ScriptError, 'could not determine the current tree_id'
|
213
202
|
end
|
214
203
|
|
215
204
|
if $?.exitstatus != 0
|
@@ -221,36 +210,54 @@ end
|
|
221
210
|
|
222
211
|
def main
|
223
212
|
options = OpenStruct.new
|
224
|
-
options.thread_pool_size= 50
|
225
|
-
options.username= ENV['CIDER_CI_USERNAME']
|
226
|
-
options.password= ENV['CIDER_CI_PASSWORD']
|
227
|
-
options.api_url= ENV['CIDER_CI_API_URL']
|
228
|
-
options.upload= false
|
229
|
-
options.limit= 95
|
213
|
+
options.thread_pool_size = 50
|
214
|
+
options.username = ENV['CIDER_CI_USERNAME']
|
215
|
+
options.password = ENV['CIDER_CI_PASSWORD']
|
216
|
+
options.api_url = ENV['CIDER_CI_API_URL']
|
217
|
+
options.upload = false
|
218
|
+
options.limit = 95
|
230
219
|
parse_options options
|
231
|
-
options.api_url ||
|
232
|
-
,
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
220
|
+
options.api_url || fail(OptionParser::MissingArgument \
|
221
|
+
, 'api_url is required, set CIDER_CI_API_URL \
|
222
|
+
or provide -a option')
|
223
|
+
options.username || fail(OptionParser::MissingArgument \
|
224
|
+
, 'username is required, set CIDER_CI_USERNAME')
|
225
|
+
options.password || fail(OptionParser::MissingArgument \
|
226
|
+
, 'password is required, set CIDER_CI_PASSWORD')
|
227
|
+
|
228
|
+
root = connect(options.api_url, options.username, options.password).get
|
229
|
+
tree_id = get_current_tree_id
|
240
230
|
FileUtils.rm_rf('coverage')
|
241
|
-
result= run_coverage root, tree_id, options.thread_pool_size
|
242
|
-
if options.upload
|
243
|
-
upload_as_tree_attachments root, tree_id
|
244
|
-
end
|
231
|
+
result = run_coverage root, tree_id, options.thread_pool_size
|
232
|
+
upload_as_tree_attachments root, tree_id if options.upload
|
245
233
|
|
246
|
-
coverage= (result.covered_lines / result.total_lines.to_f)
|
234
|
+
coverage = (result.covered_lines / result.total_lines.to_f)
|
247
235
|
|
248
|
-
|
249
|
-
|
250
|
-
|
236
|
+
write_result_json coverage, options.limit
|
237
|
+
|
238
|
+
if passed? coverage, options.limit
|
251
239
|
exit
|
240
|
+
else
|
241
|
+
abort("FAILED coverage at #{per_cent(coverage)}% is \
|
242
|
+
below limit of #{options.limit}% ")
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
def write_result_json(coverage, limit)
|
247
|
+
result_message = passed?(coverage, limit) ? 'passed' : 'failed'
|
248
|
+
File.open('result.json', 'w') do |file|
|
249
|
+
file.write({ value: coverage,
|
250
|
+
summary: "#{result_message} with #{per_cent(coverage)}%"
|
251
|
+
}.to_json)
|
252
252
|
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def passed?(coverage, limit)
|
256
|
+
coverage > limit / 100.0
|
257
|
+
end
|
253
258
|
|
259
|
+
def per_cent(relative_value)
|
260
|
+
(relative_value * 100.0).round(2)
|
254
261
|
end
|
255
262
|
|
256
|
-
main
|
263
|
+
main
|
data/bin/cider-ci_flay
CHANGED
@@ -15,60 +15,53 @@ require 'pry'
|
|
15
15
|
#
|
16
16
|
###############################################################################
|
17
17
|
|
18
|
-
|
19
18
|
###############################################################################
|
20
19
|
# Options, main ....
|
21
20
|
###############################################################################
|
22
21
|
|
22
|
+
def parse_options(options)
|
23
|
+
OptionParser.new do |opts|
|
24
|
+
opts.banner = 'Usage: cider-ci_flay FILE/DIR ...'
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
optparse = OptionParser.new do |opts|
|
27
|
-
opts.banner = "Usage: cider-ci_flay FILE/DIR ..."
|
28
|
-
|
29
|
-
opts.on('-d', '--print-details') do
|
30
|
-
options.print_details= true
|
26
|
+
opts.on('-d', '--print-details') do
|
27
|
+
options.print_details = true
|
31
28
|
end
|
32
29
|
|
33
30
|
opts.on('-m', '--mass MASS', Integer,
|
34
|
-
|
35
|
-
options.mass= n
|
31
|
+
"See flay documentation, default #{options.mass}.") do |n|
|
32
|
+
options.mass = n
|
36
33
|
end
|
37
|
-
|
38
34
|
end.parse!
|
39
35
|
|
40
36
|
options
|
41
37
|
end
|
42
38
|
|
43
|
-
|
44
39
|
def main
|
45
40
|
options = OpenStruct.new
|
46
|
-
options.print_details= false
|
47
|
-
options.mass= 16
|
41
|
+
options.print_details = false
|
42
|
+
options.mass = 16
|
48
43
|
parse_options options
|
49
44
|
|
50
|
-
flay_options= Flay.default_options.merge(
|
45
|
+
flay_options = Flay.default_options.merge(
|
51
46
|
mass: options.mass
|
52
|
-
|
53
|
-
|
47
|
+
)
|
48
|
+
|
54
49
|
flay = Flay.new flay_options
|
55
50
|
files = Flay.expand_dirs_to_files(*ARGV)
|
56
51
|
|
57
|
-
abort
|
52
|
+
abort 'No files are selected' if files.empty?
|
58
53
|
|
59
54
|
flay.process(*files)
|
60
|
-
offending= flay.analyze
|
55
|
+
offending = flay.analyze
|
61
56
|
|
62
|
-
if offending.empty?
|
63
|
-
$stdout.puts
|
64
|
-
exit
|
57
|
+
if offending.empty?
|
58
|
+
$stdout.puts 'cider-ci_flay OK'
|
59
|
+
exit
|
65
60
|
else
|
66
|
-
$stderr.puts
|
61
|
+
$stderr.puts 'cider-ci_flay FAILED:'
|
67
62
|
flay.report $stderr
|
68
|
-
abort
|
63
|
+
abort
|
69
64
|
end
|
70
|
-
|
71
65
|
end
|
72
66
|
|
73
|
-
main
|
74
|
-
|
67
|
+
main
|
data/bin/cider-ci_flog
CHANGED
@@ -8,78 +8,68 @@ require 'flog'
|
|
8
8
|
|
9
9
|
# require 'pry'
|
10
10
|
|
11
|
-
|
12
11
|
###############################################################################
|
13
|
-
#
|
12
|
+
#
|
14
13
|
# Static complexity code analysis based on flog.
|
15
14
|
#
|
16
15
|
# Author: Thomas Schank <DrTom@schank.ch>
|
17
16
|
#
|
18
17
|
###############################################################################
|
19
18
|
|
20
|
-
|
21
19
|
###############################################################################
|
22
20
|
# Options, main ....
|
23
21
|
###############################################################################
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
optparse = OptionParser.new do |opts|
|
29
|
-
opts.banner = "Usage: cider-ci_flog FILE/DIR ..."
|
23
|
+
def parse_options(options)
|
24
|
+
OptionParser.new do |opts|
|
25
|
+
opts.banner = 'Usage: cider-ci_flog FILE/DIR ...'
|
30
26
|
|
31
27
|
opts.on('-l', '--limit N', Integer) do |l|
|
32
|
-
options.limit= l
|
28
|
+
options.limit = l
|
33
29
|
end
|
34
30
|
|
35
|
-
opts.on('-d', '--print-details') do
|
36
|
-
options.print_details= true
|
31
|
+
opts.on('-d', '--print-details') do
|
32
|
+
options.print_details = true
|
37
33
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
34
|
end.parse!
|
42
35
|
|
43
36
|
options
|
44
37
|
end
|
45
38
|
|
46
|
-
|
47
39
|
def main
|
48
40
|
options = OpenStruct.new
|
49
|
-
options.limit= 30
|
50
|
-
options.print_details= false
|
41
|
+
options.limit = 30
|
42
|
+
options.print_details = false
|
51
43
|
|
52
44
|
parse_options options
|
53
45
|
|
54
|
-
files= FlogCLI.expand_dirs_to_files ARGV
|
46
|
+
files = FlogCLI.expand_dirs_to_files ARGV
|
55
47
|
|
56
|
-
abort
|
48
|
+
abort 'No files are selected' if files.empty?
|
57
49
|
|
58
50
|
flog_options = FlogCLI.parse_options []
|
59
|
-
flogger= Flog.new flog_options
|
60
|
-
flogger.flog
|
51
|
+
flogger = Flog.new flog_options
|
52
|
+
flogger.flog(*files)
|
61
53
|
|
62
|
-
offending= flogger.totals \
|
63
|
-
|
64
|
-
|
54
|
+
offending = flogger.totals \
|
55
|
+
.select { |_k, v| v > options.limit } \
|
56
|
+
.sort_by { |_k, v| -v }
|
65
57
|
|
66
|
-
if offending.empty?
|
67
|
-
$stdout.puts
|
68
|
-
exit
|
58
|
+
if offending.empty?
|
59
|
+
$stdout.puts 'cider-ci_flog OK'
|
60
|
+
exit
|
69
61
|
else
|
70
|
-
$stderr.puts
|
62
|
+
$stderr.puts 'cider-ci_flog FAILED:'
|
71
63
|
offending.each do |offender|
|
72
|
-
$stderr.puts
|
64
|
+
$stderr.puts '' if options.print_details
|
73
65
|
|
74
66
|
$stderr.puts "#{offender[1].round} #{offender[0]}"
|
75
|
-
if options.print_details
|
67
|
+
if options.print_details
|
76
68
|
$stderr.puts flogger.calls[offender[0]].to_yaml
|
77
69
|
end
|
78
70
|
end
|
79
|
-
abort
|
71
|
+
abort
|
80
72
|
end
|
81
|
-
|
82
73
|
end
|
83
74
|
|
84
|
-
main
|
85
|
-
|
75
|
+
main
|
data/cider_ci-support.gemspec
CHANGED
@@ -4,26 +4,26 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'cider_ci/support/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'cider_ci-support'
|
8
8
|
spec.version = Cider_CI::Support::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ['Thomas Schank']
|
10
|
+
spec.email = ['DrTom@schank.ch']
|
11
|
+
spec.summary = 'Cider-CI support for Ruby and Ruby on Rails projects'
|
12
|
+
spec.description = ''
|
13
|
+
spec.homepage = 'https://github.com/cider-ci/cider-ci_ruby-support'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(
|
18
|
-
spec.test_files = spec.files.grep(
|
19
|
-
spec.require_paths = [
|
17
|
+
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)/)
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
23
|
|
24
|
-
spec.add_runtime_dependency 'flay',
|
25
|
-
spec.add_runtime_dependency 'flog',
|
26
|
-
spec.add_runtime_dependency 'json_roa-client',
|
24
|
+
spec.add_runtime_dependency 'flay', '~> 2.5.0'
|
25
|
+
spec.add_runtime_dependency 'flog', '~> 4.3.0'
|
26
|
+
spec.add_runtime_dependency 'json_roa-client', '>= 1.0.0.pre.beta.2'
|
27
27
|
spec.add_runtime_dependency 'mime-types'
|
28
28
|
spec.add_runtime_dependency 'simplecov', '~> 0.9'
|
29
29
|
spec.add_runtime_dependency 'thread', '= 0.1.4'
|
data/lib/cider_ci/support.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cider_ci-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Schank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,6 +133,7 @@ extensions: []
|
|
133
133
|
extra_rdoc_files: []
|
134
134
|
files:
|
135
135
|
- ".gitignore"
|
136
|
+
- ".rubocop.yml"
|
136
137
|
- Gemfile
|
137
138
|
- LICENSE.txt
|
138
139
|
- README.md
|
@@ -158,9 +159,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
159
|
version: '0'
|
159
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
161
|
requirements:
|
161
|
-
- - "
|
162
|
+
- - ">="
|
162
163
|
- !ruby/object:Gem::Version
|
163
|
-
version:
|
164
|
+
version: '0'
|
164
165
|
requirements: []
|
165
166
|
rubyforge_project:
|
166
167
|
rubygems_version: 2.2.2
|
@@ -168,3 +169,4 @@ signing_key:
|
|
168
169
|
specification_version: 4
|
169
170
|
summary: Cider-CI support for Ruby and Ruby on Rails projects
|
170
171
|
test_files: []
|
172
|
+
has_rdoc:
|