dev_tasks 1.0.38 → 1.0.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/lib/dev_tasks.rb +3 -219
  2. data/lib/tasks.rb +87 -0
  3. data/spec/dev_tasks_spec.rb +12 -38
  4. data/spec/gem-example/rakefile.rb +16 -0
  5. metadata +20 -41
  6. data/lib/add.rb +0 -30
  7. data/lib/artifacts.x.rb +0 -46
  8. data/lib/build.rb +0 -28
  9. data/lib/color.rb +0 -23
  10. data/lib/commands.rb +0 -63
  11. data/lib/commit.rb +0 -25
  12. data/lib/console.rb +0 -81
  13. data/lib/dependencies.rb +0 -85
  14. data/lib/environment.rb +0 -118
  15. data/lib/htmllog.rb +0 -53
  16. data/lib/jsonlog.rb +0 -18
  17. data/lib/logger.rb +0 -37
  18. data/lib/msbuild.rb +0 -41
  19. data/lib/publish.rb +0 -50
  20. data/lib/pull.rb +0 -15
  21. data/lib/push.rb +0 -12
  22. data/lib/settings.rb +0 -26
  23. data/lib/setup.rb +0 -17
  24. data/lib/spec.json +0 -1
  25. data/lib/svnexports.rb +0 -5
  26. data/lib/teardown.rb +0 -4
  27. data/lib/test.rb +0 -55
  28. data/lib/timer.rb +0 -41
  29. data/lib/upgrade.rb +0 -52
  30. data/lib/verify.rb +0 -38
  31. data/lib/yamllog.rb +0 -18
  32. data/spec/dependencies_spec.rb +0 -28
  33. data/spec/environment_spec.rb +0 -8
  34. data/spec/msbuild_spec.rb +0 -9
  35. data/spec/spec_helper.rb +0 -4
  36. data/spec/test_data/cpp_projects/helloLib/rakefile.rb +0 -9
  37. data/spec/test_data/csharp_projects/JsonNet.Test.csproj +0 -75
  38. data/spec/test_data/csharp_projects/JsonNet.csproj +0 -79
  39. data/spec/test_data/csharp_projects/helloDll/helloDll.Net2.0.csproj +0 -54
  40. data/spec/test_data/csharp_projects/helloDll/helloDll.Net3.5.csproj +0 -54
  41. data/spec/test_data/csharp_projects/helloDll/helloDll.Net4.0.csproj +0 -54
  42. data/spec/test_data/csharp_projects/helloDll/helloDll.Net4.5.csproj +0 -56
  43. data/spec/test_data/csharp_projects/helloDll/rakefile.rb +0 -1
  44. data/spec/test_data/ruby_projects/helloGem/rakefile.rb +0 -3
data/lib/dev_tasks.rb CHANGED
@@ -1,220 +1,4 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'json'
4
- require 'dev_commands'
5
- require 'dev_environment'
6
- include Rake::DSL
1
+ require_relative('tasks.rb')
7
2
 
