dev_tasks 1.0.38 → 1.0.39
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dev_tasks.rb +3 -219
- data/lib/tasks.rb +87 -0
- data/spec/dev_tasks_spec.rb +12 -38
- data/spec/gem-example/rakefile.rb +16 -0
- metadata +20 -41
- data/lib/add.rb +0 -30
- data/lib/artifacts.x.rb +0 -46
- data/lib/build.rb +0 -28
- data/lib/color.rb +0 -23
- data/lib/commands.rb +0 -63
- data/lib/commit.rb +0 -25
- data/lib/console.rb +0 -81
- data/lib/dependencies.rb +0 -85
- data/lib/environment.rb +0 -118
- data/lib/htmllog.rb +0 -53
- data/lib/jsonlog.rb +0 -18
- data/lib/logger.rb +0 -37
- data/lib/msbuild.rb +0 -41
- data/lib/publish.rb +0 -50
- data/lib/pull.rb +0 -15
- data/lib/push.rb +0 -12
- data/lib/settings.rb +0 -26
- data/lib/setup.rb +0 -17
- data/lib/spec.json +0 -1
- data/lib/svnexports.rb +0 -5
- data/lib/teardown.rb +0 -4
- data/lib/test.rb +0 -55
- data/lib/timer.rb +0 -41
- data/lib/upgrade.rb +0 -52
- data/lib/verify.rb +0 -38
- data/lib/yamllog.rb +0 -18
- data/spec/dependencies_spec.rb +0 -28
- data/spec/environment_spec.rb +0 -8
- data/spec/msbuild_spec.rb +0 -9
- data/spec/spec_helper.rb +0 -4
- data/spec/test_data/cpp_projects/helloLib/rakefile.rb +0 -9
- data/spec/test_data/csharp_projects/JsonNet.Test.csproj +0 -75
- data/spec/test_data/csharp_projects/JsonNet.csproj +0 -79
- data/spec/test_data/csharp_projects/helloDll/helloDll.Net2.0.csproj +0 -54
- data/spec/test_data/csharp_projects/helloDll/helloDll.Net3.5.csproj +0 -54
- data/spec/test_data/csharp_projects/helloDll/helloDll.Net4.0.csproj +0 -54
- data/spec/test_data/csharp_projects/helloDll/helloDll.Net4.5.csproj +0 -56
- data/spec/test_data/csharp_projects/helloDll/rakefile.rb +0 -1
- data/spec/test_data/ruby_projects/helloGem/rakefile.rb +0 -3
data/lib/console.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
require_relative './color.rb'
|
2
|
-
|
3
|
-
class Console
|
4
|
-
|
5
|
-
def self.debug message
|
6
|
-
if(defined?(DEV_TASKS))
|
7
|
-
if(DEV_TASKS.has_key?(:debug))
|
8
|
-
puts message
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.print message
|
14
|
-
puts message
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.announce_task_start task
|
18
|
-
line = Color.bold + Color.cyan + "[:" + task + "]" + Color.clear
|
19
|
-
#while(line.length < 80) do
|
20
|
-
# line = line + "="
|
21
|
-
#end
|
22
|
-
#puts " "
|
23
|
-
puts line + Color.clear
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.announce_task_end task, elapsed_str
|
27
|
-
line = task + " completed in " + Color.green + elapsed_str + Color.clear
|
28
|
-
puts line + Color.clear
|
29
|
-
puts " "
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.start_command command
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.end_command command
|
37
|
-
|
38
|
-
if command[:exit_code] != 0
|
39
|
-
print " " + Color.green + command[:input] + Color.clear
|
40
|
-
puts command[:output]
|
41
|
-
raise Color.yellow + "`" + Color.green + command[:input] + Color.yellow + "`" + Color.clear +
|
42
|
-
" has exit code " + command[:exit_code].to_s + " " + command[:output]
|
43
|
-
else
|
44
|
-
puts command[:input] + " " + command[:elapsed]
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.print_hash(indent,hash)
|
49
|
-
max_length=0
|
50
|
-
hash.each { |name,value| max_length=name.to_s.length if name.to_s.length > max_length }
|
51
|
-
max_length=max_length+1
|
52
|
-
index=0
|
53
|
-
hash.each do |name,value|
|
54
|
-
prefix = "#{indent}#{name.to_s}".rjust(max_length)
|
55
|
-
if value.kind_of?(Hash)
|
56
|
-
print_hash(prefix+" ",value)
|
57
|
-
elsif value.kind_of?(Array)
|
58
|
-
Console.print_array prefix,name,value
|
59
|
-
else
|
60
|
-
puts Color.bold + prefix + " " + Color.clear + Color.green + value.to_s + Color.clear
|
61
|
-
end
|
62
|
-
index+=1
|
63
|
-
indent=" ".rjust(indent.length)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.print_array(prefix,key,array)
|
68
|
-
array.each do |v|
|
69
|
-
if v.kind_of?(Hash)
|
70
|
-
puts Color.bold + prefix + Color.clear
|
71
|
-
print_hash( prefix + " ".rjust(max_length),v)
|
72
|
-
else
|
73
|
-
puts Color.bold + prefix + " " + Color.clear + Color.green + v.to_s + Color.clear if v.kind_of?(String)
|
74
|
-
#prefix = indent + " ".rjust(max_length-1)
|
75
|
-
#prefix = " ".rjust(indent.length+max_length-1)
|
76
|
-
words = prefix.split(' ')
|
77
|
-
prefix = " ".rjust(prefix.length)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
data/lib/dependencies.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
# The discover method defines the following keys as appropriate:
|
2
|
-
# :ruby a string array of discovered require statements
|
3
|
-
# for example,
|
4
|
-
# given rb file containing
|
5
|
-
# require 'json'
|
6
|
-
# require 'yaml'
|
7
|
-
# the resulting dependies would be
|
8
|
-
# dep[:ruby]=['json','yaml']
|
9
|
-
#
|
10
|
-
# C# dependencies are returned as a hash, as they are seperated into
|
11
|
-
# two groups, :system and :file
|
12
|
-
#
|
13
|
-
#
|
14
|
-
class Dependencies < Hash
|
15
|
-
|
16
|
-
def initialize
|
17
|
-
discover
|
18
|
-
end
|
19
|
-
|
20
|
-
def discover
|
21
|
-
ruby_deps=Array.new
|
22
|
-
cs_system_deps=Array.new
|
23
|
-
cs_file_deps=Array.new
|
24
|
-
Dir.glob("**/*.rb").each{|f|
|
25
|
-
text=File.read(f,:encoding=>'UTF-8')
|
26
|
-
ruby_deps=ruby_deps|Dependencies.ruby_dependencies(text)
|
27
|
-
}
|
28
|
-
Dir.glob("*.csproj").each{|f|
|
29
|
-
begin
|
30
|
-
text=File.read(f,:encoding=>'UTF-8')
|
31
|
-
cs_system_deps=cs_system_deps|Dependencies.csharp_system_dependencies(text)
|
32
|
-
cs_file_deps=cs_file_deps|Dependencies.csharp_file_dependencies(text)
|
33
|
-
rescue Exception => ex
|
34
|
-
puts "Exception raised while scanning " + f + " for dependencies"
|
35
|
-
raise ex
|
36
|
-
end
|
37
|
-
}
|
38
|
-
|
39
|
-
self[:ruby]=ruby_deps.sort if(ruby_deps.length>0)
|
40
|
-
if(cs_system_deps.length > 0 || cs_file_deps.length > 0)
|
41
|
-
self["C#"]=Hash.new
|
42
|
-
self["C#"][:system]=cs_system_deps.sort if(cs_system_deps.length > 0)
|
43
|
-
self["C#"][:file]=cs_file_deps.sort if(cs_file_deps.length > 0)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.ruby_dependencies source
|
48
|
-
result=Array.new
|
49
|
-
source.scan(/require '([\w\/]+)/).each{|m|
|
50
|
-
dep=m.first.to_s
|
51
|
-
result << dep if(!result.include?(dep))
|
52
|
-
}
|
53
|
-
return result
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.csharp_system_dependencies source
|
57
|
-
deps=Array.new
|
58
|
-
source.scan(/<Reference Include="([\w\.-]+)"[\s]+\//).each{|m|
|
59
|
-
dep=m.first.to_s
|
60
|
-
deps << dep if(!deps.include?(dep))
|
61
|
-
}
|
62
|
-
deps
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.csharp_file_dependencies source
|
66
|
-
deps=Array.new
|
67
|
-
source.scan(/<HintPath>([\w\.\\\s-]+)</).each{|m|
|
68
|
-
dep=m.first.to_s
|
69
|
-
deps << dep if(!deps.include?(dep))
|
70
|
-
}
|
71
|
-
deps
|
72
|
-
end
|
73
|
-
|
74
|
-
def show
|
75
|
-
self.each do |key,array|
|
76
|
-
if(array.length > 0)
|
77
|
-
puts key
|
78
|
-
array.each {|v|
|
79
|
-
puts " " + Color.green + v + Color.clear + " "
|
80
|
-
}
|
81
|
-
end
|
82
|
-
end
|
83
|
-
puts " "
|
84
|
-
end
|
85
|
-
end
|
data/lib/environment.rb
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
#require 'dev_environment'
|
2
|
-
|
3
|
-
class Environment #S< Hash#.class_eval do #< Hash do
|
4
|
-
|
5
|
-
def self.scm
|
6
|
-
return "git" if(Dir.exists?(".git"))
|
7
|
-
return "svn" if(Dir.exists?(".svn"))
|
8
|
-
"none"
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.copy src,dest
|
12
|
-
FileUtils.mkdir_p File.dirname(dest) if !File.exists?(File.dirname(dest))
|
13
|
-
FileUtils.cp(src,dest)
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.copy_files files,dest
|
17
|
-
Console.debug("Environment.copy_files([#{files.to_s}],'#{dest}'')")
|
18
|
-
files.each{|f|
|
19
|
-
if(File.directory?(dest))
|
20
|
-
dest_file = "#{dest}/#{f}"
|
21
|
-
Console.debug "copying #{f} to #{dest_file}"
|
22
|
-
FileUtils.mkdir_p(File.dirname(dest_file)) if(!File.exists?(File.dirname(dest_file)))
|
23
|
-
FileUtils.cp(f,dest_file)
|
24
|
-
end
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.svn_add_all dir
|
29
|
-
Dir.chdir(dir) do
|
30
|
-
Dir.glob('**/*').each{|f|
|
31
|
-
puts `svn add #{f} --parents` if(!File.directory?(f))
|
32
|
-
}
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.scm_origin
|
37
|
-
if(Dir.exists?(".git"))
|
38
|
-
`git remote show origin`.scan(/Fetch URL: ([\w:\/.-]+)/).each{|m|
|
39
|
-
return m.first.to_s
|
40
|
-
}
|
41
|
-
end
|
42
|
-
if(Dir.exists?(".svn"))
|
43
|
-
`svn info`.scan(/URL: ([\w:\/.-]+)/).each{|m|
|
44
|
-
return m.first.to_s
|
45
|
-
}
|
46
|
-
end
|
47
|
-
""
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.svn_latest_revision
|
51
|
-
if(Dir.exists?(".svn"))
|
52
|
-
`svn info`.scan(/Last Changed Rev: ([\d]+)/).each{|m|
|
53
|
-
return m.first.to_s
|
54
|
-
}
|
55
|
-
end
|
56
|
-
"0"
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.working_directory
|
60
|
-
Rake.application.original_dir
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.context
|
64
|
-
dir =Environment.working_directory.gsub(Environment.dev_root + '/','')
|
65
|
-
return dir.split('/').first
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.relative_directory
|
69
|
-
Environment.working_directory.gsub(Environment.dev_root + '/' + Environment.context + '/','')
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.branch
|
73
|
-
if(Environment.scm=='git')
|
74
|
-
branches=`git branch`.split(/\n/)
|
75
|
-
branches.each{|b|
|
76
|
-
return b.gsub('*','').strip if b.include?('*')
|
77
|
-
}
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def self.copy_if_newer(source,dest)
|
82
|
-
if(File.exists?(source))
|
83
|
-
if(File.exists?(dest))
|
84
|
-
if(File.mtime(source) > File.mtime(dest))
|
85
|
-
FileUtils.cp(source,dest)
|
86
|
-
puts "copied " + Color.green + source + Color.clear + " to " + Color.green + dest + Color.clear
|
87
|
-
end
|
88
|
-
else
|
89
|
-
FileUtils.cp(source,dest)
|
90
|
-
puts "copied " + Color.green + source + Color.clear + " to " + Color.green + dest + Color.clear
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def self.rake(directory)
|
96
|
-
Environment.rake(directory,'default')
|
97
|
-
end
|
98
|
-
|
99
|
-
def self.rake(directory,task)
|
100
|
-
Environment.rake(directory,task,false)
|
101
|
-
end
|
102
|
-
|
103
|
-
def self.rake(directory,task,log)
|
104
|
-
Dir.chdir(directory) do
|
105
|
-
timer=Timer.new
|
106
|
-
out=`rake #{task}`
|
107
|
-
|
108
|
-
if $? != 0
|
109
|
-
puts "rake #{task} in " + directory if log
|
110
|
-
puts out if log
|
111
|
-
raise "rake #{task} in " + directory + " failed"
|
112
|
-
else
|
113
|
-
puts " " + timer.elapsed_str + " " + directory + " rake " + task if log
|
114
|
-
#puts "rake default (" + directory + ") " + timer.elapsed_str
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
data/lib/htmllog.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
class HtmlLog
|
2
|
-
def initialize
|
3
|
-
FileUtils.mkdir("#{Environment.dev_root}/log") if !File.exists?("#{Environment.dev_root}/log")
|
4
|
-
@file=File.open("#{Environment.dev_root}/log/rake.html",'w')
|
5
|
-
@file.write '<html>'
|
6
|
-
@file.write '<body>'
|
7
|
-
@file.write '<h1>'
|
8
|
-
@file.write "rake"
|
9
|
-
ARGV.each do|a|
|
10
|
-
puts " #{a}"
|
11
|
-
end
|
12
|
-
@file.write '</h1>'
|
13
|
-
@file.write '<h2>directory:' + File.dirname(__FILE__) + '</h2>'
|
14
|
-
@file.write '<h2>time:' + Time.now.to_s + '</h2>'
|
15
|
-
@current_task=nil
|
16
|
-
@task_commands=Hash.new
|
17
|
-
end
|
18
|
-
|
19
|
-
def finalize
|
20
|
-
@file.write('<ul>')
|
21
|
-
@task_commands.each{|k,v|
|
22
|
-
|
23
|
-
@file.write('<li>')
|
24
|
-
@file.write(k)
|
25
|
-
@file.write('</li>')
|
26
|
-
|
27
|
-
}
|
28
|
-
@file.write '</ul>'
|
29
|
-
@file.write '</body>'
|
30
|
-
@file.write '</html>'
|
31
|
-
@file.close
|
32
|
-
end
|
33
|
-
|
34
|
-
def start_task task
|
35
|
-
@current_task=task
|
36
|
-
@task_commands[task]=Hash.new
|
37
|
-
@task_commands[task][:command_results]=Array.new
|
38
|
-
end
|
39
|
-
|
40
|
-
def end_task task
|
41
|
-
|
42
|
-
@current_task=nil
|
43
|
-
#@file
|
44
|
-
end
|
45
|
-
|
46
|
-
def start_command command
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
def end_command command
|
51
|
-
#@task_commands[@current_task][:command_results] << result
|
52
|
-
end
|
53
|
-
end
|
data/lib/jsonlog.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
class JsonLog
|
4
|
-
def initialize
|
5
|
-
end
|
6
|
-
|
7
|
-
def finalize
|
8
|
-
name='DEV'
|
9
|
-
ARGV.each do|a|
|
10
|
-
name="#{name}.#{a}"
|
11
|
-
end
|
12
|
-
name="#{name}.json"
|
13
|
-
FileUtils.mkdir("#{DEV[:dev_root]}/log") if !File.exists?("#{DEV[:dev_root]}/log")
|
14
|
-
File.open("#{DEV[:dev_root]}/log/#{name}","w") do |f|
|
15
|
-
f.write(JSON.pretty_generate(DEV))
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/logger.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require_relative './htmllog.rb'
|
2
|
-
require_relative './jsonlog.rb'
|
3
|
-
require_relative './yamllog.rb'
|
4
|
-
|
5
|
-
class Logger
|
6
|
-
@@timers=Hash.new
|
7
|
-
@@html_log=HtmlLog.new
|
8
|
-
@@json_log=JsonLog.new
|
9
|
-
@@yaml_log=YamlLog.new
|
10
|
-
def self.start_task task
|
11
|
-
@@timers[task]=Timer.new
|
12
|
-
Console.announce_task_start task
|
13
|
-
@@html_log.start_task task
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.end_task task
|
17
|
-
elapsed=@@timers[task].elapsed
|
18
|
-
@@html_log.end_task task
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.finalize
|
22
|
-
@@html_log.finalize
|
23
|
-
@@json_log.finalize
|
24
|
-
@@yaml_log.finalize
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.start_command command
|
28
|
-
Console.start_command command
|
29
|
-
//
|
30
|
-
@@html_log.start_command command
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.end_command command
|
34
|
-
Console.end_command command
|
35
|
-
@@html_log.end_command command
|
36
|
-
end
|
37
|
-
end
|
data/lib/msbuild.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative './color.rb'
|
4
|
-
|
5
|
-
# Visual Studio 2008 version 9.0, solution format version 10.00
|
6
|
-
# Visual Studio 2010 version 10.0, solution format version 11.00
|
7
|
-
# Visual Studio 2012 version 11.0, solution format version 12.00
|
8
|
-
# Visual Studio 2013 version 12.0, solution format version 12.00
|
9
|
-
class MSBuild < Hash
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
self[:vs9]="C:\\Windows\\Microsoft.NET\\Framework\\v3.5\\msbuild.exe"
|
13
|
-
self[:vs12]="C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\msbuild.exe"
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.get_vs_version(sln_filename)
|
17
|
-
sln_text=File.read(sln_filename,:encoding=>'UTF-8')
|
18
|
-
return :vs9 if sln_text.include?('Format Version 10.00')
|
19
|
-
return :vs12
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.get_configurations(sln_filename)
|
23
|
-
configs=Array.new
|
24
|
-
sln_text=File.read(sln_filename,:encoding=>'UTF-8')
|
25
|
-
sln_text.scan( /= ([\w]+)\|/ ).each{|m|
|
26
|
-
c=m.first.to_s
|
27
|
-
configs << c if !configs.include?(c)
|
28
|
-
}
|
29
|
-
return configs
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.get_platforms(sln_filename)
|
33
|
-
platforms=Array.new
|
34
|
-
sln_text=File.read(sln_filename,:encoding=>"UTF-8")
|
35
|
-
sln_text.scan( /= [\w]+\|([\w ]+)/ ).each{|m|
|
36
|
-
p=m.first.to_s
|
37
|
-
platforms << p if !platforms.include?(p)
|
38
|
-
}
|
39
|
-
return platforms
|
40
|
-
end
|
41
|
-
end
|
data/lib/publish.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
#require_relative('./commandarray.rb')
|
2
|
-
require_relative('./environment.rb')
|
3
|
-
require_relative('./console.rb')
|
4
|
-
|
5
|
-
class Publish #< CommandArray
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
#if(Environment.scm=='git')
|
9
|
-
# artifacts=Artifacts.new
|
10
|
-
# artifacts.each {|artifact|
|
11
|
-
# dest_dir = Environment.dev_root + "/dep/" + Environment.relative_directory + '/' + Environment.branch
|
12
|
-
# dest = dest_dir + "/" + artifact
|
13
|
-
# dest_dir=File.dirname(dest)
|
14
|
-
# self.add "<%FileUtils.mkdir_p('#{dest_dir}')%>" if (!Dir.exists?(dest_dir))
|
15
|
-
# self.add "<%FileUtils.cp('#{artifact}','#{dest}')%>"
|
16
|
-
# }
|
17
|
-
#end
|
18
|
-
end
|
19
|
-
|
20
|
-
def update
|
21
|
-
Console.debug "Publish.update"
|
22
|
-
if(defined?(DEV_TASKS))
|
23
|
-
if(DEV_TASKS).has_key?(:publish_path)
|
24
|
-
if(DEV_TASKS[:publish_path].include?('svn://') || DEV_TASKS[:publish_path].include?('file:///'))
|
25
|
-
latestRev=Environment.svn_latest_revision
|
26
|
-
svn_publish_uri="#{DEV_TASKS[:publish_path]}/#{DEV_TASKS[:relative_directory]}-#{latestRev}"
|
27
|
-
local_dir="#{Environment.dev_root}/tmp/#{DEV_TASKS[:relative_directory]}@#{latestRev}"
|
28
|
-
FileUtils.mkdir_p(File.dirname(local_dir)) if(!File.exists?(File.dirname(local_dir)))
|
29
|
-
dep_dir="#{Environment.dev_root}/dep/#{DEV_TASKS[:relative_directory]}@#{latestRev}"
|
30
|
-
svn_info=`svn info #{svn_publish_uri} 2>&1`
|
31
|
-
if(svn_info.include?('URL:'))
|
32
|
-
Console.debug "#{svn_publish_uri} already exists."
|
33
|
-
else
|
34
|
-
Console.debug "adding publish commands.."
|
35
|
-
add "svn mkdir #{svn_publish_uri} --parents -m\"publish\""
|
36
|
-
add "svn checkout #{svn_publish_uri} #{local_dir}"
|
37
|
-
add "<%Environment.copy_files(DEV_TASKS[:files][:artifact],'#{local_dir}')%>"
|
38
|
-
add "<%Environment.svn_add_all('#{local_dir}')%>"
|
39
|
-
add "svn commit #{local_dir}@ -m\"publish\""
|
40
|
-
add "<%FileUtils.rm_r('#{local_dir}')%>"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def add command
|
48
|
-
self << command if(!include?(command))
|
49
|
-
end
|
50
|
-
end
|
data/lib/pull.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#require_relative('./commandarray.rb')
|
2
|
-
require_relative('./environment.rb')
|
3
|
-
require 'time'
|
4
|
-
|
5
|
-
class Pull < Array#< CommandArray
|
6
|
-
def update
|
7
|
-
if(Environment.scm=='git' && Environment.scm_origin.length > 0 && `git config --list`.include?('user.name='))
|
8
|
-
if(Timer.elapsed_exceeds?("last_pull",60*60*2))
|
9
|
-
#if(Timer.get_elapsed("last_pull").nil? || Timer.get_elapsed("last_pull") > 60*60*2)
|
10
|
-
add "<%`git pull 2>&1`%>"
|
11
|
-
add "<%Timer.set_timestamp('last_pull')%>"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/lib/push.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require_relative('./push.rb')
|
2
|
-
require_relative('./environment.rb')
|
3
|
-
|
4
|
-
class Push #< CommandArray
|
5
|
-
def update
|
6
|
-
if(Environment.scm=='git' && `git config --list`.include?('user.name='))
|
7
|
-
if(`git diff @{u}`.include?('diff'))
|
8
|
-
self.add "<%`git push 2>&1`%>"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/lib/settings.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require_relative './environment.rb'
|
2
|
-
|
3
|
-
class Settings < Hash
|
4
|
-
def initialize
|
5
|
-
load
|
6
|
-
self['colorize']=true if(!self.has_key?('colorize'))
|
7
|
-
save
|
8
|
-
end
|
9
|
-
|
10
|
-
def filename
|
11
|
-
Environment.dev_root + "/dev_tasks.settings.json"
|
12
|
-
end
|
13
|
-
|
14
|
-
def load
|
15
|
-
if(File.exists?(filename))
|
16
|
-
hash=JSON.parse(File.read(filename))
|
17
|
-
hash.each {|k,v|
|
18
|
-
self[k]=v
|
19
|
-
}
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def save
|
24
|
-
File.open(filename,'w'){|f| f.write(JSON.dump(self))}
|
25
|
-
end
|
26
|
-
end
|
data/lib/setup.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#require_relative('./commandarray.rb')
|
2
|
-
class Setup #< CommandArray
|
3
|
-
|
4
|
-
def update
|
5
|
-
if(defined?(DEV_TASKS))
|
6
|
-
DEV_TASKS[:svn_exports].each{|k,v|
|
7
|
-
if(!File.exists?("#{Environment.dev_root}/dep/#{k}"))
|
8
|
-
FileUtils.mkdir_p(File.dirname("#{Environment.dev_root}/dep/#{k}")) if !File.exists?("#{Environment.dev_root}/dep/#{k}")
|
9
|
-
dest="#{Environment.dev_root}/dep/#{k}"
|
10
|
-
add "svn export #{v} #{Environment.dev_root}/dep/#{k}" if !dest.include?("@")
|
11
|
-
add "svn export #{v} #{Environment.dev_root}/dep/#{k}@" if dest.include?("@")
|
12
|
-
end
|
13
|
-
}
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
data/lib/spec.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"name":"dev_tasks","version":"1.0.34"}
|
data/lib/svnexports.rb
DELETED
data/lib/teardown.rb
DELETED
data/lib/test.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
#require_relative('./commandarray.rb')
|
2
|
-
|
3
|
-
class Test #< CommandArray
|
4
|
-
|
5
|
-
def update
|
6
|
-
# rspec tests, 'rspec --pattern="**/*.spec"'
|
7
|
-
self.add 'rspec' if(Dir.glob("**/*spec.rb").length > 0)
|
8
|
-
|
9
|
-
test_files=collect_nunit_files
|
10
|
-
if(defined?(DEV_TASKS) && DEV_TASKS.has_key?(:files) && DEV_TASKS[:files].has_key?(:test))
|
11
|
-
test_files=DEV_TASKS[:files][:test]
|
12
|
-
end
|
13
|
-
|
14
|
-
if(!test_files.nil?)
|
15
|
-
test_files.each {|tf|
|
16
|
-
if(tf.include?('.dll'))
|
17
|
-
nunit_dll=tf
|
18
|
-
if(nunit_dll.include?('x86'))
|
19
|
-
self.add "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\""
|
20
|
-
else
|
21
|
-
self.add "\"#{Test.nunit_console}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\""
|
22
|
-
end
|
23
|
-
end
|
24
|
-
}
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def collect_nunit_files
|
29
|
-
results=Array.new
|
30
|
-
Dir.glob("*.csproj").each{|p|
|
31
|
-
text = File.read(p)
|
32
|
-
if(text.include?("nunit.framework.dll"))
|
33
|
-
# extract AssemblyName of form: <AssemblyName>MyLibrary.Test</AssemblyName>
|
34
|
-
assemblyName=text[/<AssemblyName>([\w\.]+)</,1]
|
35
|
-
outputPath=text[/Release[.\w\W]+<OutputPath>([\w\.\\]+)</,1]
|
36
|
-
if(!assemblyName.nil? && !outputPath.nil?)
|
37
|
-
results << "#{outputPath}\\#{assemblyName}.dll".gsub("\\\\","\\").gsub('/','\\')
|
38
|
-
end
|
39
|
-
end
|
40
|
-
}
|
41
|
-
results
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.nunit_console
|
45
|
-
nunit="C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console.exe"
|
46
|
-
nunit="C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console.exe" if(!File.exists?(nunit))
|
47
|
-
nunit
|
48
|
-
end
|
49
|
-
def self.nunit_console_x86
|
50
|
-
nunit="C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console-x86.exe"
|
51
|
-
nunit="C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console-x86.exe" if(!File.exists?(nunit))
|
52
|
-
nunit
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
data/lib/timer.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
class Timer
|
2
|
-
attr_accessor :start_time
|
3
|
-
|
4
|
-
def initialize
|
5
|
-
@start_time=Time.now
|
6
|
-
end
|
7
|
-
|
8
|
-
def elapsed # in seconds
|
9
|
-
return Time.now-@start_time
|
10
|
-
end
|
11
|
-
|
12
|
-
def elapsed_str
|
13
|
-
elapsed_str="[" + "%.0f" %(elapsed) + "s]"
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.elapsed_exceeds?(name,duration_seconds)
|
17
|
-
if(Timer.get_elapsed(name).nil? || Timer.get_elapsed(name) > duration_seconds)
|
18
|
-
return true
|
19
|
-
end
|
20
|
-
return false
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.get_elapsed(name)
|
24
|
-
timestamp=get_timestamp(name)
|
25
|
-
return Time.now-timestamp if(!timestamp.nil?)
|
26
|
-
nil
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.get_timestamp(name)
|
30
|
-
dir=Rake.application.original_dir
|
31
|
-
if(File.exists?("#{DEV[:dev_root]}/log/#{name}.timestamp"))
|
32
|
-
return Time.parse(File.read("#{DEV[:dev_root]}/log/#{name}.timestamp").strip)
|
33
|
-
end
|
34
|
-
nil
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.set_timestamp(name)
|
38
|
-
Dir.mkdir("#{DEV_TASKS[:dev_root]}/log") if(!Dir.exists?("#{DEV_TASKS[:dev_root]}/log"))
|
39
|
-
File.open("#{DEV_TASKS[:dev_root]}/log/#{name}.timestamp",'w'){|f|f.puts(Time.now.to_s)}
|
40
|
-
end
|
41
|
-
end
|