dev 2.1.153 → 2.1.154

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/apps/git.rb +207 -208
  3. data/lib/apps/msbuild.rb +90 -90
  4. data/lib/apps/nbench.rb +2 -1
  5. data/lib/apps/nuget.rb +57 -59
  6. data/lib/apps/svn.rb +137 -143
  7. data/lib/apps/wix.rb +47 -50
  8. data/lib/apps/xcodebuild.rb +13 -11
  9. data/lib/apps/zip.rb +25 -25
  10. data/lib/apps.rb +3 -1
  11. data/lib/base/array.rb +66 -64
  12. data/lib/base/command.rb +237 -238
  13. data/lib/base/dir.rb +73 -76
  14. data/lib/base/environment.rb +94 -99
  15. data/lib/base/file.rb +35 -33
  16. data/lib/base/gemspec.rb +47 -45
  17. data/lib/base/giturl.rb +88 -90
  18. data/lib/base/hash.rb +20 -15
  19. data/lib/base/history.rb +36 -33
  20. data/lib/base/internet.rb +22 -20
  21. data/lib/base/project.rb +410 -423
  22. data/lib/base/projects.rb +231 -246
  23. data/lib/base/source.rb +22 -20
  24. data/lib/base/string.rb +6 -4
  25. data/lib/base/text.rb +16 -14
  26. data/lib/base/timeout.rb +29 -28
  27. data/lib/base/timer.rb +23 -19
  28. data/lib/base/version.rb +68 -72
  29. data/lib/base.rb +5 -3
  30. data/lib/commands.rb +47 -43
  31. data/lib/dev.config.rb +3 -2
  32. data/lib/dev.rb +65 -66
  33. data/lib/tasks/add.rb +34 -40
  34. data/lib/tasks/analyze.rb +17 -15
  35. data/lib/tasks/build.rb +101 -103
  36. data/lib/tasks/clean.rb +6 -4
  37. data/lib/tasks/clobber.rb +20 -18
  38. data/lib/tasks/commit.rb +42 -44
  39. data/lib/tasks/default.rb +41 -39
  40. data/lib/tasks/doc.rb +10 -8
  41. data/lib/tasks/info.rb +8 -7
  42. data/lib/tasks/package.rb +23 -20
  43. data/lib/tasks/publish.rb +20 -25
  44. data/lib/tasks/pull.rb +9 -9
  45. data/lib/tasks/push.rb +11 -13
  46. data/lib/tasks/setup.rb +180 -183
  47. data/lib/tasks/test.rb +121 -107
  48. data/lib/tasks/update.rb +13 -11
  49. data/lib/tasks.rb +38 -42
  50. metadata +7 -9
  51. data/bin/dev +0 -3
data/lib/tasks/test.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # nunit dlls may be specified with
3
5
  # NUNIT=FileList.new('**/*.Test.dll')
@@ -5,117 +7,129 @@
5
7
  # for nunit dlls that must be run in x86 mode,
6
8
  # NUNIT_x86=FileList.new('**/*.x86.Test.dll')
7
9
  #
8
- desc 'performs test commands'
9
- task :test => [:build] do Tasks.execute_task :test;end
10
+ desc "performs test commands"
11
+ task test: [:build] do Tasks.execute_task :test; end
10
12
 
11
13
  class Test < Array
