dev 1.0.225 → 1.0.227
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 +4 -5
- data/lib/dev/Commands.rb +3 -2
- data/lib/dev/Project.rb +7 -32
- data/lib/dev/SystemCall.rb +0 -11
- data/lib/dev/Tasks.rb +6 -31
- data/lib/dev/cmd/Info.rb +0 -1
- data/lib/dev/cmd/Push.rb +14 -0
- metadata +18 -3
- data/lib/dev/cmd/Clean.rb +0 -26
- data/lib/dev/cmd/Pull.rb +0 -33
data/README
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
=dev
|
2
|
-
The dev gem may be used to auto generate rake tasks for a rakefile.rb
|
3
|
-
|
4
|
-
of the directory in which
|
1
|
+
=dev {<img src="https://badge.fury.io/rb/dev.png" alt="Gem Version" />}[http://badge.fury.io/rb/dev]
|
2
|
+
The dev gem may be used to auto generate rake tasks for a rakefile.rb.
|
3
|
+
The gem defined DEV as a hash, which is populated based on the content
|
4
|
+
of the directory in which the rakefile.rb resides.
|
5
5
|
The dev gem provides task definitions to support the development of ruby,c#,c++ and c projects.
|
6
6
|
The DEV variable may be manipulated to modify the behavior of defined tasks or to
|
7
7
|
cause additional task to be generated.
|
@@ -31,7 +31,6 @@ DEV may define several keys automatically
|
|
31
31
|
CLEAN.include('doc')
|
32
32
|
====CLOBBER is a Rake::FileList that specifies file(s) to be removed during the clobber task.
|
33
33
|
CLOBBER.include('obj')
|
34
|
-
====BUILD_PRODUCTS is a Rake::FileList that specified file(s) that are required to consume the project.
|
35
34
|
===Tasks
|
36
35
|
dev will automatically generated the following tasks as applicable.
|
37
36
|
rake add # add files defined by src_glob to source code management, not generated if no scm can be detected.
|
data/lib/dev/Commands.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
["
|
1
|
+
["Compile","Replace","Setup","Test","Commit","Info","Update","Push","Build"].each{ |f| require_relative("cmd/#{f}.rb") }
|
2
2
|
|
3
3
|
module Dev
|
4
4
|
class Commands < Hash
|
@@ -10,7 +10,7 @@ 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
|
-
self[:pull]=Dev::Cmd::Pull.new
|
13
|
+
#self[:pull]=Dev::Cmd::Pull.new
|
14
14
|
refresh
|
15
15
|
end
|
16
16
|
|
@@ -29,6 +29,7 @@ class Commands < Hash
|
|
29
29
|
def setup; execute_method "setup"; end
|
30
30
|
def compile; execute_method "compile"; end
|
31
31
|
def test; execute_method "test"; end
|
32
|
+
def push; Dev::Cmd::Push.execute; end
|
32
33
|
def update;execute_method("update");end
|
33
34
|
def replace
|
34
35
|
self[:replace].execute if self[:replace].respond_to?("execute")
|
data/lib/dev/Project.rb
CHANGED
@@ -36,6 +36,7 @@ class Project < Hash
|
|
36
36
|
ENV["VisualStudioVersion"]="11.0" if h[:toolset]=="msvc-11.0"
|
37
37
|
end
|
38
38
|
|
39
|
+
|
39
40
|
puts_debug "Dev::Project.defaults :type"
|
40
41
|
h[:type]="gem"
|
41
42
|
puts_debug "Dev::Project.defaults B"
|
@@ -123,38 +124,12 @@ class Project < Hash
|
|
123
124
|
File.open("#{name}.taskstamp." + context,"w") { |f| f.write(Time.now.to_s) }
|
124
125
|
end
|
125
126
|
|
126
|
-
def
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
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
|
127
|
+
def dep?
|
128
|
+
return self[:directory].include?("#{self[:dev_root]}/dep/")
|
129
|
+
end
|
130
|
+
|
131
|
+
def wrk?
|
132
|
+
return self[:directory].include?("#{self[:dev_root]}/wrk/")
|
158
133
|
end
|
159
134
|
|
160
135
|
end
|
data/lib/dev/SystemCall.rb
CHANGED
@@ -171,17 +171,6 @@ class SystemCall
|
|
171
171
|
status=$?.exitstatus
|
172
172
|
return status,output,error
|
173
173
|
end
|
174
|
-
|
175
|
-
def self.clean_tmp_files
|
176
|
-
puts "clean temporary files in #{Dir.tmpdir}"
|
177
|
-
Dir.glob("#{Dir.tmpdir}/*.{out,err}").each{ |f|
|
178
|
-
begin
|
179
|
-
FileUtils.rm(f)
|
180
|
-
rescue
|
181
|
-
warn "unable to remove file #{f}.err"
|
182
|
-
end
|
183
|
-
}
|
184
|
-
end
|
185
174
|
|
186
175
|
def puts_summary
|
187
176
|
puts_summary2(@throw_on_error)
|
data/lib/dev/Tasks.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
puts_debug "read " + __FILE__.foreground(:green)
|
2
2
|
|
3
3
|
require 'rake'
|
4
|
+
require 'tmpdir'
|
4
5
|
|
5
6
|
if("#{RUBY_VERSION}">"1.9.1")
|
6
7
|
include Rake::DSL
|
@@ -11,34 +12,14 @@ def task_start(task_name)
|
|
11
12
|
puts "[:#{task_name}]".foreground(:yellow).bright + " " + Dir.pwd
|
12
13
|
end
|
13
14
|
|
14
|
-
task :clean do;
|
15
|
-
task_start "clean";
|
16
|
-
puts " cleaning tmp dir (max 30 seconds)"
|
17
|
-
Dev::SystemCall.clean_tmp_files
|
18
|
-
Dev::Cmd::Clean.clean_tmp
|
15
|
+
task :clean do; task_start "clean";
|
19
16
|
end
|
20
17
|
task :clobber do; task_start "clobber"; end
|
21
18
|
|
22
|
-
task :log_build_products do
|
23
|
-
task_start "log_build_products"
|
24
|
-
items=BUILD_PRODUCTS.to_a
|
25
|
-
if(items.nil? || items.empty?)
|
26
|
-
puts " no BUILD_PRODUCTS defined."
|
27
|
-
else
|
28
|
-
File.open('build_products.txt','w') {|f|
|
29
|
-
puts " BUILD_PRODUCTS (#{items.length}):"
|
30
|
-
items.each{|item|
|
31
|
-
puts " " + item
|
32
|
-
f.puts(item)
|
33
|
-
}
|
34
|
-
}
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
19
|
require 'rake/clean'
|
39
|
-
CLEAN.include('doc','*.
|
40
|
-
CLOBBER.include('bin','obj')
|
41
|
-
|
20
|
+
CLEAN.include('doc','*.taskstamp*','**/*.{suo,sdf}')
|
21
|
+
CLOBBER.include('bin','obj',"#{Dir.tmpdir}/*{err,out}",'*.gem')
|
22
|
+
|
42
23
|
def generate_task_hash(project)
|
43
24
|
task_hash = {
|
44
25
|
:info=> { :desc=> 'display information about the rakefile' },
|
@@ -86,17 +67,11 @@ def generate_tasks(project)
|
|
86
67
|
end
|
87
68
|
end
|
88
69
|
|
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
|
-
|
95
70
|
# generate default task
|
96
71
|
if(!defined?(DEV_NO_DEFAULT_TASK))
|
97
72
|
Rake.application.instance_variable_get('@tasks').delete('default')
|
98
73
|
task_list=""
|
99
|
-
default_task_order=["check","setup","replace","pre_compile","compile","post_compile","pre_test","test","post_test","
|
74
|
+
default_task_order=["check","setup","replace","pre_compile","compile","post_compile","pre_test","test","post_test","add","commit","update","clean","finalize"]
|
100
75
|
if(defined?(DEFAULT_TASK_ORDER))
|
101
76
|
default_task_order = DEFAULT_TASK_ORDER
|
102
77
|
end
|
data/lib/dev/cmd/Info.rb
CHANGED
data/lib/dev/cmd/Push.rb
ADDED
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.227
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -139,6 +139,22 @@ dependencies:
|
|
139
139
|
- - ! '>='
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: json
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
142
158
|
- !ruby/object:Gem::Dependency
|
143
159
|
name: rspec
|
144
160
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,11 +215,10 @@ files:
|
|
199
215
|
- lib/dev/Array.rb
|
200
216
|
- lib/dev/BoostBuild.rb
|
201
217
|
- lib/dev/cmd/Build.rb
|
202
|
-
- lib/dev/cmd/Clean.rb
|
203
218
|
- lib/dev/cmd/Commit.rb
|
204
219
|
- lib/dev/cmd/Compile.rb
|
205
220
|
- lib/dev/cmd/Info.rb
|
206
|
-
- lib/dev/cmd/
|
221
|
+
- lib/dev/cmd/Push.rb
|
207
222
|
- lib/dev/cmd/Replace.rb
|
208
223
|
- lib/dev/cmd/Setup.rb
|
209
224
|
- lib/dev/cmd/Test.rb
|
data/lib/dev/cmd/Clean.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'timeout'
|
2
|
-
require 'tmpdir'
|
3
|
-
|
4
|
-
module Dev
|
5
|
-
module Cmd
|
6
|
-
class Clean
|
7
|
-
def self.clean_tmp
|
8
|
-
puts_debug "Dev::Cmd::Clean.clean_temp"
|
9
|
-
begin
|
10
|
-
status=Timeout::timeout(30){
|
11
|
-
puts_debug "tmp dir=#{Dir.tmpdir}"
|
12
|
-
if File.exists?(Dir.tmpdir)
|
13
|
-
if RUBY_PLATFORM.include?("w32")
|
14
|
-
cmd="del /Q #{Dir.tmpdir.gsub('/','\\')}"
|
15
|
-
puts_debug cmd
|
16
|
-
`#{cmd}` if RUBY_PLATFORM.include?("w32")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
}
|
20
|
-
rescue
|
21
|
-
puts_debug "timeout met."
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end # class Compile
|
25
|
-
end # module Cmd
|
26
|
-
end # module Dev
|
data/lib/dev/cmd/Pull.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
module Dev
|
2
|
-
module Cmd
|
3
|
-
class Pull < Array
|
4
|
-
def refresh
|
5
|
-
strip_auto_entries
|
6
|
-
end
|
7
|
-
end # class Compile
|
8
|
-
end # module Cmd
|
9
|
-
end # module Dev
|
10
|
-
|
11
|
-
#def pull
|
12
|
-
# update unless has_diff
|
13
|
-
# array_method("pull")
|
14
|
-
# filename=Dir.pwd + "/rakefile.rb"
|
15
|
-
# puts " updating revision variables for " + filename
|
16
|
-
# Dev::Svn::update_revision_variables(filename)
|
17
|
-
# end
|
18
|
-
# def get_default_value_pull
|
19
|
-
# array=Array.new
|
20
|
-
# # dep,svn directives
|
21
|
-
# dep_hash=DEV.get_value("dep")
|
22
|
-
# unless dep_hash.nil?
|
23
|
-
# dep_hash.each do |key,value|
|
24
|
-
# if value.kind_of?(Hash)
|
25
|
-
# dep=Dev::Dep.new(value)
|
26
|
-
# dep.pull_commands.each{|cmd| array << cmd}
|
27
|
-
# #puts_debug "pull array: " + array.to_s
|
28
|
-
# end
|
29
|
-
# end
|
30
|
-
# end
|
31
|
-
# array=nil if array.empty?
|
32
|
-
# return array
|
33
|
-
# end
|