dev 1.0.229 → 1.0.230
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dev/BoostBuild.rb +4 -1
- data/lib/dev/Commands.rb +8 -2
- data/lib/dev/Deps.rb +2 -0
- data/lib/dev/Project.rb +3 -0
- data/lib/dev/Scm.rb +17 -13
- data/lib/dev/Tasks.rb +4 -1
- data/lib/dev/cmd/Compile.rb +3 -0
- data/lib/dev/cmd/DeepPull.rb +49 -0
- data/lib/dev/cmd/Pull.rb +36 -0
- data/lib/dev/cmd/Replace.rb +4 -0
- data/lib/dev/cmd/Update.rb +1 -1
- data/lib/dev.rb +12 -0
- metadata +3 -2
- data/lib/dev/cmd/Push.rb +0 -14
data/lib/dev/BoostBuild.rb
CHANGED
@@ -13,7 +13,10 @@ class BoostBuild
|
|
13
13
|
end
|
14
14
|
return @@default_toolset if !@@default_toolset.nil?
|
15
15
|
begin
|
16
|
-
|
16
|
+
text=''
|
17
|
+
Dir.chdir(DEV_ROOT) { |dir|
|
18
|
+
text=`b2 --debug-configuration`
|
19
|
+
}
|
17
20
|
toolset=''
|
18
21
|
text.scan(/<toolset>([\.\w-]+)/).each{ | var_match |
|
19
22
|
toolset=var_match[0].to_s
|
data/lib/dev/Commands.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
["Compile","Replace","Setup","Test","Commit","Info","Update","
|
1
|
+
["Compile","Replace","Setup","Test","Commit","Info","Update","Pull","DeepPull","Build"].each{ |f| require_relative("cmd/#{f}.rb") }
|
2
2
|
|
3
3
|
module Dev
|
4
4
|
class Commands < Hash
|
@@ -10,12 +10,14 @@ class Commands < Hash
|
|
10
10
|
self[:test]=Dev::Cmd::Test.new
|
11
11
|
self[:commit]=Dev::Cmd::Commit.new
|
12
12
|
self[:update]=Dev::Cmd::Update.new
|
13
|
-
|
13
|
+
self[:pull]=Dev::Cmd::Pull.new
|
14
|
+
self[:deep_pull]=Dev::Cmd::DeepPull.new
|
14
15
|
refresh
|
15
16
|
end
|
16
17
|
|
17
18
|
def refresh
|
18
19
|
puts_debug "Dev::Command.refresh"
|
20
|
+
start_time=Time.now
|
19
21
|
self[:setup].refresh(DEV[:dep]) if self[:setup].respond_to?("refresh")
|
20
22
|
self[:replace].refresh(DEV[:dep]) if self[:replace].respond_to?("refresh")
|
21
23
|
self[:compile].refresh if self[:compile].respond_to?("refresh")
|
@@ -23,6 +25,8 @@ class Commands < Hash
|
|
23
25
|
self[:commit].refresh if self[:commit].respond_to?("refresh")
|
24
26
|
self[:update].refresh if self[:update].respond_to?("refresh")
|
25
27
|
self[:pull].refresh if self[:pull].respond_to?("refresh")
|
28
|
+
self[:deep_pull].refresh if self[:deep_pull].respond_to?("refresh")
|
29
|
+
puts_debug "Commands refresh elapsed time " + (Time.now-start_time).to_s
|
26
30
|
end
|
27
31
|
|
28
32
|
def info; Dev::Cmd::Info.execute; end
|
@@ -30,6 +34,8 @@ class Commands < Hash
|
|
30
34
|
def compile; execute_method "compile"; end
|
31
35
|
def test; execute_method "test"; end
|
32
36
|
def push; Dev::Cmd::Push.execute; end
|
37
|
+
def pull; Dev::Cmd::Pull.execute; end
|
38
|
+
def deep_pull; Dev::Cmd::DeepPull.execute; end
|
33
39
|
def update;execute_method("update");end
|
34
40
|
def replace
|
35
41
|
self[:replace].execute if self[:replace].respond_to?("execute")
|
data/lib/dev/Deps.rb
CHANGED
@@ -2,6 +2,7 @@ module Dev
|
|
2
2
|
class Deps < Hash
|
3
3
|
def refresh
|
4
4
|
puts_debug "Dev::Deps.refresh"
|
5
|
+
start_time=Time.now
|
5
6
|
self.each{ |k,v|
|
6
7
|
if !v.nil? && v.kind_of?(Hash)
|
7
8
|
v[:dir]=get_dir(v) if !v.has_key?(:dir)
|
@@ -9,6 +10,7 @@ class Deps < Hash
|
|
9
10
|
v[:uri]=get_uri(v)
|
10
11
|
end
|
11
12
|
}
|
13
|
+
puts_debug "Deps refresh elapsed time " + (Time.now-start_time).to_s
|
12
14
|
end
|
13
15
|
|
14
16
|
def get_dir(h)
|
data/lib/dev/Project.rb
CHANGED
@@ -58,10 +58,12 @@ class Project < Hash
|
|
58
58
|
|
59
59
|
def refresh
|
60
60
|
puts_debug "Dev::Project.refresh"
|
61
|
+
start_time=Time.now
|
61
62
|
self[:dep].refresh
|
62
63
|
#update_default_values
|
63
64
|
#db = Dev::Database.new
|
64
65
|
#db.set_branch_uri(self[:fullname],self[:scm_uri])
|
66
|
+
puts_debug "DEV refresh elapsed time " + (Time.now-start_time).to_s
|
65
67
|
end
|
66
68
|
|
67
69
|
def get_default_value_name
|
@@ -135,5 +137,6 @@ class Project < Hash
|
|
135
137
|
end
|
136
138
|
end # module Dev
|
137
139
|
|
140
|
+
puts_debug "creating DEV instance"
|
138
141
|
DEV=Dev::Project.new#(nil,true)
|
139
142
|
DEV[:start_time]=Time.now
|
data/lib/dev/Scm.rb
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
module Dev
|
2
2
|
class Scm
|
3
|
+
@@default=nil
|
4
|
+
|
3
5
|
attr_accessor :scm_type
|
4
6
|
|
5
7
|
def initialize
|
6
|
-
|
8
|
+
puts_debug "initalizing Scm"
|
7
9
|
call=Dev::SystemCall.new("svn info")
|
8
|
-
@scm_type=
|
9
|
-
|
10
|
-
|
11
|
-
@scm_type
|
12
|
-
|
10
|
+
@scm_type=nil
|
11
|
+
@scm_type = "svn" if call.output.include?("Last Changed Date:")
|
12
|
+
@scm_type = "svn" if @scm_type.nil? && File.exists?(".svn")
|
13
|
+
if(@scm_type.nil?)
|
14
|
+
call=Dev::SystemCall.new("git status")
|
15
|
+
@scm_type = "git" if call.output.include?("#")
|
16
|
+
@scm_type = "git" if @scm_type.nil? && File.exists?(".git")
|
17
|
+
end
|
18
|
+
puts_debug "scm_type = " + @scm_type.to_s
|
13
19
|
end
|
14
20
|
|
15
21
|
def file_tracked?(file)
|
@@ -108,13 +114,11 @@ class Scm
|
|
108
114
|
end
|
109
115
|
|
110
116
|
def self.get_default_scm_type
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
return
|
116
|
-
return "git" if File.exists?(".git")
|
117
|
-
return nil
|
117
|
+
if @@default.nil?
|
118
|
+
puts_debug "creating default instance of Scm"
|
119
|
+
@@default=Scm.new
|
120
|
+
end
|
121
|
+
return @@default.scm_type
|
118
122
|
end
|
119
123
|
|
120
124
|
end # class Scm
|
data/lib/dev/Tasks.rb
CHANGED
@@ -26,7 +26,8 @@ def generate_task_hash(project)
|
|
26
26
|
#:test=> { :desc=> 'run unit tests' },
|
27
27
|
:loc=> { :desc=> 'count the lines of code' },
|
28
28
|
#:setup=> { :desc=> 'setup the project environment' },
|
29
|
-
:pull=> { :desc=> '
|
29
|
+
:pull=> { :desc=> 'update dependencies in rakefile.rb to latest revision' },
|
30
|
+
:deep_pull=> { :desc=> 'pull and rake dependencies (nested dependencies first)' },
|
30
31
|
:check=> { :desc=> 'checks if the project default task may be skipped' }
|
31
32
|
}
|
32
33
|
if(!CMD[:setup].nil? && CMD[:setup].length > 0)
|
@@ -99,9 +100,11 @@ module Dev
|
|
99
100
|
class Tasks < Hash
|
100
101
|
def refresh
|
101
102
|
puts_debug "Dev::Tasks.refresh"
|
103
|
+
start_time=Time.now
|
102
104
|
DEV.refresh
|
103
105
|
CMD.refresh
|
104
106
|
generate_tasks(DEV)
|
107
|
+
puts_debug "Tasks refresh elapsed time " + (Time.now-start_time).to_s
|
105
108
|
end
|
106
109
|
end # class Tasks
|
107
110
|
end # module Dev
|
data/lib/dev/cmd/Compile.rb
CHANGED
@@ -4,6 +4,7 @@ class Compile < Array
|
|
4
4
|
def refresh
|
5
5
|
|
6
6
|
puts_debug "Dev::Cmd::Compile.refresh"
|
7
|
+
start_time=Time.now
|
7
8
|
strip_auto_entries
|
8
9
|
windows=RUBY_PLATFORM.include?("w32")
|
9
10
|
|
@@ -25,6 +26,8 @@ class Compile < Array
|
|
25
26
|
|
26
27
|
# gemspec
|
27
28
|
Dir.glob("*.gemspec").each { |gs| self << "{:cmd=> 'gem build #{gs}', :capture_output=> false, :auto=> true}" }
|
29
|
+
|
30
|
+
puts_debug "refresh elapsed time " + (Time.now-start_time).to_s
|
28
31
|
end
|
29
32
|
|
30
33
|
end # class Compile
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Dev
|
2
|
+
module Cmd
|
3
|
+
class DeepPull
|
4
|
+
def self.execute
|
5
|
+
|
6
|
+
puts "checking dependencies in #{DEV[:directory]}"
|
7
|
+
# loop over each DEP with dir: NAME@REVISION format
|
8
|
+
DEV[:dep].each {|key,value|
|
9
|
+
if(value.has_key?(:dir) && value[:dir].include?('@'))
|
10
|
+
|
11
|
+
# make sure working directory exist
|
12
|
+
dep_wrk_dir="#{DEV[:dev_root]}/wrk/#{value[:dir].gsub(/@[\d]+/,'')}"
|
13
|
+
dep_uri="#{value[:uri].gsub('@REV','')}"
|
14
|
+
|
15
|
+
puts "#{dep_wrk_dir}"
|
16
|
+
|
17
|
+
if(File.exists?(dep_wrk_dir))
|
18
|
+
Dir.chdir(dep_wrk_dir){|dir|
|
19
|
+
call=Dev::SystemCall.new('svn update')
|
20
|
+
call.puts_summary
|
21
|
+
}
|
22
|
+
else
|
23
|
+
call=Dev::SystemCall.new("svn co #{dep_uri} #{dep_wrk_dir}")
|
24
|
+
call.puts_summary
|
25
|
+
end
|
26
|
+
|
27
|
+
Dir.chdir(dep_wrk_dir){ |dir|
|
28
|
+
original_text = File.read("#{dep_wrk_dir}/rakefile.rb")
|
29
|
+
call=Dev::SystemCall.new('rake deep_pull')
|
30
|
+
call.puts_summary
|
31
|
+
current_text = File.read("#{dep_wrk_dir}/rakefile.rb")
|
32
|
+
if(original_text != current_text)
|
33
|
+
call=Dev::SystemCall.new('rake setup')
|
34
|
+
call.puts_summary
|
35
|
+
call=Dev::SystemCall.new('rake default')
|
36
|
+
call.puts_summary
|
37
|
+
end
|
38
|
+
}
|
39
|
+
end
|
40
|
+
}
|
41
|
+
|
42
|
+
# shallow pull in this
|
43
|
+
puts ""
|
44
|
+
Pull.execute
|
45
|
+
|
46
|
+
end
|
47
|
+
end # class DeepPull
|
48
|
+
end # module Cmd
|
49
|
+
end # module Dev
|
data/lib/dev/cmd/Pull.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Dev
|
2
|
+
module Cmd
|
3
|
+
class Pull
|
4
|
+
def self.execute
|
5
|
+
puts "checking dependencies in #{DEV[:directory]}"
|
6
|
+
|
7
|
+
text = File.read("#{DEV[:directory]}/rakefile.rb")
|
8
|
+
new_text = text
|
9
|
+
|
10
|
+
DEV[:dep].each {|key,value|
|
11
|
+
puts_debug "checking dep key #{key}"
|
12
|
+
if(value.has_key?(:dir) && value[:dir].include?('@'))
|
13
|
+
cmd="svn info #{value[:uri].gsub(/@[\d\w]+/,'')}"
|
14
|
+
puts_debug cmd
|
15
|
+
call=Dev::SystemCall.new(cmd)
|
16
|
+
call.puts_summary
|
17
|
+
info =call.output# %x[cmd]
|
18
|
+
#puts_debug info
|
19
|
+
new_revision = info.match(/Last Changed Rev: (?<rev>\d+)/)[:rev]
|
20
|
+
new_dir = value[:dir].gsub(/@[\d]+/,"@#{new_revision}")
|
21
|
+
puts_debug "new_dir=#{new_dir}"
|
22
|
+
if(new_dir != value[:dir])
|
23
|
+
puts "updating from #{value[:dir]} to #{new_dir}"
|
24
|
+
new_text = new_text.gsub(value[:dir],new_dir)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
}
|
28
|
+
|
29
|
+
if(text != new_text)
|
30
|
+
File.open("#{DEV[:directory]}/rakefile.rb",'w') { |f|f.write(new_text) }
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end # class Info
|
35
|
+
end # module Cmd
|
36
|
+
end # module Dev
|
data/lib/dev/cmd/Replace.rb
CHANGED
@@ -3,6 +3,7 @@ module Cmd
|
|
3
3
|
class Replace < Hash
|
4
4
|
def refresh(dep_hash)
|
5
5
|
puts_debug "Dev::Cmd::Replace.refresh"
|
6
|
+
refresh_start_time=Time.now
|
6
7
|
# remove all auto generated entries
|
7
8
|
self.each { |k,v|
|
8
9
|
self.delete k if v.kind_of?(Hash) && v.has_key?(:auto) && v[:auto]
|
@@ -39,6 +40,9 @@ class Replace < Hash
|
|
39
40
|
end
|
40
41
|
}
|
41
42
|
end
|
43
|
+
|
44
|
+
refresh_end_time=Time.now
|
45
|
+
puts_debug "replace refresh elapsed time " + (refresh_end_time-refresh_start_time).to_s
|
42
46
|
end
|
43
47
|
|
44
48
|
def execute
|
data/lib/dev/cmd/Update.rb
CHANGED
@@ -3,7 +3,7 @@ module Cmd
|
|
3
3
|
class Update < Array
|
4
4
|
def refresh
|
5
5
|
strip_auto_entries
|
6
|
-
self << "{:cmd=>'svn update',:auto=>true,:throw_on_error=>false}" if Scm.get_default_scm_type == "svn" #File.exists?(".svn")
|
6
|
+
self << "{:cmd=>'svn update',:auto=>true,:throw_on_error=>false}" if Scm.get_default_scm_type == "svn" #File.exists?(".svn")
|
7
7
|
end
|
8
8
|
end # class Compile
|
9
9
|
end # module Cmd
|
data/lib/dev.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
+
start_time=Time.now
|
4
|
+
|
3
5
|
Encoding.default_external=Encoding::UTF_8
|
4
6
|
Encoding.default_internal=Encoding::UTF_8
|
5
7
|
|
@@ -30,6 +32,9 @@ def puts_debug msg
|
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
35
|
+
puts_debug "dev.rb loading, after require 'semver' elapsed time " + (Time.now-start_time).to_s
|
36
|
+
start_time=Time.now
|
37
|
+
|
33
38
|
# if DEV_DEBUG_VERBOSE is defined, puts_debug_verbose will send message to the console
|
34
39
|
def puts_debug_verbose msg
|
35
40
|
if(defined?(DEV_DEBUG_VERBOSE))
|
@@ -39,7 +44,14 @@ end
|
|
39
44
|
|
40
45
|
puts_debug "read " + __FILE__.foreground(:green)
|
41
46
|
|
47
|
+
puts_debug "dev.rb loading, before loading ruby files (part 1) elapsed time " + (Time.now-start_time).to_s
|
48
|
+
start_time=Time.now
|
42
49
|
["Environment","Array","Hash","SystemCall","Scm","MsBuild","Paths","Dep","Deps","Database","BoostBuild","Project","Commands","Tasks"].each{ |f| require "#{File.dirname(__FILE__)}/dev/#{f}.rb" }
|
50
|
+
|
51
|
+
puts_debug "dev.rb loading, before loading ruby files (part 2) elapsed time " + (Time.now-start_time).to_s
|
52
|
+
start_time=Time.now
|
53
|
+
|
43
54
|
Dir["#{File.dirname(__FILE__)}/dev/**/*.rb"].each{ |f| require f }
|
55
|
+
puts_debug "dev.rb loading, after loading ruby files elapsed time " + (Time.now-start_time).to_s
|
44
56
|
|
45
57
|
DEV_ROOT=Dev::Environment.dev_root
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.230
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -217,8 +217,9 @@ files:
|
|
217
217
|
- lib/dev/cmd/Build.rb
|
218
218
|
- lib/dev/cmd/Commit.rb
|
219
219
|
- lib/dev/cmd/Compile.rb
|
220
|
+
- lib/dev/cmd/DeepPull.rb
|
220
221
|
- lib/dev/cmd/Info.rb
|
221
|
-
- lib/dev/cmd/
|
222
|
+
- lib/dev/cmd/Pull.rb
|
222
223
|
- lib/dev/cmd/Replace.rb
|
223
224
|
- lib/dev/cmd/Setup.rb
|
224
225
|
- lib/dev/cmd/Test.rb
|