dev 2.0.46 → 2.0.47
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.
- data/lib/dev_commands.rb +1063 -0
- data/lib/dev_environment.rb +42 -1
- data/lib/dev_git.rb +50 -3
- data/lib/dev_msbuild.rb +72 -0
- data/lib/dev_projects.rb +136 -5
- data/lib/dev_svn.rb +98 -1
- data/lib/dev_tasks.rb +84 -2
- metadata +2 -33
- data/lib/add.rb +0 -22
- data/lib/analyze.rb +0 -8
- data/lib/array.rb +0 -30
- data/lib/build.rb +0 -33
- data/lib/clean.rb +0 -12
- data/lib/clobber.rb +0 -15
- data/lib/command.rb +0 -208
- data/lib/commands.rb +0 -36
- data/lib/commit.rb +0 -20
- data/lib/doc.rb +0 -9
- data/lib/environment.rb +0 -49
- data/lib/gemspec.rb +0 -40
- data/lib/git.rb +0 -51
- data/lib/hash.rb +0 -21
- data/lib/info.rb +0 -3
- data/lib/internet.rb +0 -24
- data/lib/msbuild.rb +0 -70
- data/lib/project.rb +0 -64
- data/lib/projects.rb +0 -66
- data/lib/publish.rb +0 -21
- data/lib/pull.rb +0 -12
- data/lib/push.rb +0 -9
- data/lib/setup.rb +0 -25
- data/lib/svn.rb +0 -99
- data/lib/tasks.rb +0 -82
- data/lib/test.rb +0 -58
- data/lib/text.rb +0 -16
- data/lib/timeout.rb +0 -81
- data/lib/timer.rb +0 -41
- data/lib/update.rb +0 -6
- data/lib/upgrade.rb +0 -6
data/lib/command.rb
DELETED
@@ -1,208 +0,0 @@
|
|
1
|
-
require 'open3'
|
2
|
-
require_relative('./array.rb')
|
3
|
-
require_relative('./hash.rb')
|
4
|
-
require_relative('./timer.rb')
|
5
|
-
|
6
|
-
BUFFER_SIZE=1024 if(!defined?(BUFFER_SIZE))
|
7
|
-
|
8
|
-
# = Command
|
9
|
-
#
|
10
|
-
# execution of system commands
|
11
|
-
#
|
12
|
-
# = Keys
|
13
|
-
#
|
14
|
-
# - :input The input of the commands.
|
15
|
-
# - :timeout The timeout in seconds.
|
16
|
-
# a value of zero is to infinite timeout.
|
17
|
-
# defaults to zero
|
18
|
-
# - :directory The working directory for the command.
|
19
|
-
# defaults to the current directory
|
20
|
-
# - :exit_code The exit code of the command
|
21
|
-
# - :output The output contains the stdout output of the command
|
22
|
-
# - :error The error contains stderr output of the command
|
23
|
-
# - :machine The name of the machine the command executed on
|
24
|
-
# - :user The user name
|
25
|
-
# - :start_time
|
26
|
-
# - :end_time
|
27
|
-
#
|
28
|
-
class Command < Hash
|
29
|
-
def initialize command
|
30
|
-
|
31
|
-
self[:input] = ''
|
32
|
-
self[:timeout] = 0
|
33
|
-
self[:directory] = ''
|
34
|
-
self[:exit_code] = 0
|
35
|
-
self[:output] = ''
|
36
|
-
self[:error] = ''
|
37
|
-
self[:machine] = ''
|
38
|
-
self[:user] = ''
|
39
|
-
self[:start_time] = nil
|
40
|
-
self[:end_time] = nil
|
41
|
-
|
42
|
-
if(command.kind_of?(String))
|
43
|
-
self[:input] = command
|
44
|
-
end
|
45
|
-
|
46
|
-
if(command.kind_of?(Hash))
|
47
|
-
command.each{|k,v|
|
48
|
-
self[k.to_sym]=v
|
49
|
-
}
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def quiet?
|
54
|
-
(self.has_key?(:quiet) && self[:quiet])
|
55
|
-
end
|
56
|
-
|
57
|
-
def execute value=nil
|
58
|
-
|
59
|
-
if(!value.nil? && value.is_a?(Hash))
|
60
|
-
value.each{|k,v|self[k]=v}
|
61
|
-
end
|
62
|
-
|
63
|
-
pwd=Dir.pwd
|
64
|
-
self[:directory] = pwd if(!self.has_key?(:directory) || self[:directory].length==0)
|
65
|
-
|
66
|
-
if(self[:timeout] > 0)
|
67
|
-
puts "#{self[:input]} (#{self[:directory]}) timeout #{self[:timeout].to_s}" if(!quiet?)
|
68
|
-
else
|
69
|
-
puts "#{self[:input]} (#{self[:directory]})" if(!quiet?)
|
70
|
-
end
|
71
|
-
|
72
|
-
self[:machine] = Command.machine
|
73
|
-
self[:user] = Command.user
|
74
|
-
|
75
|
-
self[:start_time]=Time.now
|
76
|
-
timer=Timer.new
|
77
|
-
|
78
|
-
Dir.chdir(self[:directory]) do
|
79
|
-
if self[:input].include?('<%') && self[:input].include?('%>')
|
80
|
-
ruby = self[:input].gsub("<%","").gsub("%>","")
|
81
|
-
|
82
|
-
begin
|
83
|
-
self[:output]=eval(ruby)
|
84
|
-
rescue
|
85
|
-
self[:exit_code]=1
|
86
|
-
self[:error]="unable to eval(#{ruby})"
|
87
|
-
end
|
88
|
-
|
89
|
-
self[:elapsed] = timer.elapsed_str
|
90
|
-
self[:end_time] = Time.now
|
91
|
-
else
|
92
|
-
begin
|
93
|
-
if(self[:timeout] <= 0)
|
94
|
-
self[:output],self[:error],status= Open3.capture3(self[:input])
|
95
|
-
self[:exit_code]=status.to_i
|
96
|
-
self[:elapsed] = timer.elapsed_str
|
97
|
-
self[:end_time] = Time.now
|
98
|
-
else
|
99
|
-
require_relative 'timeout.rb'
|
100
|
-
#puts run_with_timeout(self[:input], self[:timeout], 1).to_s
|
101
|
-
#self[:output] = run_with_timeout(self[:input], self[:timeout], 1)
|
102
|
-
result=run_with_timeout(self[:directory],self[:input], self[:timeout], 2)
|
103
|
-
self[:output]=result[0]
|
104
|
-
self[:exit_code]=result[1]
|
105
|
-
|
106
|
-
self[:elapsed] = timer.elapsed_str
|
107
|
-
self[:end_time] = Time.now
|
108
|
-
|
109
|
-
if(timer.elapsed >= self[:timeout])
|
110
|
-
self[:exit_code]=1
|
111
|
-
self[:error] = self[:error] + "timed out"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
rescue Exception => e
|
115
|
-
self[:elapsed] = timer.elapsed_str
|
116
|
-
self[:end_time] = Time.now
|
117
|
-
self[:error] = "Exception: " + e.to_s
|
118
|
-
self[:exit_code]=1
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
|
124
|
-
if(self[:exit_code] != 0)
|
125
|
-
if(!quiet?)
|
126
|
-
puts "exit_code=#{self[:exit_code]}"
|
127
|
-
puts self[:output]
|
128
|
-
puts self[:error]
|
129
|
-
end
|
130
|
-
if(!self.has_key?(:ignore_failure) || !self[:ignore_failure])
|
131
|
-
raise "#{self[:input]} failed"
|
132
|
-
end #unless (self.has_key?(:ignore_failure) && self[:ignore_failure]==true)
|
133
|
-
end
|
134
|
-
|
135
|
-
end
|
136
|
-
|
137
|
-
def self.machine
|
138
|
-
if !ENV['COMPUTERNAME'].nil?
|
139
|
-
return ENV['COMPUTERNAME']
|
140
|
-
end
|
141
|
-
|
142
|
-
machine = `hostname`
|
143
|
-
machine = machine.split('.')[0] if machine.include?('.')
|
144
|
-
return machine.strip
|
145
|
-
end
|
146
|
-
|
147
|
-
def self.user
|
148
|
-
ENV['USER'].nil? ? ENV['USERNAME'] : ENV['USER']
|
149
|
-
end
|
150
|
-
|
151
|
-
def self.home
|
152
|
-
["USERPROFILE","HOME"].each {|v|
|
153
|
-
return ENV[v].gsub('\\','/') unless ENV[v].nil?
|
154
|
-
}
|
155
|
-
dir="~"
|
156
|
-
dir=ENV["HOME"] unless ENV["HOME"].nil?
|
157
|
-
dir=ENV["USERPROFILE"].gsub('\\','/') unless ENV["USERPROFILE"].nil?
|
158
|
-
return dir
|
159
|
-
end
|
160
|
-
|
161
|
-
def self.dev_root
|
162
|
-
["DEV_HOME","DEV_ROOT"].each {|v|
|
163
|
-
return ENV[v].gsub('\\','/') unless ENV[v].nil?
|
164
|
-
}
|
165
|
-
dir=home
|
166
|
-
#dir=ENV["DEV_ROOT"].gsub('\\','/') unless ENV["DEV_ROOT"].nil?
|
167
|
-
return dir
|
168
|
-
end
|
169
|
-
|
170
|
-
def self.exit_code command
|
171
|
-
cmd = Command.new(command)
|
172
|
-
cmd[:ignore_failure]=true
|
173
|
-
cmd[:quiet]=true
|
174
|
-
cmd.execute
|
175
|
-
cmd[:exit_code]
|
176
|
-
end
|
177
|
-
|
178
|
-
def self.output command
|
179
|
-
cmd = Command.new(command)
|
180
|
-
cmd[:ignore_failure]=true
|
181
|
-
cmd[:quiet]=true
|
182
|
-
cmd.execute
|
183
|
-
cmd[:output]
|
184
|
-
end
|
185
|
-
|
186
|
-
def summary
|
187
|
-
"#{self[:exit_code].to_s} #{self[:input]} (#{self[:directory]})"
|
188
|
-
end
|
189
|
-
|
190
|
-
def to_html
|
191
|
-
if self[:exit_code] == 0
|
192
|
-
[
|
193
|
-
'<div><table><tr><td width="20"></td><td><pre>',
|
194
|
-
self[:input],
|
195
|
-
'</pre></td></tr></table></div>'
|
196
|
-
].join
|
197
|
-
else
|
198
|
-
[
|
199
|
-
'<div><table><tr><td width="20"></td><td><pre>',
|
200
|
-
self[:input],
|
201
|
-
'</pre><table><tr><td width="20"></td><td><table>',
|
202
|
-
map { |k, v| ["<tr><td><strong>#{k}</strong></td>", v.respond_to?(:to_html) ? v.to_html : "<td><span><pre>#{v}</pre></span></td></tr>"] },
|
203
|
-
'</table>',
|
204
|
-
'</td></tr></table></td></tr></table></div>'
|
205
|
-
].join
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
data/lib/commands.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require_relative('hash.rb')
|
2
|
-
require_relative('pull.rb')
|
3
|
-
require_relative('update.rb')
|
4
|
-
require_relative('setup.rb')
|
5
|
-
require_relative('build.rb')
|
6
|
-
require_relative('test.rb')
|
7
|
-
require_relative('analyze.rb')
|
8
|
-
require_relative('publish.rb')
|
9
|
-
require_relative('doc.rb')
|
10
|
-
require_relative('clean.rb')
|
11
|
-
require_relative('clobber.rb')
|
12
|
-
require_relative('add.rb')
|
13
|
-
require_relative('commit.rb')
|
14
|
-
require_relative('push.rb')
|
15
|
-
|
16
|
-
class Commands < Hash
|
17
|
-
|
18
|
-
def initialize directory=Dir.pwd
|
19
|
-
Dir.chdir(directory) do
|
20
|
-
self[:pull]=Pull.new
|
21
|
-
self[:update]=Update.new
|
22
|
-
self[:setup]=Setup.new
|
23
|
-
self[:build]=Build.new
|
24
|
-
self[:test]=Test.new
|
25
|
-
self[:analyze]=Analyze.new
|
26
|
-
self[:doc]=Doc.new
|
27
|
-
self[:clean]=Clean.new
|
28
|
-
self[:publish]=Publish.new
|
29
|
-
self[:clobber]=Clobber.new
|
30
|
-
self[:add]=Add.new
|
31
|
-
self[:commit]=Commit.new
|
32
|
-
self[:push]=Push.new
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
data/lib/commit.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require_relative('internet.rb')
|
2
|
-
|
3
|
-
class Commit < Array
|
4
|
-
def update
|
5
|
-
if(File.exists?('.git') && `git config --list`.include?('user.name='))
|
6
|
-
if(!`git status`.include?('nothing to commit') &&
|
7
|
-
!`git status`.include?('untracked files present'))
|
8
|
-
if(File.exists?('commit.message') && File.read('commit.message').gsub(/\s+/,"").length >0)
|
9
|
-
add "git commit -a -v -m \"#{File.read('commit.message')}\""
|
10
|
-
else
|
11
|
-
add "git commit -m'all'"
|
12
|
-
end
|
13
|
-
add "<%FileUtils.rm('commit.message')%>" if File.exists?('commit.message')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
if(File.exists?('.svn') && Internet.available?)
|
17
|
-
add 'svn commit -m"commit all"'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/doc.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
class Doc < Array
|
2
|
-
def update
|
3
|
-
#cmd=Command.new ({ :input => 'yard --version', :ignore_failure => true})
|
4
|
-
#cmd.execute
|
5
|
-
if(Command.exit_code('yard --version'))
|
6
|
-
add 'yard doc - LICENSE' if File.exists?('README.md') && File.exists?('LICENSE')
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
data/lib/environment.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
class Environment < Hash
|
2
|
-
|
3
|
-
def initialize
|
4
|
-
self[:home]=Environment.home
|
5
|
-
self[:machine]=Environment.machine
|
6
|
-
self[:user]=Environment.user
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.home
|
10
|
-
["USERPROFILE","HOME"].each {|v|
|
11
|
-
return ENV[v].gsub('\\','/') unless ENV[v].nil?
|
12
|
-
}
|
13
|
-
dir="~"
|
14
|
-
dir=ENV["HOME"] unless ENV["HOME"].nil?
|
15
|
-
dir=ENV["USERPROFILE"].gsub('\\','/') unless ENV["USERPROFILE"].nil?
|
16
|
-
return dir
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.machine
|
20
|
-
if !ENV['COMPUTERNAME'].nil?
|
21
|
-
return ENV['COMPUTERNAME']
|
22
|
-
end
|
23
|
-
|
24
|
-
machine = `hostname`
|
25
|
-
machine = machine.split('.')[0] if machine.include?('.')
|
26
|
-
return machine.strip
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.user
|
30
|
-
return ENV['USER'] if !ENV['USER'].nil? #on Unix
|
31
|
-
ENV['USERNAME']
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.dev_root
|
35
|
-
["DEV_HOME","DEV_ROOT"].each {|v|
|
36
|
-
if !ENV[v].nil?
|
37
|
-
if(ENV[v].include?(';'))
|
38
|
-
ENV[v].split(';').each{|d|
|
39
|
-
return d if File.exists?(d)
|
40
|
-
}
|
41
|
-
else
|
42
|
-
return ENV[v].gsub('\\','/')
|
43
|
-
end
|
44
|
-
end
|
45
|
-
}
|
46
|
-
dir=home
|
47
|
-
return dir
|
48
|
-
end
|
49
|
-
end
|
data/lib/gemspec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
class Gemspec
|
2
|
-
def self.update gemspec_file
|
3
|
-
Text.replace_in_file gemspec_file,
|
4
|
-
/('\d{4}-\d{2}-\d{2}')/,
|
5
|
-
"'#{Time.now.strftime('%Y-%m-%d')}'"
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.gemfile gemspec_file
|
9
|
-
spec=Gem::Specification.load(gemspec_file)
|
10
|
-
return "#{spec.name}-#{spec.version}.gem" if !spec.nil?
|
11
|
-
return ""
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.version gemspec_file
|
15
|
-
spec=Gem::Specification.load(gemspec_file)
|
16
|
-
return spec.version.to_s
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.published_version gemspec_file
|
20
|
-
published_version=''
|
21
|
-
spec=Gem::Specification.load(gemspec_file)
|
22
|
-
begin
|
23
|
-
published_version = `gem list -r #{spec.name}`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
|
24
|
-
rescue
|
25
|
-
published_version=''
|
26
|
-
end
|
27
|
-
published_version
|
28
|
-
end
|
29
|
-
def self.published? gemspec_file
|
30
|
-
published_version(gemspec_file)==version(gemspec_file) ? true : false
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.normalize gemspec_file
|
34
|
-
spec=Gem::Specification.load(gemspec_file)
|
35
|
-
File.open(gemspec_file,'w'){|f|f.write(spec.to_ruby)}
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.upgrade gemspec_file
|
39
|
-
end
|
40
|
-
end
|
data/lib/git.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
class Git
|
2
|
-
def self.branch directory=''
|
3
|
-
directory=Dir.pwd if directory.length == 0
|
4
|
-
Dir.chdir(directory) do
|
5
|
-
begin
|
6
|
-
`git branch`.scan(/\* ([.\w-]+)/)[0][0] if(File.exists?('.git'))
|
7
|
-
rescue
|
8
|
-
''
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.remote_origin directory=''
|
14
|
-
url=''
|
15
|
-
directory=Dir.pwd if directory.length == 0
|
16
|
-
Dir.chdir(directory) do
|
17
|
-
begin
|
18
|
-
url=`git remote show origin`.scan(/Fetch URL: ([\.\-:\/\w\d]+)/)[0][0] if(File.exists?('.git'))
|
19
|
-
rescue
|
20
|
-
url=''
|
21
|
-
end
|
22
|
-
end
|
23
|
-
url
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.has_changes? directory=''
|
27
|
-
directory=Dir.pwd if directory.length==0
|
28
|
-
Dir.chdir(directory) do
|
29
|
-
if(File.exists?('.git'))
|
30
|
-
return true if `git status`.include?('modified:')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
false
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.init directory=''
|
37
|
-
directory=Dir.pwd if directory.length==0
|
38
|
-
FileUtils.mkpath directory if !File.exists?(directory)
|
39
|
-
if(!File.exists?("#{directory}/.git"))
|
40
|
-
Dir.chdir(directory) do
|
41
|
-
`git init`
|
42
|
-
File.open('.gitignore','w'){|f|
|
43
|
-
f.puts '### Mac ###'
|
44
|
-
f.puts '*.DS_Store'
|
45
|
-
}
|
46
|
-
`git add .gitignore`
|
47
|
-
`git commit -m'added .gitignore'`
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/hash.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
def execute value=nil
|
3
|
-
self.each{|k,v|
|
4
|
-
v.update if v.respond_to?(:update)
|
5
|
-
if(v.is_a?(Array) && v.length==0)
|
6
|
-
self.delete k
|
7
|
-
else
|
8
|
-
#puts "executing #{k}"
|
9
|
-
|
10
|
-
v.execute(value) if v.respond_to?(:execute)
|
11
|
-
end
|
12
|
-
}
|
13
|
-
end
|
14
|
-
def to_html
|
15
|
-
[
|
16
|
-
'<div>',
|
17
|
-
map { |k, v| ["<br/><div><strong>#{k}</strong>", v.respond_to?(:to_html) ? v.to_html : "<span>#{v}</span></div><br/>"] },
|
18
|
-
'</div>'
|
19
|
-
].join
|
20
|
-
end
|
21
|
-
end
|
data/lib/info.rb
DELETED
data/lib/internet.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
#require 'net/http'
|
3
|
-
require 'timeout'
|
4
|
-
class Internet
|
5
|
-
|
6
|
-
@@available=true
|
7
|
-
|
8
|
-
def self.available?
|
9
|
-
return @@available if !@@available.nil?
|
10
|
-
|
11
|
-
begin
|
12
|
-
index=open('http://www.google.com').read
|
13
|
-
if index.include?('<Title>Google')
|
14
|
-
@@available = true
|
15
|
-
else
|
16
|
-
puts "open('http://www.google.com') returned false"
|
17
|
-
end
|
18
|
-
rescue Exception => e
|
19
|
-
puts "open('http://www.google.com') raised an exception: #{e.to_s}"
|
20
|
-
@@available = false
|
21
|
-
end
|
22
|
-
@@available
|
23
|
-
end
|
24
|
-
end
|
data/lib/msbuild.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# Visual Studio 2008 version 9.0, solution format version 10.00
|
2
|
-
# Visual Studio 2010 version 10.0, solution format version 11.00
|
3
|
-
# Visual Studio 2012 version 11.0, solution format version 12.00
|
4
|
-
# Visual Studio 2013 version 12.0, solution format version 12.00
|
5
|
-
class MSBuild < Hash
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
self[:vs9]="C:\\Windows\\Microsoft.NET\\Framework\\v3.5\\msbuild.exe" if(File.exists?("C:\\Windows\\Microsoft.NET\\Framework\\v3.5\\msbuild.exe"))
|
9
|
-
self[:vs12]="C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\msbuild.exe" if(File.exists?("C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\msbuild.exe"))
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.has_version? version
|
13
|
-
if(defined?(MSBUILD))
|
14
|
-
MSBUILD.has_key?(version)
|
15
|
-
else
|
16
|
-
msb=MSBuild.new
|
17
|
-
return msb.has_key? version
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.get_version version
|
22
|
-
if(defined?(MSBUILD))
|
23
|
-
MSBUILD[version]
|
24
|
-
else
|
25
|
-
msb=MSBuild.new
|
26
|
-
return msb[version]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.get_vs_version(sln_filename)
|
31
|
-
sln_text=File.read(sln_filename,:encoding=>'UTF-8')
|
32
|
-
return :vs9 if sln_text.include?('Format Version 10.00')
|
33
|
-
return :vs12
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.get_configurations(sln_filename)
|
37
|
-
configs=Array.new
|
38
|
-
sln_text=File.read(sln_filename,:encoding=>'UTF-8')
|
39
|
-
sln_text.scan( /= ([\w]+)\|/ ).each{|m|
|
40
|
-
c=m.first.to_s
|
41
|
-
configs << c if !configs.include?(c)
|
42
|
-
}
|
43
|
-
return configs
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.get_platforms(sln_filename)
|
47
|
-
platforms=Array.new
|
48
|
-
sln_text=File.read(sln_filename,:encoding=>"UTF-8")
|
49
|
-
sln_text.scan( /= [\w]+\|([\w ]+)/ ).each{|m|
|
50
|
-
p=m.first.to_s
|
51
|
-
platforms << p if !platforms.include?(p)
|
52
|
-
}
|
53
|
-
return platforms
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.get_build_commands sln_filename
|
57
|
-
build_commands=nil
|
58
|
-
vs_version=MSBuild.get_vs_version(sln_filename)
|
59
|
-
if(MSBuild.has_version?(vs_version))
|
60
|
-
MSBuild.get_configurations(sln_filename).each{ |configuration|
|
61
|
-
MSBuild.get_platforms(sln_filename).each{|platform|
|
62
|
-
build_commands=Array.new if build_commands.nil?
|
63
|
-
build_commands << "\"#{MSBuild.get_version(vs_version)}\" \"#{sln_filename}\" /nologo /p:Configuration=#{configuration} /p:Platform=\"#{platform}\""
|
64
|
-
}
|
65
|
-
}
|
66
|
-
end
|
67
|
-
build_commands
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
data/lib/project.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'dev_commands'
|
3
|
-
|
4
|
-
class Project < Hash
|
5
|
-
attr_accessor :filename
|
6
|
-
def initialize value=''
|
7
|
-
@filename=''
|
8
|
-
self[:url]=''
|
9
|
-
self[:url] = value if value.is_a?(String)
|
10
|
-
if(value.is_a?(Hash))
|
11
|
-
value.each{|k,v|self[k]=v}
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def name
|
16
|
-
self[:name]
|
17
|
-
end
|
18
|
-
|
19
|
-
def get_latest_unique_id
|
20
|
-
'51ed9c9d45ba3979c808740d75ba1831c85aff5d'
|
21
|
-
end
|
22
|
-
|
23
|
-
def wrk_dir
|
24
|
-
"#{Environment.dev_root}/wrk/#{self.name}"
|
25
|
-
end
|
26
|
-
|
27
|
-
def pull
|
28
|
-
if(File.exists?(wrk_dir) && File.exists?("#{wrk_dir}/.git"))
|
29
|
-
Dir.chdir(wrk_dir) do
|
30
|
-
puts "git pull (#{wrk_dir})"
|
31
|
-
puts `git pull`
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def clone
|
37
|
-
if(!File.exists?(wrk_dir) && self[:url].include?('.git'))
|
38
|
-
puts "cloning #{self[:url]} to #{self.wrk_dir}"
|
39
|
-
puts `git clone #{self[:url]} #{self.wrk_dir}`
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def checkout
|
44
|
-
if(!File.exists?(wrk_dir) && self[:url].include?('svn'))
|
45
|
-
puts "checkout #{self.url} to #{self.wrk_dir}"
|
46
|
-
puts `svn checkout #{self.url} #{self.wrk_dir}`
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def rake
|
51
|
-
if(!File.exists?(self.wrk_dir))
|
52
|
-
clone
|
53
|
-
checkout
|
54
|
-
end
|
55
|
-
if(File.exists?(self.wrk_dir))
|
56
|
-
Dir.chdir(self.wrk_dir) do
|
57
|
-
rake = Command.new({ :input => 'rake', :timeout => 300, :ignore_failure => true })
|
58
|
-
rake.execute
|
59
|
-
puts rake.summary
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
data/lib/projects.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'rake'
|
3
|
-
require 'dev_git'
|
4
|
-
require 'dev_svn'
|
5
|
-
require 'dev_msbuild'
|
6
|
-
require 'dev_environment'
|
7
|
-
|
8
|
-
class Projects < Hash
|
9
|
-
attr_accessor :filename
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
@filename=''
|
13
|
-
end
|
14
|
-
|
15
|
-
def update
|
16
|
-
self.each{|k,v|
|
17
|
-
self[k]=Project.new(v) if(v.is_a?(String))
|
18
|
-
self[k]=Project.new(v) if(!v.is_a?(Project) && v.is_a?(Hash))
|
19
|
-
self[k][:name]=k
|
20
|
-
#self[k].update if self[k].respond_to?("update".to_sym)
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
def save filename=''
|
25
|
-
@filename=filename if !filename.nil? && filename.length > 0
|
26
|
-
File.open(@filename,'w'){|f|f.write(JSON.pretty_generate(self))} if @filename.length > 0
|
27
|
-
end
|
28
|
-
|
29
|
-
def open filename=''
|
30
|
-
@filename=filename if filename.length > 0
|
31
|
-
JSON.parse(IO.read(@filename)).each{|k,v| self[k]=v}
|
32
|
-
update
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.user_projects_filename
|
36
|
-
FileUtils.mkdir("#{Environment.dev_root}/data") if(!File.exists?("#{Environment.dev_root}/data"))
|
37
|
-
"#{Environment.dev_root}/data/PROJECTS.json"
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.current
|
41
|
-
project=nil
|
42
|
-
url=Git.remote_origin
|
43
|
-
url=Svn.url if url.length==0
|
44
|
-
if(Rake.application.original_dir.include?('/wrk/') &&
|
45
|
-
url.length > 0)
|
46
|
-
project=Project.new(url)
|
47
|
-
name=Rake.application.original_dir.gsub("#{Environment.dev_root}/wrk/",'')
|
48
|
-
project[:name] = name if(name.length>0 && !name.include?(Environment.dev_root))
|
49
|
-
if(defined?(PROJECTS))
|
50
|
-
PROJECTS[name]=project if(!PROJECTS.has_key?(name))
|
51
|
-
project.each{|k,v|PROJECTS[name][k]=v}
|
52
|
-
PROJECTS.save
|
53
|
-
else
|
54
|
-
project[:name]=name
|
55
|
-
end
|
56
|
-
end
|
57
|
-
project
|
58
|
-
end
|
59
|
-
|
60
|
-
def pull
|
61
|
-
self.each{|k,v| v.pull if v.respond_to?("pull".to_sym)}
|
62
|
-
end
|
63
|
-
def rake
|
64
|
-
self.each{|k,v| v.rake if v.respond_to?("rake".to_sym)}
|
65
|
-
end
|
66
|
-
end
|
data/lib/publish.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require_relative('internet.rb')
|
2
|
-
class Publish < Array
|
3
|
-
def update
|
4
|
-
if(Internet.available?)
|
5
|
-
if(File.exists?('.git'))
|
6
|
-
if(`git branch`.include?('* master'))
|
7
|
-
Dir.glob('*.gemspec').each{|gemspec_file|
|
8
|
-
add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
|
9
|
-
}
|
10
|
-
end
|
11
|
-
end
|
12
|
-
if(File.exists?('.svn'))
|
13
|
-
if(`svn info`.include?('/trunk'))
|
14
|
-
Dir.glob('*.gemspec').each{|gemspec_file|
|
15
|
-
add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
|
16
|
-
}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|