12
- def update
13
- add_quiet 'rspec --format documentation' if File.exists?('spec')
14
-
15
- if(defined?(NUNIT))
16
- NUNIT.each{|nunit_dll|
17
- skip = false
18
- skip = true if(nunit_dll.include?('/netcoreapp'))
19
- skip = true if(nunit_dll.include?('packages/'))
20
- if(!skip)
21
- nunit_arg=Test.nunit_console
22
- nunit_arg="\"#{Test.nunit_console}\"" if Test.nunit_console.include?(' ')
23
- dll_arg=nunit_dll
24
- dll_arg="\"#{nunit_dll}\"" if(nunit_dll.include?(' '))
25
- if(Test.nunit_console.include?('nunit3'))
26
- xml_arg="--result=#{nunit_dll}.TestResults.xml --labels=All"
27
- xml_arg="--result=\"#{nunit_dll}.TestResults.xml\" --labels=All" if(nunit_dll.include?(' '))
28
- else
29
- xml_arg="/xml:#{nunit_dll}.TestResults.xml"
30
- xml_arg="/xml:\"#{nunit_dll}.TestResults.xml\"" if(nunit_dll.include?(' '))
31
- end
32
- add_quiet "#{nunit_arg} #{dll_arg} #{xml_arg}"
33
- end
34
- }
35
- end
36
-
37
- if(defined?(NUNIT_X86))
38
- NUNIT_X86.each{|nunit_dll|
39
- if(Test.nunit_console_x86.include?('nunit3'))
40
- add_quiet "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" --result=\"#{nunit_dll}.TestResults.xml\" --labels=All"
41
- else
42
- add_quiet "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\""
43
- end
44
- }
45
- end
46
-
47
- # dotnet test
48
- puts "scanning for **/*.Test.csproj" if Environment.default.debug?
49
- Dir.glob('**/*.Test.csproj'){|proj|
50
- puts "found #{proj}" if Environment.default.debug?
51
- text = IO.read(proj)
52
- if(text.include?('netcoreapp'))
53
- add_quiet("dotnet test #{proj}")
54
- end
55
- }
56
-
57
- if(defined?(TESTS))
58
- TEST.each{|t| add_quiet t}
59
- end
60
- end
61
-
62
- def self.nunit3_console_in_path?
63
- command=Command.new('nunit3-console')
64
- command[:quiet]=true
65
- command[:ignore_failure]=true
66
- command.execute
67
- return true if(command[:exit_code] == 0)
68
- false
14
+ def update
15
+ add_quiet "rspec --format documentation" if File.exist?("spec")
16
+
17
+ if defined?(NUNIT)
18
+ NUNIT.each do |nunit_dll|
19
+ skip = false
20
+ skip = true if nunit_dll.include?("/netcoreapp")
21
+ skip = true if nunit_dll.include?("packages/")
22
+ next if skip
23
+
24
+ nunit_arg = Test.nunit_console
25
+ nunit_arg = "\"#{Test.nunit_console}\"" if Test.nunit_console.include?(" ")
26
+ dll_arg = nunit_dll
27
+ dll_arg = "\"#{nunit_dll}\"" if nunit_dll.include?(" ")
28
+ if Test.nunit_console.include?("nunit3")
29
+ xml_arg = "--result=#{nunit_dll}.TestResults.xml --labels=All"
30
+ xml_arg = "--result=\"#{nunit_dll}.TestResults.xml\" --labels=All" if nunit_dll.include?(" ")
31
+ else
32
+ xml_arg = "/xml:#{nunit_dll}.TestResults.xml"
33
+ xml_arg = "/xml:\"#{nunit_dll}.TestResults.xml\"" if nunit_dll.include?(" ")
34
+ end
35
+ add_quiet "#{nunit_arg} #{dll_arg} #{xml_arg}"
36
+ end
37
+ end
38
+
39
+ if defined?(NUNIT_X86)
40
+ NUNIT_X86.each do |nunit_dll|
41
+ if Test.nunit_console_x86.include?("nunit3")
42
+ add_quiet "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" --result=\"#{nunit_dll}.TestResults.xml\" --labels=All"
43
+ else
44
+ add_quiet "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\""
45
+ end
46
+ end
69
47
  end
70
48
 
71
- def self.nunit_console_in_path?
72
- command=Command.new('nunit-console')
73
- command[:quiet]=true
74
- command[:ignore_failure]=true
75
- command.execute
76
- return true if(command[:exit_code] == 0)
77
- false
49
+ # dotnet test
50
+ puts "scanning for **/*.Test.csproj" if Environment.default.debug?
51
+ Dir.glob("**/*.Test.csproj") do |proj|
52
+ puts "found #{proj}" if Environment.default.debug?
53
+ text = IO.read(proj)
54
+ add_quiet("dotnet test #{proj}") if text.include?("netcoreapp")
78
55
  end
