dev 1.0.100 → 1.0.101
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/Project.rb +3 -2
- data/lib/dev/SystemCall.rb +8 -3
- data/lib/dev/Tasks.rb +1 -1
- data/lib/dev.rb +7 -0
- metadata +1 -1
data/lib/dev/Project.rb
CHANGED
@@ -31,7 +31,7 @@ class Project < Hash
|
|
31
31
|
def execute_cmd(c)
|
32
32
|
# expand the command here....
|
33
33
|
command=expand_command(c)
|
34
|
-
puts_debug "command: " + command.to_s
|
34
|
+
puts_debug "command: " + command.to_s + " (in Project.execute_cmd)"
|
35
35
|
if c.include?('<%') && c.include?('%>')
|
36
36
|
#puts "Command: " + c
|
37
37
|
eval(c.gsub("<%","").gsub("%>",""))
|
@@ -111,7 +111,8 @@ class Project < Hash
|
|
111
111
|
def loc_total
|
112
112
|
# parse the output for TOTAL LOC
|
113
113
|
call=Dev::SystemCall.new(loc_cmd)
|
114
|
-
words=
|
114
|
+
words=Array.new
|
115
|
+
words=call.output.split if !call.nil? && !call.output.nil?
|
115
116
|
if(words.length>6)
|
116
117
|
return words[words.length-6]
|
117
118
|
end
|
data/lib/dev/SystemCall.rb
CHANGED
@@ -90,10 +90,12 @@ class SystemCall
|
|
90
90
|
capture_error=true if capture_error.nil?
|
91
91
|
capture_error=false unless capture_output
|
92
92
|
capture_error=false if capture_error == "false"
|
93
|
+
puts_debug "system2('#{@dir}','#{@command}',#{@capture_output.to_s},#{@capture_error.to_s}) (in SystemCall.execute)"
|
93
94
|
@status,@output,@error=system2(@dir,@command,@capture_output,@capture_error)
|
95
|
+
puts_debug "system2 call complete"
|
94
96
|
@end_time=Time.now
|
95
97
|
rescue
|
96
|
-
puts "error executing ruby code"
|
98
|
+
puts "error executing ruby code: #{@command}"
|
97
99
|
@status="1"
|
98
100
|
@end_time=Time.now
|
99
101
|
ensure
|
@@ -103,6 +105,7 @@ class SystemCall
|
|
103
105
|
end
|
104
106
|
|
105
107
|
def system2(working_dir,command,capture_output,capture_error)
|
108
|
+
puts_debug "begin SystemCall.system2"
|
106
109
|
capture_output=true if capture_output.nil?
|
107
110
|
capture_output=false if capture_output == "false"
|
108
111
|
capture_error=true if capture_error.nil?
|
@@ -111,11 +114,13 @@ class SystemCall
|
|
111
114
|
|
112
115
|
puts_debug "system2(" + working_dir.to_s + "," + command + ") capture_output(" + capture_output.to_s + ") capture_error(" + capture_error.to_s + ")"
|
113
116
|
filename=Dir.tmpdir + "/" + (0...8).map{65.+(rand(25)).chr}.join
|
117
|
+
puts_debug " filename=#{filename}"
|
114
118
|
working_dir = Dir.pwd if working_dir.nil? || working_dir.empty?
|
119
|
+
puts_debug " working_dir=#{working_dir}"
|
115
120
|
status=0
|
116
121
|
output=""
|
117
122
|
error=""
|
118
|
-
puts_debug " Dir.chdir(" + working_dir + ")"
|
123
|
+
#puts_debug " Dir.chdir(" + working_dir + ")"
|
119
124
|
Dir.chdir(working_dir) do
|
120
125
|
if(capture_output)
|
121
126
|
if(capture_error)
|
@@ -146,7 +151,7 @@ class SystemCall
|
|
146
151
|
end
|
147
152
|
status=$?.exitstatus
|
148
153
|
|
149
|
-
puts_debug
|
154
|
+
puts_debug "status = " + status.to_s
|
150
155
|
return status,output,error
|
151
156
|
end
|
152
157
|
|
data/lib/dev/Tasks.rb
CHANGED
@@ -43,7 +43,7 @@ def generate_tasks(project)
|
|
43
43
|
desc=v[:desc] if v.has_key?(:desc)
|
44
44
|
ruby="task :#{name} do; task_start '#{name}'; PROJECT.#{name}; end"
|
45
45
|
ruby="desc '#{desc}'; " + ruby unless desc.nil?
|
46
|
-
unless task_defined(name)
|
46
|
+
unless Rake::Task.task_defined?(name)
|
47
47
|
puts_debug "defining task " + name
|
48
48
|
eval(ruby)
|
49
49
|
end
|
data/lib/dev.rb
CHANGED
@@ -33,6 +33,13 @@ def puts_debug msg
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
# if DEV_DEBUG_VERBOSE is defined, puts_debug_verbose will send message to the console
|
37
|
+
def puts_debug_verbose msg
|
38
|
+
if(defined?(DEV_DEBUG_VERBOSE))
|
39
|
+
puts msg
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
36
43
|
puts_debug "read " + __FILE__.foreground(:green)
|
37
44
|
|
38
45
|
require "#{File.dirname(__FILE__)}/dev/Environment.rb"
|