8
- require_relative './environment.rb'
9
- require_relative './commands.rb'
10
- require_relative './dependencies.rb'
11
- require_relative './console.rb'
12
- require_relative './timer.rb'
13
- require_relative './settings.rb'
14
- #require_relative './text.rb'
15
- require_relative './svnexports.rb'
16
- require_relative './logger.rb'
17
-
18
- CLEAN.include('log','bin/**/*.pdb')
19
- CLOBBER.include('bin','obj','TestResults','*.gem','bin/**/*.exe')
20
-
21
- class DevTasks < Hash
22
-
23
- attr_accessor :timer
24
-
25
- def initialize
26
- @timer = Timer.new
27
- self[:name]=pwd.split('/').last#Rake.application.original_dir.split('/').last
28
- self[:svn_exports]=SvnExports.new
29
- self[:scm]=Environment.scm
30
- self[:scm_origin]=Environment.scm_origin
31
- self[:branch]=Environment.branch
32
-
33
-
34
- self[:task_order]=['pull','upgrade','setup','add','build','test','commit','push','verify','publish','teardown']
35
- self[:relative_directory]=Environment.relative_directory
36
- self[:working_directory]=Environment.working_directory
37
- self[:context]=Environment.context
38
- self[:machine]=Environment.machine
39
- self[:platform]=RUBY_PLATFORM
40
- self[:dev_root]=Environment.dev_root
41
- self[:settings]=Settings.new
42
-
43
- self[:files]=Hash.new
44
- #self[:files][:source]=Rake::FileList.new("**/{*.{rb,feature,spec,gemspec,cs,c,m,cpp,cxx,h,hpp,i,jam,csproj,vcproj,snk,vcxproj,xcodeproj,plist,xib,sln,filters,xaml,yml,json,resx,settings,config},Jamfile,.semver,Gemfile,README,LICENSE}")
45
- self[:files][:source]=Rake::FileList.new("**/{*.{rb,feature,spec,gemspec}}")
46
- self[:files][:source].include('**/*.{cs,csproj,sln}')
47
- self[:files][:source].include('**/*.{cpp,cxx,h,hpp,i,c,vcproj,vcxproj,filters,resx,settings,config}')
48
- self[:files][:source].include('**/*.{m,xcodeproj,xib}')
49
- self[:files][:source].include('**/*.{xaml,xml,yaml,yml,json,md}')
50
- self[:files][:source].include('**/{Jamfile,.semver,Gemfile,README,LICENSE}')
51
- self[:files][:source].exclude("log/**/*.*")
52
- self[:files][:source].exclude("bin/**/*.*")
53
- self[:files][:source].exclude("obj/**/*.*")
54
-
55
- self[:files][:build]=Rake::FileList.new('**/*.{gemspec,sln}')
56
-
57
- self[:files][:artifact]=Rake::FileList.new("**/*.{gem,lib,dll,exe,h,hpp}")
58
-
59
-
60
-
61
- self[:commands]=Commands.new
62
- update
63
- end
64
-
65
- def add hash
66
- hash.each do |key,value|
67
- self[key]=value if !has_key?(key)
68
- end
69
- end
70
-
71
- def update
72
- self[:dependencies]=Dependencies.new if !has_key?(:dependencies)
73
- allartifactsexist = true
74
- self[:files][:artifact].each{|f| allartifactsexist=false if !File.exists?(f)}
75
-
76
- self[:newest_source_file]=self[:files][:source].max_by {|f| File.mtime(f)}
77
- self[:newest_artifact_file]=self[:files][:artifact].max_by { |f| File.mtime(f) } if allartifactsexist
78
-
79
- self[:commands]=Commands.new if !has_key?(:commands)
80
- #self[:commands].update
81
-
82
- self[:up_to_date] = false
83
- if(allartifactsexist && !self[:newest_artifact].nil? && !self[:newest_src_file].nil? && File.exists?(self[:newest_artifact]) && File.exists?(self[:newest_src_file]))
84
- if(File.mtime(self[:newest_artifact]) > File.mtime(self[:newest_src_file]))
85
- self[:task_order]=['upgrade'] if(File.mtime(self[:newest_artifact]) > File.mtime(self[:newest_src_file]))
86
- self[:up_to_date]=true
87
- end
88
- self[:newest_artifact_file_mtime]=File.mtime(self[:newest_artifact_file]).to_s
89
- self[:newest_source_file_mtime]=File.mtime(self[:newest_source_file]).to_s
90
- end
91
- update_tasks
92
- end
93
-
94
- def execute cmd
95
- self[:commands].execute_command cmd
96
- end
97
-
98
- def execute_task task
99
- self[:commands].execute_task task
100
- end
101
-
102
- def define_task task_name
103
- if(!Rake::Task.task_defined?(task_name))
104
- ruby="desc '#{DevTasks.description(task_name)} ';task :#{task_name} do;DEV_TASKS.execute_task '#{task_name}';end"
105
- eval(ruby)
106
- end
107
- end
108
-
109
- def self.description task_name
110
- descriptions={
111
- "add"=>"add untracked files to revision control system",
112
- "build"=>"executes build commands",
113
- "test"=>"executes test commands",
114
- "setup"=>"executes setup commands",
115
- "commit"=>"commit changes to revision control system"
116
- }
117
- if descriptions.has_key?(task_name.to_s)
118
- descriptions[task_name.to_s]
119
- else
120
- "#{task_name} task"
121
- end
122
- end
123
-
124
- def update_tasks
125
- dev_task_defaults=Array.new
126
- self[:commands].each do |key,array|
127
- #if(array.length > 0)
128
- define_task key
129
- dev_task_defaults << key
130
- #end
131
- end
132
- update_task_dependencies
133
- end
134
-
135
- def update_task_dependencies
136
- eval('task :build=>[:setup]') if Rake::Task.task_defined?(:setup) && Rake::Task.task_defined?(:build)
137
- eval('task :test=>[:build]') if Rake::Task.task_defined?(:build) && Rake::Task.task_defined?(:test)
138
- end
139
-
140
- def setup_svn_export(uri,dir)
141
- DEV_TASKS[:commands][:setup] << "svn export #{uri} #{dir}" if(!File.exists?(dir))
142
- end
143
-
144
- def setup_copy(src,dest)
145
- if(File.exists?(src))
146
- FileUtils.mkdir_p(File.dirname(dest)) if(!File.exists?(File.dirname(dest)))
147
- if(!File.exists?(dest))
148
- DEV_TASKS[:commands][:setup] << "<%FileUtils.cp('#{src}','#{dest}')%>"
149
- end
150
- else
151
- if(src.kind_of?(Array))
152
- src.each{|s|setup_copy(s,dest)}
153
- end
154
- end
155
- end
156
-
157
- def svn_export(dep_dir,uri)
158
- if(!File.exists?("#{Environment.dev_root}/dep/#{dep_dir}"))
159
- dest="#{Environment.dev_root}/dep/#{dep_dir}"
160
- Environment.execute "svn export #{uri} #{Environment.dev_root}/dep/#{dep_dir}" if !dest.include?("@")
161
- Environment.execute "svn export #{uri} #{Environment.dev_root}/dep/#{dep_dir}@" if dest.include?("@")
162
- end
163
- end
164
- end
165
-
166
- DEV_TASKS=DevTasks.new
167
- DEV=DEV_TASKS
168
-
169
- desc 'executes tasks in order of task_order, if they are defined'
170
- task :dev_tasks_default do
171
- DEV_TASKS.update
172
- DEV_TASKS[:task_order].each{|c|
173
- Rake::Task[c].invoke if(Rake::Task.task_defined?(c))
174
- }
175
- puts "Total Time " + DEV_TASKS.timer.elapsed_str
176
- end
177
-
178
- desc 'dev_tasks default'
179
- task :default do
180
- Rake::Task[:dev_tasks_default].invoke
181
- Logger.finalize
182
- end
183
-
184
- desc 'displays information about current rake directory'
185
- task :info do
186
- DEV_TASKS.update
187
- Console.print_hash("",DEV_TASKS)
188
- end
189
-
190
- desc 'displays help for dev_task'
191
- task :help do
192
- puts "use rake -T to see available tasks"
193
- end
194
-
195
- #desc 'rake projects defined in DEV_TASKS[:dependencies][:projects]'
196
- task :rake_dependencies_projects do
197
- Console.announce_task_start "rake_dependencies_projects"
198
- DEV_TASKS[:dependencies][:projects].each{|project|
199
- dir=Environment.dev_root + "/wrk/" + project
200
- Environment.rake(dir,"default",true) if File.exists?(dir)
201
- }
202
- end
203
-
204
- #desc 'clobber projects defined in DEV_TASKS[:dependencies][:projects]'
205
- task :clobber_dependencies_projects do
206
- Console.announce_task_start "clobber_dependencies_projects"
207
- DEV_TASKS[:dependencies][:projects].each{|project|
208
- dir=Environment.dev_root + "/wrk/" + project
209
- Environment.rake(dir,"clobber",true) if File.exists?(dir)
210
- }
211
- end
212
-
213
- #desc 'clean projects defined in DEV_TASKS[:dependencies][:projects]'
214
- task :clean_dependencies_projects do
215
- Console.announce_task_start "clean_dependencies_projects"
216
- DEV_TASKS[:dependencies][:projects].each{|project|
217
- dir=Environment.dev_root + "/wrk/" + project
218
- Environment.rake(dir,"clean",true) if File.exists?(dir)
219
- }
220
- end
3
+ class DevTasks
4
+ end
data/lib/tasks.rb ADDED
@@ -0,0 +1,87 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+
4
+ class Tasks
5
+ @@commands=nil
6
+ @@quiet=false
7
+
8
+ def self.commands
9
+ if(@@commands.nil?)
10
+ @@commands=Hash.new
11
+ [:pull,:update,:build,:test,:analyze,:doc,:clean,:publish,:clobber,:add,:commit,:push].each{|k| @@commands[k]=[]}
12
+ end
13
+ @@commands
14
+ end
15
+
16
+ def self.initialize commands
17
+ @@commands=commands
18
+ [:pull,:update,:build,:test,:analyze,:doc,:clean,:publish,:clobber,:add,:commit,:push].each{|k|
19
+ @@commands[k]=[] if(!@@commands.has_key?(k))
20
+ }
21
+ end
22
+
23
+ def self.quiet
24
+ @@quiet
25
+ end
26
+
27
+ def self.execute value
28
+ if(value.respond_to?(:execute))
29
+ value.update if value.respond_to?(:update)
30
+ value.execute
31
+ else
32
+ if(value.is_a?(String))
33
+ puts `#{value}`
34
+ else
35
+ if(value.is_a?(Array))
36
+ value.each{|e| execute(e)}
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ def self.execute_task task
43
+ if(Tasks.commands.has_key?(task))
44
+ puts "[:#{task}]" if(!Tasks.quiet)
45
+ Tasks.execute(Tasks.commands[task])
46
+ end
47
+ end
48
+ end
49
+
50
+ desc 'performs a git pull'
51
+ task :pull do Tasks.execute_task :pull; end
52
+
53
+ desc 'performs svn update'
54
+ task :update do Tasks.execute_task :update; end
55
+
56
+ desc 'performs setup commands'
57
+ task :setup do Tasks.execute_task :setup;end
58
+
59
+ desc 'performs build commands'
60
+ task :build do Tasks.execute_task :build;end
61
+
62
+ desc 'performs test commands'
63
+ task :test => [:build] do Tasks.execute_task :test;end
64
+
65
+ desc 'performs analyze commands'
66
+ task :analyze do Tasks.execute_task :analyze;end
67
+
68
+ desc 'performs documentation commands'
69
+ task :doc do Tasks.execute_task :doc;end
70
+
71
+ desc 'performs clean commands'
72
+ task :clean do Tasks.execute_task :clean;end
73
+
74
+ desc 'performs publish commands'
75
+ task :publish => [:test] do Tasks.execute_task :publish; end
76
+
77
+ desc 'performs clobber commands'
78
+ task :clobber => [:clean] do Tasks.execute_task :clobber;end
79
+
80
+ desc 'adds source files to git or subversion'
81
+ task :add do Tasks.execute_task :add;end
82
+
83
+ desc 'commits source files to git or subversion'
84
+ task :commit do Tasks.execute_task :commit;end
85
+
86
+ desc 'performs a git push'
87
+ task :push do Tasks.execute_task :push;end
@@ -1,45 +1,19 @@
1
1
  require_relative '../lib/dev_tasks.rb'
