dev 1.0.224 → 1.0.225
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/README +1 -1
- data/lib/dev/Project.rb +34 -0
- data/lib/dev/Tasks.rb +8 -2
- metadata +1 -1
data/README
CHANGED
@@ -64,7 +64,7 @@ these task will be executed in the correct sequence (either before or after comp
|
|
64
64
|
|
65
65
|
the default task is automatically generated by require 'dev'. It will be defined as dependent on the following tasks if they are defined:
|
66
66
|
["check","setup","replace","pre_compile","compile","post_compile","pre_test",
|
67
|
-
"test","post_test","log_build_products","add","commit","update","finalize"]
|
67
|
+
"test","post_test","log_build_products","add","commit","update","remove_all_but_build_products","finalize"]
|
68
68
|
to prevent the default task from being defined, define DEV_NO_DEFAULT_TASK prior to require 'dev'
|
69
69
|
DEV_NO_DEFAULT_TASK=1
|
70
70
|
require 'dev'
|
data/lib/dev/Project.rb
CHANGED
@@ -123,6 +123,40 @@ class Project < Hash
|
|
123
123
|
File.open("#{name}.taskstamp." + context,"w") { |f| f.write(Time.now.to_s) }
|
124
124
|
end
|
125
125
|
|
126
|
+
def remove_all_but_build_products
|
127
|
+
if(!File.exists?('build_products.txt'))
|
128
|
+
puts 'build_products.txt does not exist'
|
129
|
+
else
|
130
|
+
build_products=Array.new
|
131
|
+
File.open('build_products.txt').each {|line|
|
132
|
+
build_products << line.strip
|
133
|
+
}
|
134
|
+
build_products << 'rakefile.rb'
|
135
|
+
build_products << 'build_products.txt'
|
136
|
+
|
137
|
+
Dir.glob('**/*').each {|f|
|
138
|
+
begin
|
139
|
+
if(build_products.include?(f))
|
140
|
+
puts "leaving " + f
|
141
|
+
else
|
142
|
+
if(!File.directory?(f))
|
143
|
+
puts "deleting " + f
|
144
|
+
FileUtils.rm(f)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
rescue
|
148
|
+
end
|
149
|
+
}
|
150
|
+
Dir.glob("**/*").select { |d|
|
151
|
+
File.directory?(d)
|
152
|
+
}.reverse_each { |d|
|
153
|
+
if ((Dir.entries(d) - %w[ . .. ]).empty?)
|
154
|
+
Dir.rmdir(d)
|
155
|
+
end
|
156
|
+
}
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
126
160
|
end
|
127
161
|
end # module Dev
|
128
162
|
|
data/lib/dev/Tasks.rb
CHANGED
@@ -57,7 +57,7 @@ def generate_task_hash(project)
|
|
57
57
|
task_hash[:commit]={ :desc=> 'commit changes to source code management' }
|
58
58
|
task_hash[:update]={ :desc=> 'updates changes from source code management' }
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
task_hash[:compile] = { :desc=> 'compile source code' } if CMD.has_key?(:compile) && CMD[:compile].length > 0 #project.has_key?(:compile) && project[:compile].length > 0
|
62
62
|
task_hash[:replace] = { :desc=> 'replace text' } if CMD.has_key?(:replace) && CMD[:replace].length > 0
|
63
63
|
task_hash[:test]={:desc=>'run unit tests'} if CMD.has_key?(:test) && CMD[:test].length > 0
|
@@ -86,11 +86,17 @@ def generate_tasks(project)
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
if(DEV[:directory].include?("#{DEV[:dev_root]}/dep") && BUILD_PRODUCTS.to_a.length > 0)
|
90
|
+
ruby="task :remove_all_but_build_products do; task_start 'remove_all_but_build_products'; DEV.remove_all_but_build_products; end"
|
91
|
+
ruby="desc 'remove all files but build products'; " + ruby
|
92
|
+
eval(ruby)
|
93
|
+
end
|
94
|
+
|
89
95
|
# generate default task
|
90
96
|
if(!defined?(DEV_NO_DEFAULT_TASK))
|
91
97
|
Rake.application.instance_variable_get('@tasks').delete('default')
|
92
98
|
task_list=""
|
93
|
-
default_task_order=["check","setup","replace","pre_compile","compile","post_compile","pre_test","test","post_test","log_build_products","add","commit","update","finalize"]
|
99
|
+
default_task_order=["check","setup","replace","pre_compile","compile","post_compile","pre_test","test","post_test","log_build_products","add","commit","update","remove_all_but_build_products","finalize"]
|
94
100
|
if(defined?(DEFAULT_TASK_ORDER))
|
95
101
|
default_task_order = DEFAULT_TASK_ORDER
|
96
102
|
end
|