79
- @@nunit_console=''
80
- def self.nunit_console
81
- return "nunit3-console" if Test.nunit3_console_in_path?
82
- return "nunit-console" if Test.nunit_console_in_path?
83
- if(!File.exists?(@@nunit_console))
84
- if(defined?(NUNIT_CONSOLE))
85
- @@nunit_console = NUNIT_CONSOLE
86
- end
87
- @@nunit_console = "packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe" if(!File.exists?(@@nunit_console))
88
- @@nunit_console = "packages/NUnit.ConsoleRunner.3.8.0/tools/nunit3-console.exe" if(!File.exists?(@@nunit_console))
89
- @@nunit_console = "C:\\Program Files (x86)\\NUnit.org\\nunit-console\\nunit3-console.exe" if(!File.exists?(@@nunit_console))
90
- @@nunit_console = "C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console.exe" if(!File.exists?(@@nunit_console))
91
- @@nunit_console = "C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console.exe" if(!File.exists?(@@nunit_console))
92
- if(!File.exists?(@@nunit_console))
93
- Dir.glob('**/nunit3-console.exe'){|n| @@nunit_console=n}
94
- end
95
- end
96
- if(!File.exists?(@@nunit_console))
97
- raise "unable to locate nunit-console.exe, assign NUNIT_CONSOLE to the correct location."
98
- end
99
- @@nunit_console
100
- end
101
-
102
- @@nunit_console_x86=''
103
- def self.nunit_console_x86
104
- if(!File.exists?(@@nunit_console_x86))
105
- if(defined?(NUNIT_CONSOLE_X86))
106
- @@nunit_console_x86 = NUNIT_CONSOLE_X86
107
- end
108
- @@nunit_console_x86 = "C:\\Program Files (x86)\\NUnit.org\\nunit-console\\nunit3-console.exe" if(!File.exists?(@@nunit_console_x86))
109
- @@nunit_console_x86 = "C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console-x86.exe" if(!File.exists?(@@nunit_console_x86))
110
- @@nunit_console_x86 = "C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console-x86.exe" if(!File.exists?(@@nunit_console_x86))
111
- end
112
- if(!File.exists?(@@nunit_console_x86))
113
- raise "unable to locate nunit-console-x86.exe, assign NUNIT_CONSOLE_X86 to the correct location."
114
- end
115
- @@nunit_console_x86
116
- end
56
+
57
+ TEST.each { |t| add_quiet t } if defined?(TESTS)
58
+ end
59
+
60
+ def self.nunit3_console_in_path?
61
+ command = Command.new("nunit3-console")
62
+ command[:quiet] = true
63
+ command[:ignore_failure] = true
64
+ command.execute
65
+ return true if (command[:exit_code]).zero?
66
+
67
+ false
68
+ end
69
+
70
+ def self.nunit_console_in_path?
71
+ command = Command.new("nunit-console")
72
+ command[:quiet] = true
73
+ command[:ignore_failure] = true
74
+ command.execute
75
+ return true if (command[:exit_code]).zero?
76
+
77
+ false
78
+ end
79
+ @@nunit_console = ""
80
+ def self.nunit_console
81
+ return "nunit3-console" if Test.nunit3_console_in_path?
82
+ return "nunit-console" if Test.nunit_console_in_path?
83
+
84
+ unless File.exist?(@@nunit_console)
85
+ @@nunit_console = NUNIT_CONSOLE if defined?(NUNIT_CONSOLE)
86
+ unless File.exist?(@@nunit_console)
87
+ @@nunit_console = "packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe"
88
+ end
89
+ unless File.exist?(@@nunit_console)
90
+ @@nunit_console = "packages/NUnit.ConsoleRunner.3.8.0/tools/nunit3-console.exe"
91
+ end
92
+ unless File.exist?(@@nunit_console)
93
+ @@nunit_console = 'C:\\Program Files (x86)\\NUnit.org\\nunit-console\\nunit3-console.exe'
94
+ end
95
+ unless File.exist?(@@nunit_console)
96
+ @@nunit_console = 'C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console.exe'
97
+ end
98
+ unless File.exist?(@@nunit_console)
99
+ @@nunit_console = 'C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console.exe'
100
+ end
101
+ Dir.glob("**/nunit3-console.exe") { |n| @@nunit_console = n } unless File.exist?(@@nunit_console)
102
+ end
103
+ unless File.exist?(@@nunit_console)
104
+ raise "unable to locate nunit-console.exe, assign NUNIT_CONSOLE to the correct location."
105
+ end
106
+
107
+ @@nunit_console
108
+ end
109
+
110
+ @@nunit_console_x86 = ""
111
+ def self.nunit_console_x86
112
+ unless File.exist?(@@nunit_console_x86)
113
+ @@nunit_console_x86 = NUNIT_CONSOLE_X86 if defined?(NUNIT_CONSOLE_X86)
114
+ unless File.exist?(@@nunit_console_x86)
115
+ @@nunit_console_x86 = 'C:\\Program Files (x86)\\NUnit.org\\nunit-console\\nunit3-console.exe'
116
+ end
117
+ unless File.exist?(@@nunit_console_x86)
118
+ @@nunit_console_x86 = 'C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console-x86.exe'
119
+ end
120
+ unless File.exist?(@@nunit_console_x86)
121
+ @@nunit_console_x86 = 'C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console-x86.exe'
122
+ end
123
+ end
124
+ unless File.exist?(@@nunit_console_x86)
125
+ raise "unable to locate nunit-console-x86.exe, assign NUNIT_CONSOLE_X86 to the correct location."
126
+ end
127
+
128
+ @@nunit_console_x86
129
+ end
117
130
  end