2
+ require 'dev_commands'
2
3
 
3
4
  describe DevTasks do
4
- it "should be able to load example ruby project" do
5
- Dir.chdir("#{File.dirname(__FILE__)}/test_data/ruby_projects/helloGem") do
6
- ruby_dev_task=DevTasks.new
7
- expect(ruby_dev_task[:name]).to eq('helloGem')
8
- end
9
- end
10
-
11
- if(RUBY_PLATFORM.include?("mingw"))
12
-
13
- it "should be able to load example C# project" do
14
- Dir.chdir("#{File.dirname(__FILE__)}/test_data/csharp_projects/helloDll") do
15
- dev_task=DevTasks.new
16
- expect(dev_task[:name]).to eq('helloDll')
17
- end
18
- dir="#{File.dirname(__FILE__)}/test_data/csharp_projects/helloDll"
19
- expect(File.exists?(dir)).to eq(true)
20
- Environment.rake(dir,"default",false)
21
-
22
- if(!RUBY_PLATFORM.include?("mingw"))
23
- expect(File.exists?("#{dir}/bin/Net4.0/Debug/helloDll.dll")).to eq(true)
24
- expect(File.exists?("#{dir}/bin/Net4.5/Release/helloDll.dll")).to eq(true)
25
- end
26
- end
27
- it "should be able to rake cpp static library" do
28
- dir="#{File.dirname(__FILE__)}/test_data/cpp_projects/helloLib"
29
-
30
- Environment.rake(dir,"clobber",false)
31
- #File.exists?("#{dir}/bin").should eq(false)
32
5
 
