dev 2.0.268 → 2.0.269
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dev +1 -1
- data/lib/base/array.rb +34 -4
- data/lib/base/command.rb +101 -12
- data/lib/base/dir.rb +14 -8
- data/lib/base/environment.rb +169 -52
- data/lib/base/gemspec.rb +10 -2
- data/lib/base/history.rb +26 -1
- data/lib/base/project.rb +237 -121
- data/lib/base/projects.rb +130 -66
- data/lib/base/timeout.rb +54 -16
- data/lib/base/version.rb +54 -0
- data/lib/commands.rb +4 -2
- data/lib/dev.rb +50 -44
- data/lib/tasks.rb +20 -12
- data/lib/tasks/add.rb +8 -8
- data/lib/tasks/analyze.rb +1 -1
- data/lib/tasks/build.rb +25 -9
- data/lib/tasks/commit.rb +7 -7
- data/lib/tasks/default.rb +7 -1
- data/lib/tasks/doc.rb +1 -1
- data/lib/tasks/publish.rb +7 -11
- data/lib/tasks/pull.rb +1 -4
- data/lib/tasks/push.rb +2 -2
- data/lib/tasks/setup.rb +36 -15
- data/lib/tasks/test.rb +4 -5
- data/lib/tasks/update.rb +2 -2
- metadata +5 -5
data/lib/base/gemspec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
puts __FILE__ if defined?(DEBUG)
|
2
|
-
|
2
|
+
require_relative('command.rb')
|
3
3
|
|
4
4
|
class Gemspec
|
5
5
|
def self.update gemspec_file
|
@@ -19,11 +19,19 @@ class Gemspec
|
|
19
19
|
return spec.version.to_s
|
20
20
|
end
|
21
21
|
|
22
|
+
def self.latest_published_version gemname
|
23
|
+
scan=`gem list -r #{gemname}`.scan(/^dev\s*\(([\d.]+)\)/)
|
24
|
+
if(!scan.nil?)
|
25
|
+
return scan[0][0] if(scan.length > 0 && !scan[0].nil? && scan[0].length > 0)
|
26
|
+
end
|
27
|
+
''
|
28
|
+
end
|
29
|
+
|
22
30
|
def self.published_version gemspec_file
|
23
31
|
published_version=''
|
24
32
|
spec=Gem::Specification.load(gemspec_file)
|
25
33
|
begin
|
26
|
-
published_version = `gem list -r #{spec.name}`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
|
34
|
+
published_version = latest_published_version spec.name# `gem list -r #{spec.name}`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
|
27
35
|
rescue
|
28
36
|
published_version=''
|
29
37
|
end
|
data/lib/base/history.rb
CHANGED
@@ -8,7 +8,32 @@ class History
|
|
8
8
|
@dev=Dev.new if @dev.nil?
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
# .0. for 0 exit codes
|
12
|
+
# .X. for non 0 exit codes
|
13
|
+
# project name is contained in directory name
|
14
|
+
def get_commands pattern
|
15
|
+
commands=Array.new
|
16
|
+
Dir.chdir(@dev.log_dir) do
|
17
|
+
Dir.glob("*#{pattern.gsub('/','-')}*.*").each{|logfile|
|
18
|
+
commands << Command.new(JSON.parse(IO.read(logfile)))
|
19
|
+
}
|
20
|
+
end
|
21
|
+
commands
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_command command
|
25
|
+
code="0"
|
26
|
+
code="X" if command[:exit_code] !=0
|
27
|
+
directory=command[:directory].gsub(@dev.root_dir,'').gsub('/','-')
|
28
|
+
name="#{command[:input]}.#{code}.#{directory}.json"
|
29
|
+
filename="#{@dev.log_dir}/#{name}"
|
30
|
+
puts "add command #{filename}" if @dev.debug?
|
31
|
+
File.open(filename,'w'){|f|f.write(command.to_json)}
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_wrk_command project_fullname
|
35
|
+
commands=get_commands("#{project_fullname}".gsub('/','-'))
|
36
|
+
return commands[0] if commands.length > 0
|
12
37
|
nil
|
13
38
|
end
|
14
39
|
end
|
data/lib/base/project.rb
CHANGED
@@ -2,10 +2,34 @@ puts __FILE__ if defined?(DEBUG)
|
|
2
2
|
|
3
3
|
require 'json'
|
4
4
|
require_relative('../apps/svn.rb')
|
5
|
+
require_relative('environment.rb')
|
5
6
|
require_relative('string.rb')
|
6
7
|
|
7
8
|
class Project < Hash
|
8
|
-
attr_accessor :filename
|
9
|
+
attr_accessor :filename,:env
|
10
|
+
|
11
|
+
def initialize value='',fullname=''
|
12
|
+
@filename=''
|
13
|
+
@env=Environment.new
|
14
|
+
self[:url]=Project.get_url
|
15
|
+
self[:fullname]=Project.get_fullname_from_url self[:url] if self[:url].length > 0
|
16
|
+
self[:timeout]=60*5
|
17
|
+
if value.is_a?(String)
|
18
|
+
self[:url] = value if value.is_a?(String) && value.length > 0
|
19
|
+
self[:fullname] = Project.get_fullname_from_url self[:url]
|
20
|
+
elsif(value.is_a?(Hash))
|
21
|
+
value.each{|k,v|self[k.to_sym]=v}
|
22
|
+
else
|
23
|
+
self[:fullname]=Project.get_fullname_from_url self[:url] if self[:url].length > 0
|
24
|
+
end
|
25
|
+
self[:fullname] = fullname if fullname.length > 0
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_timeout value
|
29
|
+
self[:timeout] = value if value.is_a? Numeric
|
30
|
+
self[:timeout] = value.gsub('m','').strip.to_f * 60 if value.include?('m')
|
31
|
+
self[:timeout] = value.gsub('s','').strip.to_f * 60 if value.include?('s')
|
32
|
+
end
|
9
33
|
|
10
34
|
def self.get_url directory=Rake.application.original_dir
|
11
35
|
url=''
|
@@ -17,46 +41,26 @@ class Project < Hash
|
|
17
41
|
end
|
18
42
|
|
19
43
|
def self.get_fullname directory
|
20
|
-
directory.gsub(
|
44
|
+
directory.gsub(@env.wrk_dir,'')
|
21
45
|
end
|
22
46
|
|
23
47
|
def self.get_fullname_from_url url
|
24
48
|
return url.gsub('http://','').gsub('https://','').gsub('.com/','/').gsub('.git','')
|
25
49
|
end
|
26
50
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
self[:url]=Project.get_url
|
31
|
-
self[:fullname]=Project.get_fullname_from_url self[:url] if self[:url].length > 0
|
32
|
-
if value.is_a?(String)
|
33
|
-
self[:url] = value if value.is_a?(String) && value.length > 0
|
34
|
-
self[:fullname] = Project.get_fullname_from_url self[:url]
|
35
|
-
elsif(value.is_a?(Hash))
|
36
|
-
value.each{|k,v|self[k.to_sym]=v}
|
37
|
-
else
|
38
|
-
self[:fullname]=Project.get_fullname_from_url self[:url] if self[:url].length > 0
|
39
|
-
end
|
40
|
-
|
41
|
-
#self[:fullname]=Project.get_fullname Rake.application.original_dir if(self.fullname.include?(':') && Rake.application.original_dir.include?('/wrk/'))
|
42
|
-
end
|
43
|
-
|
44
|
-
def url
|
45
|
-
self[:url]
|
46
|
-
end
|
47
|
-
def fullname
|
48
|
-
self[:fullname]
|
49
|
-
end
|
51
|
+
def url; self[:url]; end
|
52
|
+
def fullname; self[:fullname]; end
|
50
53
|
|
51
54
|
def name
|
52
55
|
parts=fullname.split('/')
|
53
56
|
parts[parts.length-1]
|
54
57
|
end
|
55
58
|
|
56
|
-
def wrk_dir
|
57
|
-
|
58
|
-
"#{
|
59
|
-
|
59
|
+
def wrk_dir; "#{@env.wrk_dir}/#{self.fullname}"; end
|
60
|
+
def make_dir tag=''
|
61
|
+
"#{@env.make_dir}/#{self.fullname}" if tag.length==0
|
62
|
+
"#{@env.make_dir}/#{self.fullname}-#{tag}"
|
63
|
+
end
|
60
64
|
|
61
65
|
def pull
|
62
66
|
if(File.exists?(wrk_dir) && File.exists?("#{wrk_dir}/.git"))
|
@@ -69,15 +73,19 @@ class Project < Hash
|
|
69
73
|
|
70
74
|
def clone
|
71
75
|
if(!File.exists?(wrk_dir) && self[:url].include?('.git'))
|
72
|
-
|
73
|
-
|
76
|
+
cmd=Command.new({ :input => "git clone #{self[:url]} #{self.wrk_dir}", :quiet => true,:ignore_failure => true})
|
77
|
+
cmd.execute
|
78
|
+
@env.out cmd.summary
|
74
79
|
end
|
75
80
|
end
|
76
81
|
|
77
82
|
def checkout
|
78
83
|
if(!File.exists?(wrk_dir) && self[:url].include?('svn'))
|
79
|
-
puts "checkout #{self.url} to #{self.wrk_dir}"
|
80
|
-
puts `svn checkout #{self.url} #{self.wrk_dir}`
|
84
|
+
#puts "checkout #{self.url} to #{self.wrk_dir}"
|
85
|
+
#puts `svn checkout #{self.url} #{self.wrk_dir}`
|
86
|
+
cmd=Command.new({ :input => "svn checkout #{self.url} #{self.wrk_dir}", :quiet => true,:ignore_failure => true})
|
87
|
+
cmd.execute
|
88
|
+
@env.out cmd.summary
|
81
89
|
end
|
82
90
|
end
|
83
91
|
|
@@ -90,25 +98,19 @@ class Project < Hash
|
|
90
98
|
Dir.chdir(self.wrk_dir) do
|
91
99
|
rake = Command.new({ :input => 'rake', :timeout => 300, :ignore_failure => true })
|
92
100
|
rake.execute
|
93
|
-
|
101
|
+
@env.out rake.summary
|
94
102
|
end
|
95
103
|
end
|
96
104
|
end
|
97
105
|
|
98
|
-
|
99
|
-
puts "Project #{name}"
|
100
|
-
puts "#{'fullname'.fix(13)}: #{self.fullname}"
|
101
|
-
puts "#{'url'.fix(13)}: #{self[:url]}"
|
102
|
-
puts "#{'version'.fix(13)}: #{VERSION}" if defined? VERSION
|
103
|
-
end
|
106
|
+
|
104
107
|
|
105
108
|
def latest_tag update=false
|
106
|
-
|
107
|
-
makedir="#{Environment.dev_root}/make/#{self.fullname}"
|
109
|
+
makedir="#{@env.make_dir}/#{self.fullname}"
|
108
110
|
FileUtils.mkdir_p(File.dirname(makedir)) if !File.exists?(File.dirname(makedir))
|
109
111
|
if(File.exists?(makedir))
|
110
112
|
Dir.chdir(makedir) do
|
111
|
-
Command.exit_code('git pull')
|
113
|
+
Command.exit_code('git pull') if update
|
112
114
|
end
|
113
115
|
else
|
114
116
|
if(update)
|
@@ -129,49 +131,212 @@ class Project < Hash
|
|
129
131
|
''
|
130
132
|
end
|
131
133
|
|
132
|
-
|
133
|
-
|
134
|
+
|
135
|
+
|
136
|
+
def log_filenames tags=nil
|
137
|
+
tags=Array.new if tags.nil?
|
138
|
+
filenames=Array.new
|
139
|
+
Dir.chdir(@env.log_dir) do
|
140
|
+
dotname=fullname.gsub('/','.')
|
141
|
+
Dir.glob("#{dotname}*.json").each{|f|
|
142
|
+
if(tags.length==0)
|
143
|
+
filenames << "#{@env.log_dir}/#{f}"
|
144
|
+
else
|
145
|
+
has_tags=true
|
146
|
+
tags.each{|tag|
|
147
|
+
has_tags=false if !f.include? tag
|
148
|
+
}
|
149
|
+
filenames << "#{@env.log_dir}/#{f}" if has_tags
|
150
|
+
end
|
151
|
+
}
|
152
|
+
end
|
153
|
+
filenames
|
134
154
|
end
|
135
155
|
|
136
|
-
|
137
|
-
|
156
|
+
def command_history tags=nil
|
157
|
+
commands=Array.new
|
158
|
+
log_filenames(tags).each{|logfile|
|
159
|
+
commands << Command.new(JSON.parse(IO.read(logfile)))
|
160
|
+
}
|
161
|
+
commands
|
162
|
+
end
|
163
|
+
|
164
|
+
def get_logfile tags
|
165
|
+
tagstring=''
|
166
|
+
tagstring=tags if tags.kind_of?(String)
|
167
|
+
tagstring=tags.join('.') if tags.kind_of?(Array)
|
168
|
+
name="#{self.fullname}.#{tagstring}.json".gsub('/','.')
|
169
|
+
"#{@env.log_dir}/#{name}"
|
170
|
+
end
|
171
|
+
|
172
|
+
def list
|
173
|
+
history=command_history
|
174
|
+
if(history.length==0)
|
175
|
+
@env.out "? #{fullname}"
|
176
|
+
else
|
177
|
+
status=0
|
178
|
+
history.each{|c|
|
179
|
+
status=c.exit_code if c.exit_code != 0
|
180
|
+
}
|
181
|
+
if(status==0)
|
182
|
+
@env.out " #{fullname}"
|
183
|
+
else
|
184
|
+
if(@env.colorize?)
|
185
|
+
require 'ansi/code'
|
186
|
+
@env.out ANSI.red + ANSI.bright + "X #{fullname}" + ANSI.reset
|
187
|
+
else
|
188
|
+
@env.out "X #{fullname}"
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def out_brackets message
|
195
|
+
if(@env.colorize?)
|
196
|
+
require 'ansi/code'
|
197
|
+
@env.out "[" + ANSI.blue + ANSI.bright + message + ANSI.reset + ']'
|
198
|
+
else
|
199
|
+
@env.out "[#{message}]"
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def out_cyan message
|
204
|
+
if(@env.colorize?)
|
205
|
+
require 'ansi/code'
|
206
|
+
@env.out ANSI.cyan + ANSI.bright + message + ANSI.reset
|
207
|
+
else
|
208
|
+
@env.out "#{message}"
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def out_property name,value
|
213
|
+
if(@env.colorize?)
|
214
|
+
require 'ansi/code'
|
215
|
+
@env.out "#{name}: " + ANSI.white + ANSI.bold + value.to_s.strip + ANSI.reset
|
216
|
+
else
|
217
|
+
@env.out "#{name}: #{value}"
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
#def info
|
222
|
+
# @env.out "Project #{name}"
|
223
|
+
# @env.out "#{'fullname'.fix(13)}: #{self.fullname}"
|
224
|
+
# @env.out "#{'url'.fix(13)}: #{self[:url]}"
|
225
|
+
# @env.out "#{'version'.fix(13)}: #{VERSION}" if defined? VERSION
|
226
|
+
#end
|
227
|
+
def info
|
228
|
+
infoCmd=Command.new({ :input => 'info', :exit_code => 0 })
|
229
|
+
#out_cyan '========================================================='
|
230
|
+
#out_cyan fullname
|
231
|
+
out_property "fullname".fix(15), fullname
|
232
|
+
out_property "url".fix(15), url
|
233
|
+
wrk_history=command_history ['work']
|
234
|
+
out_property "work status".fix(15), "?" if wrk_history.length == 0
|
235
|
+
out_property "work status".fix(15), wrk_history[0].summary if wrk_history.length > 0
|
236
|
+
if(wrk_history.length > 0)
|
237
|
+
@env.out wrk_history[0].info
|
238
|
+
end
|
239
|
+
make_history=command_history ['make', latest_tag]
|
240
|
+
out_property "make status".fix(15),"?" if make_history.length == 0
|
241
|
+
out_property "make status".fix(15), make_history[0].summary if make_history.length > 0
|
242
|
+
if(make_history.length >0)
|
243
|
+
@env.out make_history[0].info
|
244
|
+
end
|
245
|
+
infoCmd
|
246
|
+
end
|
247
|
+
|
248
|
+
def clobber
|
249
|
+
clobberCmd=Command.new('clobber')
|
250
|
+
clobberCmd[:exit_code]=0
|
251
|
+
if(File.exists?(wrk_dir))
|
252
|
+
Dir.remove wrk_dir,true
|
253
|
+
@env.out "removed #{wrk_dir}"
|
254
|
+
end
|
255
|
+
if(File.exists?(make_dir))
|
256
|
+
Dir.remove make_dir,true
|
257
|
+
@env.out "removed #{make_dir}"
|
258
|
+
end
|
259
|
+
clobberCmd
|
260
|
+
end
|
138
261
|
|
139
|
-
|
262
|
+
def work
|
263
|
+
clone
|
264
|
+
checkout
|
265
|
+
logfile=get_logfile ['work']
|
266
|
+
if(File.exists?(wrk_dir))
|
267
|
+
rake_default=Command.new({:input =>'rake default',:quiet => true,:ignore_failure => true})
|
268
|
+
if(last_work_mtime.nil? || last_work_mtime < Environment.get_latest_mtime(wrk_dir))
|
269
|
+
Dir.chdir(wrk_dir) do
|
270
|
+
|
271
|
+
@env.out fullname
|
272
|
+
|
273
|
+
if(!File.exists?'rakefile.rb')
|
274
|
+
rake_default[:exit_code]=1
|
275
|
+
rake_default[:error]="rakefile.rb not found."
|
276
|
+
rake_default[:start_time]=Time.now
|
277
|
+
rake_default[:end_time]=Time.now
|
278
|
+
else
|
279
|
+
#rake_default[:timeout] = self[:timeout]
|
280
|
+
rake_default.execute
|
281
|
+
end
|
282
|
+
rake_default.save logfile
|
283
|
+
update_status
|
284
|
+
@env.out rake_default.summary true
|
285
|
+
return rake_default
|
286
|
+
end
|
287
|
+
else
|
288
|
+
if(File.exists?(logfile))
|
289
|
+
rake_default.open logfile
|
290
|
+
@env.out rake_default.summary true if(rake_default[:exit_code] != 0 || @env.show_success?)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
rake_default
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
def make tag=''
|
298
|
+
tag=latest_tag true if tag.length==0
|
299
|
+
#return if tag.length==0
|
140
300
|
raise 'no tag specified' if tag.length==0
|
141
301
|
|
142
|
-
rake_default=
|
143
|
-
logfile=
|
302
|
+
rake_default=Command.new({:input => 'rake default',:quiet => true,:ignore_failure => true})
|
303
|
+
logfile=get_logfile ['make',tag]
|
144
304
|
if(File.exists?(logfile))
|
145
|
-
|
146
|
-
|
147
|
-
|
305
|
+
rake_default.open logfile
|
306
|
+
@env.out rake_default.summary true if(rake_default[:exit_code] != 0) || @env.show_success?
|
307
|
+
rake_default
|
148
308
|
else
|
149
|
-
|
150
|
-
makedir="#{Environment.dev_root}/make/#{self.fullname}-#{tag}"
|
309
|
+
makedir=make_dir tag
|
151
310
|
FileUtils.mkdir_p(File.dirname(makedir)) if !File.exists? File.dirname(makedir)
|
152
311
|
if(self[:url].include?('.git'))
|
153
312
|
if(!File.exists?(makedir))
|
154
313
|
clone=Command.new({:input=>"git clone #{self[:url]} #{makedir}",:quiet=>true})
|
155
314
|
clone.execute
|
156
315
|
end
|
157
|
-
|
316
|
+
end
|
317
|
+
if(File.exists?(makedir))
|
158
318
|
Dir.chdir(makedir) do
|
159
|
-
#puts "making #{self.fullname}"
|
160
319
|
checkout=Command.new({:input=>"git checkout #{tag}",:quiet=>true})
|
161
320
|
checkout.execute
|
162
321
|
FileUtils.rm_r '.git'
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
322
|
+
if(!File.exists?'rakefile.rb')
|
323
|
+
rake_default[:exit_code]=1
|
324
|
+
rake_default[:error]="rakefile.rb not found."
|
325
|
+
rake_default[:start_time]=Time.now
|
326
|
+
rake_default[:end_time]=Time.now
|
327
|
+
else
|
328
|
+
#rake_default[:timeout] = self[:timeout]
|
329
|
+
rake_default.execute
|
330
|
+
end
|
331
|
+
rake_default.save logfile
|
170
332
|
update_status
|
333
|
+
@env.out rake_default.summary true
|
171
334
|
rake_default
|
172
335
|
end
|
173
|
-
|
336
|
+
else
|
337
|
+
puts "Project make make_dir #{makedir} does not exist." if @env.debug?
|
174
338
|
end
|
339
|
+
|
175
340
|
begin
|
176
341
|
FileUtils.rm_r makedir
|
177
342
|
rescue
|
@@ -181,24 +346,22 @@ class Project < Hash
|
|
181
346
|
end
|
182
347
|
|
183
348
|
def last_work_mtime
|
184
|
-
logfile=
|
185
|
-
if File.exists? logfile
|
186
|
-
return File.mtime(logfile)
|
187
|
-
end
|
349
|
+
logfile=get_logfile ['work']
|
350
|
+
return File.mtime(logfile) if File.exists? logfile
|
188
351
|
nil
|
189
352
|
end
|
190
353
|
|
191
354
|
def update_status
|
192
|
-
status_logfile="#{
|
355
|
+
status_logfile="#{@env.root_dir}/log/#{self.fullname}/#{@env.user}@#{@env.machine}.status.json"
|
193
356
|
status=Hash.new({'status'=>'?'})
|
194
|
-
wrk_logfile="#{
|
357
|
+
wrk_logfile="#{@env.root_dir}/log/#{self.fullname}/#{@env.user}@#{@env.machine}.json"
|
195
358
|
if(File.exists?(wrk_logfile))
|
196
359
|
rake_default=Command.new(JSON.parse(IO.read(wrk_logfile)))
|
197
360
|
status[:work_logfile]=wrk_logfile
|
198
361
|
status['status']='0'
|
199
362
|
status['status']='X' if rake_default[:exit_code] != 0
|
200
363
|
end
|
201
|
-
make_logfile="#{
|
364
|
+
make_logfile="#{@env.root_dir}/log/#{self.fullname}/#{latest_tag}/#{@env.user}@#{@env.machine}.json"
|
202
365
|
if(File.exists?(make_logfile))
|
203
366
|
rake_default=Command.new(JSON.parse(IO.read(make_logfile)))
|
204
367
|
status[:make_logfile]=make_logfile
|
@@ -212,63 +375,18 @@ class Project < Hash
|
|
212
375
|
end
|
213
376
|
|
214
377
|
def status
|
215
|
-
status_logfile="#{
|
378
|
+
status_logfile="#{@env.root_dir}/log/#{self.fullname}/#{@env.user}@#{@env.machine}.status.json"
|
216
379
|
update_status if !File.exists? status_logfile
|
217
380
|
if(File.exists?(status_logfile))
|
218
381
|
statusHash=JSON.parse(IO.read(status_logfile))
|
219
382
|
return statusHash['status'] if(statusHash.has_key?('status'))
|
220
383
|
end
|
221
384
|
'?'
|
222
|
-
#status='?'
|
223
|
-
#wrk_logfile="#{Environment.dev_root}/log/#{self.fullname}/#{Environment.user}@#{Environment.machine}.json"
|
224
|
-
#if(File.exists?(wrk_logfile))
|
225
|
-
# rake_default=Command.new(JSON.parse(IO.read(wrk_logfile)))
|
226
|
-
# status='0'
|
227
|
-
# return 'X' if rake_default[:exit_code] != 0
|
228
|
-
#end
|
229
|
-
#make_logfile="#{Environment.dev_root}/log/#{self.fullname}/#{latest_tag}/#{Environment.user}@#{Environment.machine}.json"
|
230
|
-
#if(File.exists?(make_logfile))
|
231
|
-
# rake_default=Command.new(JSON.parse(IO.read(make_logfile)))
|
232
|
-
# status='0'
|
233
|
-
# return 'X' if rake_default[:exit_code] != 0
|
234
|
-
#else
|
235
|
-
# return '?' # outstanding make
|
236
|
-
#end
|
237
|
-
#status
|
238
385
|
end
|
239
386
|
|
240
387
|
def report
|
241
388
|
end
|
242
389
|
|
243
|
-
def work
|
244
|
-
clone
|
245
|
-
checkout
|
246
|
-
if(File.exists?(wrk_dir))
|
247
|
-
if(last_work_mtime.nil? || last_work_mtime < Environment.get_latest_mtime(wrk_dir))
|
248
|
-
Dir.chdir(wrk_dir) do
|
249
|
-
puts "working #{self.fullname}"
|
250
|
-
rake_default=Command.new('rake default')
|
251
|
-
rake_default[:quiet]=true
|
252
|
-
rake_default[:ignore_failure]=true
|
253
|
-
rake_default.execute
|
254
|
-
#Command.exit_code('rake default')
|
255
|
-
logfile="#{Environment.dev_root}/log/#{self.fullname}/#{Environment.user}@#{Environment.machine}.json"
|
256
|
-
FileUtils.mkdir_p(File.dirname(logfile)) if !File.exists?(File.dirname(logfile))
|
257
|
-
File.open(logfile,'w'){|f|f.write(rake_default.to_json)}
|
258
|
-
update_status
|
259
|
-
puts rake_default.summary
|
260
|
-
end
|
261
|
-
else
|
262
|
-
logfile="#{Environment.dev_root}/log/#{self.fullname}/#{Environment.user}@#{Environment.machine}.json"
|
263
|
-
if(File.exists?(logfile))
|
264
|
-
rake_default=Command.new('rake default')
|
265
|
-
rake_default.open logfile
|
266
|
-
puts rake_default.summary if(rake_default[:exit_code] != 0)
|
267
|
-
end
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
390
|
def update
|
273
391
|
clone
|
274
392
|
checkout
|
@@ -301,8 +419,6 @@ class Project < Hash
|
|
301
419
|
tags
|
302
420
|
end
|
303
421
|
|
304
|
-
|
305
|
-
|
306
|
-
end
|
422
|
+
|
307
423
|
end
|
308
424
|
|