118
131
 
119
- if !defined?(NUNIT)
120
- NUNIT=FileList.new('**/bin/**/*.Test.dll','**/bin/**/*.Tests.dll','**/lib/**/*.Test.dll','**/lib/**/*.Tests.dll')
121
- end
132
+ unless defined?(NUNIT)
133
+ NUNIT = FileList.new("**/bin/**/*.Test.dll", "**/bin/**/*.Tests.dll", "**/lib/**/*.Test.dll",
134
+ "**/lib/**/*.Tests.dll")
135
+ end
data/lib/tasks/update.rb CHANGED
@@ -1,15 +1,17 @@
1
- desc 'performs svn update'
1
+ # frozen_string_literal: true
2
+
3
+ desc "performs svn update"
2
4
  task :update do Tasks.execute_task :update; end
3
5
 
4
6
  class Update < Array
5
- def update
6
- add_quiet 'svn update' if File.exists?('.svn') && Internet.available?
7
+ def update
8
+ add_quiet "svn update" if File.exist?(".svn") && Internet.available?
7
9
 
8
- #if(Dir.glob('**/packages.config').length > 0)
9
- Dir.glob('*.sln').each{|sln_file|
10
- #add_quiet "nuget restore #{sln_file}"
11
- add_quiet "nuget update #{sln_file}"
12
- }
13
- #end
14
- end
15
- end
10
+ # if(Dir.glob('**/packages.config').length > 0)
11
+ Dir.glob("*.sln").each do |sln_file|
12
+ # add_quiet "nuget restore #{sln_file}"
13
+ add_quiet "nuget update #{sln_file}"
14
+ end
15
+ # end
16
+ end
17
+ end
data/lib/tasks.rb CHANGED
@@ -1,49 +1,45 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tasks
2
- attr_accessor :env
3
- @@default=nil
4
+ attr_accessor :env
4
5
 