33
- Environment.rake(dir,"default",false)
34
- if(RUBY_PLATFORM.include?("mingw"))
35
- expect(File.exists?("#{dir}/bin/v90/Debug/helloLib.v9.lib")).to eq(true)
36
- expect(File.exists?("#{dir}/bin/v90/Release/helloLib.v9.lib")).to eq(true)
37
- expect(File.exists?("#{dir}/bin/v120/Debug/helloLib.v12.lib")).to eq(true)
38
- expect(File.exists?("#{dir}/bin/v120/Release/helloLib.v12.lib")).to eq(true)
39
- end
6
+ it "should be able to define rake tasks for the gem-example" do
7
+ dir='spec/gem-example'
8
+ expect(File.exists?("#{dir}/rakefile.rb")).to eq(true)
40
9
 
41
- Environment.rake(dir,"clobber",false)
42
- #File.exists?("#{dir}/bin").should eq(false)
43
- end
10
+ Dir.chdir(dir) do
11
+ expect(Command.exit_code('rake default')).to eq(0)
12
+ expect(Command.exit_code('rake build')).to eq(0)
13
+ expect(File.exists?('gem-example-0.0.0.gem')).to eq(true)
14
+ expect(Command.exit_code('rake clobber')).to eq(0)
15
+ expect(File.exists?('gem-example-0.0.0.gem')).to eq(false)
16
+ expect(Command.output('rake -T').include?('rake build')).to eq(true)
17
+ end
44
18
  end
45
19
  end
@@ -0,0 +1,16 @@
1
+ require_relative('../../lib/dev_tasks.rb')
2
+
3
+ CLOBBER.include('*.gem')
4
+ Tasks.initialize(
5
+ {
6
+ :build => ['gem build gem-example.gemspec'],
7
+ :test => ['rspec'],
8
+ })
9
+
10
+ commands=
11
+ {
12
+ :build => ['gem build gem-example.gemspec'],
13
+ :test => ['rspec']
14
+ }
15
+
16
+ task :default => [:build,:test,:clobber]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.38
4
+ version: 1.0.39
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-12 00:00:00.000000000 Z
12
+ date: 2015-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -43,53 +43,32 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.0.13
46
+ - !ruby/object:Gem::Dependency
47
+ name: dev_commands
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 0.0.26
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.26
46
62
  description: defines rake tasks for ruby and C# projects
47
63
  email: lou.parslow@gmail.com
48
64
  executables: []
49
65
  extensions: []
50
66
  extra_rdoc_files: []
51
67
  files:
52
- - lib/add.rb
53
- - lib/artifacts.x.rb
54
- - lib/build.rb
55
- - lib/color.rb
56
- - lib/commands.rb
57
- - lib/commit.rb
58
- - lib/console.rb
59
- - lib/dependencies.rb
60
68
  - lib/dev_tasks.rb
61
- - lib/environment.rb
62
- - lib/htmllog.rb
63
- - lib/jsonlog.rb
64
- - lib/logger.rb
65
- - lib/msbuild.rb
66
- - lib/publish.rb
67
- - lib/pull.rb
68
- - lib/push.rb
69
- - lib/settings.rb
70
- - lib/setup.rb
71
- - lib/svnexports.rb
72
- - lib/teardown.rb
73
- - lib/test.rb
74
- - lib/timer.rb
75
- - lib/upgrade.rb
76
- - lib/verify.rb
77
- - lib/yamllog.rb
78
- - lib/spec.json
79
- - spec/dependencies_spec.rb
69
+ - lib/tasks.rb
80
70
  - spec/dev_tasks_spec.rb
81
- - spec/environment_spec.rb
82
- - spec/msbuild_spec.rb
83
- - spec/spec_helper.rb
84
- - spec/test_data/cpp_projects/helloLib/rakefile.rb
85
- - spec/test_data/csharp_projects/helloDll/rakefile.rb
86
- - spec/test_data/ruby_projects/helloGem/rakefile.rb
87
- - spec/test_data/csharp_projects/helloDll/helloDll.Net2.0.csproj
88
- - spec/test_data/csharp_projects/helloDll/helloDll.Net3.5.csproj
89
- - spec/test_data/csharp_projects/helloDll/helloDll.Net4.0.csproj
90
- - spec/test_data/csharp_projects/helloDll/helloDll.Net4.5.csproj
91
- - spec/test_data/csharp_projects/JsonNet.csproj
92
- - spec/test_data/csharp_projects/JsonNet.Test.csproj
71
+ - spec/gem-example/rakefile.rb
93
72
  - LICENSE