5
- def initialize env=nil
6
- @@default=self
7
- @env=env
8
- @env=Environment.new if @env.nil?
9
- end
6
+ @@default = nil
10
7
 
11
- def execute value
12
- if(value.respond_to?(:execute))
13
- value.update if value.respond_to?(:update)
14
- value.execute
15
- else
16
- if(value.is_a?(String))
17
- puts `#{value}`
18
- else
19
- if(value.is_a?(Array))
20
- value.each{|e| execute(e)}
21
- end
22
- end
23
- end
24
- end
8
+ def initialize(env = nil)
9
+ @@default = self
10
+ @env = env
11
+ @env = Environment.new if @env.nil?
12
+ end
25
13
 
26
- def execute_task task
27
- if(defined?(COMMANDS))
28
- if(COMMANDS.has_key?(task))
29
- puts DELIMITER if defined?(DEBUG)
30
- puts ":#{task}" if !@env.colorize?
31
- if @env.colorize?
32
- require 'ansi/code'
33
- puts ANSI.white + ANSI.bold + ":#{task}" + ANSI.reset if @env.colorize?
34
- end
35
- execute(COMMANDS[task])
36
- end
37
- end
38
- end
14
+ def execute(value)
15
+ if value.respond_to?(:execute)
16
+ value.update if value.respond_to?(:update)
17
+ value.execute
18
+ elsif value.is_a?(String)
19
+ puts `#{value}`
20
+ elsif value.is_a?(Array)
21
+ value.each { |e| execute(e) }
22
+ end
23
+ end
39
24
 
40
- def self.execute_task task
41
- @@default=Tasks.new if @@default.nil?
42
- @@default.execute_task task
43
- end
44
- end
25
+ def execute_task(task)
26
+ if defined?(COMMANDS) && COMMANDS.key?(task)
27
+ puts DELIMITER if defined?(DEBUG)
28
+ puts ":#{task}" unless @env.colorize?
29
+ if @env.colorize?
30
+ require "ansi/code"
31
+ puts ANSI.white + ANSI.bold + ":#{task}" + ANSI.reset if @env.colorize?
32
+ end
33
+ execute(COMMANDS[task])
34
+ end
35
+ end
45
36
 
46
- ['add','analyze','build','clobber','commit',
47
- 'doc','info','package','publish','pull','push','setup','test',
48
- 'update'].each{|name| require_relative("tasks/#{name}.rb")}
37
+ def self.execute_task(task)
38
+ @@default = Tasks.new if @@default.nil?
39
+ @@default.execute_task task
40
+ end
41
+ end
49
42
 
43
+ %w[add analyze build clobber commit
44
+ doc info package publish pull push setup test
45
+ update].each { |name| require_relative("tasks/#{name}.rb") }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.153
4
+ version: 2.1.154
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -46,13 +46,11 @@ dependencies:
46
46
  version: '3.0'
47
47
  description: development tasks
48
48
  email: lou.parslow@gmail.com
49
- executables:
50
- - dev
49
+ executables: []
51
50
  extensions: []
52
51
  extra_rdoc_files: []
53
52
  files:
54
53
  - LICENSE
55
- - bin/dev
56
54
  - lib/apps.rb
57
55
  - lib/apps/git.rb
58
56
  - lib/apps/msbuild.rb
@@ -105,7 +103,7 @@ homepage: http://rubygems.org/gems/dev
105
103
  licenses:
106
104
  - Apache-2.0
107
105
  metadata: {}
108
- post_install_message:
106
+ post_install_message:
109
107
  rdoc_options: []
110
108
  require_paths:
111
109
  - lib
@@ -120,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
118
  - !ruby/object:Gem::Version
121
119
  version: '0'
122
120
  requirements: []
123
- rubygems_version: 3.0.3
124
- signing_key:
121
+ rubygems_version: 3.2.22
122
+ signing_key:
125
123
  specification_version: 4
126
124
  summary: dev
127
125
  test_files: []
data/bin/dev DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'dev'
3
- DEV.execute ARGV