94
73
  homepage: http://rubygems.org/gems/dev_tasks
95
74
  licenses:
data/lib/add.rb DELETED
@@ -1,30 +0,0 @@
1
- #require_relative './commandarray.rb'
2
-
3
- class Add #< CommandArray
4
-
5
- # updates the commands in the Add CommandArray
6
- #
7
- # if a .git directory exists, the command 'git add -A -v' will be appended the Add Commands
8
- # if a .svn directory exists, all DEV[:files][:source] files that are not tracked by subversion
9
- # will have the appropriate svn add command appended to the Add Commands
10
- def update
11
- if(Dir.exists?(".git"))
12
- DEV_TASKS[:files][:source].each{|f|
13
- if(`git status #{f}`.include?('untracked'))
14
- add "git add #{f} -v"
15
- end
16
- }
17
- #if(`git status`.include?('untracked files present'))
18
- # self.add 'git add -A -v'
19
- #end
20
- end
21
- if(Dir.exists?(".svn") && defined?(DEV_TASKS))
22
- DEV_TASKS[:files][:source].each{|f|
23
- if(`svn status #{f}`.include?('?'))
24
- add "svn add #{f}"
25
- end
26
- }
27
- end
28
- end
29
-
30
- end
data/lib/artifacts.x.rb DELETED
@@ -1,46 +0,0 @@
1
- require_relative('./dependencies.rb')
2
-
3
- class Artifacts < Array
4
- def initialize
5
- # gem, dev_tasks-0.0.7.gem
6
- Dir.glob('*.gemspec') {|f|
7
- spec=Gem::Specification.load(f)
8
- artifact="#{spec.name}-#{spec.version.to_s}.gem"
9
- self << artifact if(!self.include?(artifact))
10
- }
11
-
12
- # C# dll, bin/Net4.0/QcNet.dll
13
- Dir.glob("*.csproj").each{|p|
14
- text = File.read(p)
15
- # extract AssemblyName of form: <AssemblyName>MyLibrary.Test</AssemblyName>
16
- assemblyName=text[/<AssemblyName>([\w\.]+)</,1]
17
- outputType=text[/<OutputType>([\w\.]+)</,1]
18
- outputPath=text[/Release[.\w\W]+<OutputPath>([\w\.\\]+)</,1]
19
- if(!assemblyName.nil? && !outputPath.nil? && !assemblyName.include?("Test"))
20
-
21
- extension="dll"
22
- extension="exe" if(outputType=="WinExe" || outputType=="Exe")
23
-
24
- artifact = "#{outputPath}\\#{assemblyName}.#{extension}".gsub("\\\\","\\").gsub('/','\\').gsub('\\','/')
25
-
26
- self << artifact if(!self.include?(artifact))
27
-
28
- # add in file dependencies
29
- Dependencies.csharp_file_dependencies(text).each{|dep|
30
- cs_dll_dep=dep.gsub(File.dirname(dep),File.dirname(artifact)).gsub('\\','/')
31
- self << cs_dll_dep if(!self.include?(cs_dll_dep))
32
- }
33
- end
34
- }
35
- update
36
- end
37
-
38
- def update
39
- # C++ dll,lib,h,hpp
40
- if(Dir.glob("**/*.{vcproj,vcxproj}").length > 0)
41
- Dir.glob("**/*.{lib,dll,h,hpp}").each{|f|
42
- self << f
43
- }
44
- end
45
- end
46
- end
data/lib/build.rb DELETED
@@ -1,28 +0,0 @@
1
- require_relative './color.rb'
2
- #require_relative './commandarray.rb'
3
- require_relative './msbuild.rb'
4
-
5
- class Build #< CommandArray
6
-
7
- def update
8
- if(defined?(DEV_TASKS))
9
- msbuild=MSBuild.new
10
- #glob='**/*.{gemspec,sln}'
11
- #glob=DEV_TASKS[:build_glob] if(defined?(DEV_TASKS)) && DEV_TASKS.has_key?(:build_glob)
12
- DEV_TASKS[:files][:build].each {|f|
13
- self.add "gem build #{f}" if(f.include?('.gemspec'))
14
- if(f.include?('.sln'))
15
- vs_version=MSBuild.get_vs_version(f)
16
- if File.exists? msbuild[vs_version]
17
- MSBuild.get_configurations(f).each{ |configuration|
18
- MSBuild.get_platforms(f).each{|platform|
19
- Console.debug "configuration='#{configuration}', platform='#{platform}'"
20
- self.add "\"#{msbuild[vs_version]}\" \"#{f}\" /nologo /p:Configuration=#{configuration} /p:Platform=\"#{platform}\""
21
- }
22
- }
23
- end
24
- end
25
- }
26
- end
27
- end
28
- end
data/lib/color.rb DELETED
@@ -1,23 +0,0 @@
1
- require_relative './settings.rb'
2
-
3
- class Color
4
- def self.bold
5
- ""
6
- end
7
- def self.cyan
8
- ""
9
- end
10
- def self.clear
11
- ""
12
- end
13
- def self.green
14
- ""
15
- end
16
- def self.yellow
17
- ""
18
- end
19
-
20
- def self.white
21
- ""
22
- end
23
- end
data/lib/commands.rb DELETED
@@ -1,63 +0,0 @@
1
- require_relative './build.rb'
2
- require_relative './test.rb'
3
- require_relative './add.rb'
4
- require_relative './commit.rb'
5
- require_relative './publish.rb'
6
- require_relative './pull.rb'
7
- require_relative './push.rb'
8
- require_relative './setup.rb'
9
- require_relative './upgrade.rb'
10
- require_relative './timer.rb'
11
- require_relative './verify.rb'
12
-
13
- class Commands < Hash
14
- attr_accessor :build
15
-
16
- def initialize
17
- self[:pull] = Pull.new if(Environment.scm=='git' && Environment.scm_origin.length > 0)
18
- self[:upgrade] = Upgrade.new
19
- self[:setup] = Setup.new
20
- self[:build] = Build.new
21
- self[:test] = Test.new
22
- self[:add] = Add.new
23
- self[:commit] = Commit.new
24
- self[:push] = Push.new
25
- self[:verify] = Verify.new
26
- self[:publish] = Publish.new
27
- end
28
-
29
- def update
30
- self[:upgrade].update
31
- self[:setup].update
32
- self[:build].update
33
- self[:verify].update
34
- self[:publish].update
35
- end
36
-
37
- def execute_task task
38
- sym_task = task.to_sym
39
- if(self.has_key?(sym_task))
40
- self[sym_task].update if self[sym_task].respond_to?(:update)
41
- if(self[sym_task].length>0)
42
- Logger.start_task task
43
- self[sym_task].execute
44
- Logger.end_task task
45
- else
46
- self.delete sym_task
47
- end
48
- end
49
- end
50
-
51
-
52
- def show
53
- self.each do |key,array|
54
- if(array.length > 0)
55
- puts key
56
- array.each {|v|
57
- puts " " + Color.green + v + Color.clear + " "
58
- }
59
- end
60
- end
61
- puts " "
62
- end
63
- end
data/lib/commit.rb DELETED
@@ -1,25 +0,0 @@
1
- #require_relative('./commandarray.rb')
2
- require_relative('./environment.rb')
3
-
4
- class Commit #< CommandArray
5
- def update
6
- if(Dir.exists?(".git") && `git config --list`.include?('user.name='))
7
- if(`git status`.include?('nothing to commit') || `git status`.include?('untracked files present'))
8
- # skip
9
- else
10
- if(File.exists?('commit.message') && File.read('commit.message').gsub(/\s+/, "").length > 0)
11
- self.add "git commit -a -v -m \"#{File.read('commit.message')}\""
12
- self.add "<%File.open('commit.message','w'){|f|f.write('')}%>"
13
- else
14
- self.add 'git commit -a -v -m "commit all"'
15
- end
16
- end
17
- end
18
- if(Dir.exists?(".svn"))
19
- self.add 'svn commit -m"commit all"'
20
- self.add "svn update"
21
- self.add '<%puts "Last Changed Rev: " + Environment.svn_latest_revision%>'
22
- self.add "<%DEV_TASKS[:commands][:verify].update%>"
23
- end
24
- end
25
- end