dev 2.1.153 → 2.1.154

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.
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/apps/nuget.rb CHANGED
@@ -1,79 +1,77 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if defined?(DEBUG)
2
4
  puts DELIMITER
3
5
  puts __FILE__
4
6
  puts
5
- puts 'nuget not found' if(!Command.executes?('nuget'))
7
+ puts "nuget not found" unless Command.executes?("nuget")
6
8
  puts
7
9
  end
8
- #puts DELIMITER if defined?(DEBUG)
9
- #puts __FILE__ if defined?(DEBUG)
10
+ # puts DELIMITER if defined?(DEBUG)
11
+ # puts __FILE__ if defined?(DEBUG)
10
12
 
11
13
  class Nuget
12
- def self.get_build_commands nuspec_file
13
- build_commands=nil
14
- if(File.exists?(nuspec_file))
15
- build_commands=Array.new if build_commands.nil?
16
- if(defined?(INCLUDE_REFERENCED_PROJECTS))
17
- build_commands << "nuget pack #{nuspec_file} -IncludeReferencedProjects"
18
- else
19
- build_commands << "nuget pack #{nuspec_file}"
20
- end
14
+ def self.get_build_commands(nuspec_file)
15
+ build_commands = nil
16
+ if File.exist?(nuspec_file)
17
+ build_commands = [] if build_commands.nil?
18
+ build_commands << if defined?(INCLUDE_REFERENCED_PROJECTS)
19
+ "nuget pack #{nuspec_file} -IncludeReferencedProjects"
20
+ else
21
+ "nuget pack #{nuspec_file}"
21
22
  end
22
- build_commands
23
23
  end
24
+ build_commands
25
+ end
24
26
 
25
- def self.get_versions filename
26
- versions=Hash.new
27
- if(filename.include?('.nuspec'))
28
- nuspec_text=File.read(filename,:encoding=>'UTF-8')
29
- nuspec_text.scan(/<dependency[\s]+id="([\w\.]+)"[\s]+version="([\d\.]+[-\w]+)"/).each{|row|
30
- versions[row[0]] = row[1]
31
- }
32
- return versions
27
+ def self.get_versions(filename)
28
+ versions = {}
29
+ if filename.include?(".nuspec")
30
+ nuspec_text = File.read(filename, encoding: "UTF-8")
31
+ nuspec_text.scan(/<dependency\s+id="([\w.]+)"\s+version="([\d.]+[-\w]+)"/).each do |row|
32
+ versions[row[0]] = row[1]
33
33
  end
34
- if(filename.include?('packages.config'))
35
- config_text=File.read(filename,:encoding=>'UTF-8')
36
- config_text.scan(/<package[\s]+id="([\w\.]+)"[\s]+version="([\d\.]+[-\w]+)"/).each{|row|
37
- versions[row[0]] = row[1]
38
- }
39
- return versions
34
+ return versions
35
+ end
36
+ if filename.include?("packages.config")
37
+ config_text = File.read(filename, encoding: "UTF-8")
38
+ config_text.scan(/<package\s+id="([\w.]+)"\s+version="([\d.]+[-\w]+)"/).each do |row|
39
+ versions[row[0]] = row[1]
40
40
  end
41
- if(filename.include?('.csproj'))
42
- config_text=File.read(filename,:encoding=>'UTF-8')
43
- config_text.scan(/<PackageReference[\s]+Include="([\w\.]+)"[\s]+Version="([\d\.]+[-\w]+)"/).each{|row|
44
- versions[row[0]] = row[1]
45
- }
46
- return versions
41
+ return versions
42
+ end
43
+ if filename.include?(".csproj")
44
+ config_text = File.read(filename, encoding: "UTF-8")
45
+ config_text.scan(/<PackageReference\s+Include="([\w.]+)"\s+Version="([\d.]+[-\w]+)"/).each do |row|
46
+ versions[row[0]] = row[1]
47
47
  end
48
- versions
48
+ return versions
49
49
  end
50
+ versions
51
+ end
50
52
 
51
- def self.set_versions filename,versions
52
- text=File.read(filename,:encoding=>'UTF-8')
53
- text_versions=text.scan(/id="[\w\.]+"[\s]+version="[\d\.]+[-\w]+"/)
54
- text2=text
55
- versions.each{|k,v|
56
- text_versions.each{|line|
57
- if(line.include?("\"#{k}\""))
58
- new_line = "id=\"#{k}\" version=\"#{v}\""
59
- text2 = text2.gsub(line,new_line)
60
- end
61
- }
62
- }
63
- unless text==text2
64
- File.open(filename,"w") { |f| f.puts text2 }
53
+ def self.set_versions(filename, versions)
54
+ text = File.read(filename, encoding: "UTF-8")
55
+ text_versions = text.scan(/id="[\w.]+"\s+version="[\d.]+[-\w]+"/)
56
+ text2 = text
57
+ versions.each do |k, v|
58
+ text_versions.each do |line|
59
+ if line.include?("\"#{k}\"")
60
+ new_line = "id=\"#{k}\" version=\"#{v}\""
61
+ text2 = text2.gsub(line, new_line)
65
62
  end
63
+ end
66
64
  end
65
+ File.open(filename, "w") { |f| f.puts text2 } unless text == text2
66
+ end
67
67
 
68
- def self.update_versions(source_filename,destination_filename)
69
- old_versions=Nuget.get_versions(destination_filename)
70
- source_versions=Nuget.get_versions(source_filename)
71
- new_versions=Hash.new
72
- old_versions.each{|k,v|
73
- if(source_versions.has_key?(k))
74
- new_versions[k]=source_versions[k]
75
- end
76
- }
77
- Nuget.set_versions(destination_filename,new_versions)
68
+ def self.update_versions(source_filename, destination_filename)
69
+ old_versions = Nuget.get_versions(destination_filename)
70
+ source_versions = Nuget.get_versions(source_filename)
71
+ new_versions = {}
72
+ old_versions.each do |k, _v|
73
+ new_versions[k] = source_versions[k] if source_versions.key?(k)
78
74
  end
79
- end
75
+ Nuget.set_versions(destination_filename, new_versions)
76
+ end
77
+ end
data/lib/apps/svn.rb CHANGED
@@ -1,152 +1,146 @@
1
- require 'fileutils'
2
- require 'tmpdir'
3
- require_relative('../base/dir.rb')
4
- class Svn
1
+ # frozen_string_literal: true
5
2
 
6
- def self.latest_revision
7
- if(Dir.exists?(".svn"))
8
- `svn update`
9
- `svn info`.scan(/Last Changed Rev: ([\d]+)/).each{|m|
10
- return m.first.to_s
11
- }
12
- end
13
- "0"
14
- end
15
-
16
- def self.url
17
- if(Dir.exists?(".svn"))
18
- `svn info`.scan(/URL: ([:\/\.\-\d\w]+)/).each{|m|
19
- return m.first.to_s
20
- }
21
- end
22
- ''
23
- end
24
-
25
- def self.export url, destination
26
- if(!File.exists?(destination.chomp('@')))
27
- `svn export #{url} #{destination}`
28
- end
29
- end
30
-
31
- def self.has_changes? directory=''
32
- directory=Dir.pwd if directory.length==0
33
- Dir.chdir(directory) do
34
- if(File.exists?('.svn'))
35
- return true if `svn status`.scan(/^[MA]/).length>0
36
- end
37
- end
38
- false
3
+ require "fileutils"
4
+ require "tmpdir"
5
+ require_relative("../base/dir")
6
+
7
+ class Svn
8
+ def self.latest_revision
9
+ if Dir.exist?(".svn")
10
+ `svn update`
11
+ `svn info`.scan(/Last Changed Rev: (\d+)/).each do |m|
12
+ return m.first.to_s
13
+ end
39
14
  end
15
+ "0"
16
+ end
17
+
18
+ def self.url
19
+ if Dir.exist?(".svn")
20
+ `svn info`.scan(%r{URL: ([:/.\-\d\w]+)}).each do |m|
21
+ return m.first.to_s
22
+ end
23
+ end
24
+ ""
25
+ end
26
+
27
+ def self.export(url, destination)
28
+ `svn export #{url} #{destination}` unless File.exist?(destination.chomp("@"))
29
+ end
40
30
 
41
- def self.add source, directory=''
42
- directory=Dir.pwd if directory.length < 1
43
- Dir.chdir(directory) do
44
- source.each{|f|
45
- puts `svn add #{f} --parents` if `svn status #{f}`.include?('?')
46
- puts `svn add #{f} --parents` if !system("svn status #{f}")
47
- }
48
- end
31
+ def self.has_changes?(directory = "")
32
+ directory = Dir.pwd if directory.length.zero?
33
+ Dir.chdir(directory) do
34
+ return true if File.exist?(".svn") && `svn status`.scan(/^[MA]/).length.positive?
49
35
  end
36
+ false
37
+ end
38
+
39
+ def self.add(source, directory = "")
40
+ directory = Dir.pwd if directory.empty?
41
+ Dir.chdir(directory) do
42
+ source.each do |f|
43
+ puts `svn add #{f} --parents` if `svn status #{f}`.include?("?")
44
+ puts `svn add #{f} --parents` unless system("svn status #{f}")
45
+ end
46
+ end
47
+ end
50
48
 
51
- def self.append_commit_message message,directory=''
52
- directory=Dir.pwd if directory.length < 1
53
- Dir.chdir(directory) do
54
-
55
- end
49
+ def self.append_commit_message(_message, directory = "")
50
+ directory = Dir.pwd if directory.empty?
51
+ Dir.chdir(directory) do
52
+ end
53
+ end
54
+
55
+ def self.commit(_message, directory = "")
56
+ directory = Dir.pwd if directory.empty?
57
+ Dir.chdir(directory) do
58
+ # svn commit -F commit_message_filename
59
+ puts `svn commit -m"commit all"`
60
+ `svn update`
61
+ end
62
+ end
63
+
64
+ # publish a directory to a new subversion path
65
+ # source_dir is the directory with the files to be published
66
+ # destination is the new subversion path URL
67
+ # source_glob is a string or array of glob directives to specify files in source_dir to be publish
68
+ # source_glob defaults to '**/*' to publish all files in the source_dir
69
+ def self.publish(destination, source_dir, source_filelist = FileList.new("**/*"))
70
+ # Support for legacy argument order
71
+ if source_dir.include?("svn:") || source_dir.include?("http:") || source_dir.include?("https:")
72
+ puts "warning arguments are in legacy order" if Environment.default.debug?
73
+ # swap arguments
74
+ tmp = source_dir
75
+ source_dir = destination
76
+ destination = tmp
56
77
  end
57
78
 
58
- def self.commit message, directory=''
59
- directory=Dir.pwd if directory.length < 1
60
- Dir.chdir(directory) do
61
- # svn commit -F commit_message_filename
62
- puts `svn commit -m"commit all"`
63
- `svn update`
64
- end
79
+ unless source_filelist.is_a?(FileList)
80
+ puts "converting files array into FileList" if Environment.default.debug?
81
+ list = FileList.new
82
+ source_filelist.each { |item| list.include(item) }
83
+ source_fileList = list
65
84
  end
66
85
 
67
- # publish a directory to a new subversion path
68
- # source_dir is the directory with the files to be published
69
- # destination is the new subversion path URL
70
- # source_glob is a string or array of glob directives to specify files in source_dir to be publish
71
- # source_glob defaults to '**/*' to publish all files in the source_dir
72
- def self.publish destination, source_dir, source_filelist=FileList.new('**/*')
73
-
74
- # Support for legacy argument order
75
- if(source_dir.include?('svn:') || source_dir.include?('http:') || source_dir.include?('https:'))
76
- puts 'warning arguments are in legacy order' if Environment.default.debug?
77
- # swap arguments
78
- tmp=source_dir
79
- source_dir=destination
80
- destination=tmp
81
- end
82
-
83
- if(!source_filelist.kind_of?(FileList))
84
- puts 'converting files array into FileList' if Environment.default.debug?
85
- list=FileList.new
86
- source_filelist.each{|item|list.include(item)}
87
- source_fileList=list
88
- end
89
-
90
- output = "\n"
91
- if(`svn info #{destination} 2>&1`.include?('Revision:'))
92
- puts "Svn.publish: destination #{destination} already exists"
93
- else
94
- # create subversion directory
95
- output = output + "svn mkdir #{destination} --parents --message mkdir_for_publishing"
96
- if(!`svn mkdir #{destination} --parents --message mkdir_for_publishing`.include?('Committed'))
97
- raise "failure 'svn mkdir #{destination} --parents --message mkdir_for_publishing'"
98
- end
99
-
100
- Dir.chdir(source_dir) do
101
- files = source_filelist.to_a
102
- end
103
- files=source_filelist
104
- output = output + "\nfiles: "
105
- files.each{|f|
106
- output = output + f + " "
107
- }
108
- pwd=Dir.pwd
109
-
110
- dir="#{Environment.default.tmp_dir}/svn_publish"
111
- Dir.remove dir if File.exists? dir
112
- FileUtils.mkdir dir
113
- Dir.chdir(dir) do
114
- #Dir.mktmpdir{|dir|
115
-
116
- # checkout new subversion directory
117
- output = output + "\nsvn checkout #{destination} #{dir}/to_publish_checkout"
118
- if(!`svn checkout #{destination} #{dir}/to_publish_checkout`.include?('Checked out'))
119
- raise "failure 'svn checkout #{destination} #{dir}/to_publish_checkout'"
120
- end
121
-
122
- # copy files into the checkout out subversion directory to_publish
123
- raise "#{dir}/to_publish_checkout does not exist" if(!File.exists?("#{dir}/to_publish_checkout"))
124
- Dir.chdir("#{dir}/to_publish_checkout") do
125
- File.open('add.txt','w'){|add_file|
126
-
127
- files.each{|f|
128
- fdir=File.dirname(f)
129
- FileUtils.mkdir_p(fdir) if(fdir.length > 0 && !File.exists?(fdir))
130
- FileUtils.cp("#{source_dir}/#{f}","#{f}")
131
- add_file.puts f
132
- }
133
- add_file.close
134
- }
135
-
136
- output = output + "\nsvn add --parents --targets add.txt 2>&1"
137
- `svn add --parents --targets add.txt 2>&1`
138
- commit_output = `svn commit -m"add" 2>&1`
139
- output = output + "\n#{commit_output}"
140
- if(!commit_output.include?("Committed"))
141
- raise "failure 'svn commit -m'added files''" + output
142
- end
143
- end
144
-
145
- #begin
146
- #Dir.remove "#{dir}/to_publish_checkout"
147
- output
148
- end
149
- Dir.remove(dir)
150
- end
151
- end
152
- end
86
+ output = "\n"
87
+ if `svn info #{destination} 2>&1`.include?("Revision:")
88
+ puts "Svn.publish: destination #{destination} already exists"
89
+ else
90
+ # create subversion directory
91
+ output += "svn mkdir #{destination} --parents --message mkdir_for_publishing"
92
+ unless `svn mkdir #{destination} --parents --message mkdir_for_publishing`.include?("Committed")
93
+ raise "failure 'svn mkdir #{destination} --parents --message mkdir_for_publishing'"
94
+ end
95
+
96
+ Dir.chdir(source_dir) do
97
+ files = source_filelist.to_a
98
+ end
99
+ files = source_filelist
100
+ output = "#{output}\nfiles: "
101
+ files.each do |f|
102
+ output = "#{output}#{f} "
103
+ end
104
+ pwd = Dir.pwd
105
+
106
+ dir = "#{Environment.default.tmp_dir}/svn_publish"
107
+ Dir.remove dir if File.exist? dir
108
+ FileUtils.mkdir dir
109
+ Dir.chdir(dir) do
110
+ # Dir.mktmpdir{|dir|
111
+
112
+ # checkout new subversion directory
113
+ output += "\nsvn checkout #{destination} #{dir}/to_publish_checkout"
114
+ unless `svn checkout #{destination} #{dir}/to_publish_checkout`.include?("Checked out")
115
+ raise "failure 'svn checkout #{destination} #{dir}/to_publish_checkout'"
116
+ end
117
+
118
+ # copy files into the checkout out subversion directory to_publish
119
+ raise "#{dir}/to_publish_checkout does not exist" unless File.exist?("#{dir}/to_publish_checkout")
120
+
121
+ Dir.chdir("#{dir}/to_publish_checkout") do
122
+ File.open("add.txt", "w") do |add_file|
123
+ files.each do |f|
124
+ fdir = File.dirname(f)
125
+ FileUtils.mkdir_p(fdir) if fdir.length.positive? && !File.exist?(fdir)
126
+ FileUtils.cp("#{source_dir}/#{f}", f.to_s)
127
+ add_file.puts f
128
+ end
129
+ add_file.close
130
+ end
131
+
132
+ output = "#{output}\nsvn add --parents --targets add.txt 2>&1"
133
+ `svn add --parents --targets add.txt 2>&1`
134
+ commit_output = `svn commit -m"add" 2>&1`
135
+ output += "\n#{commit_output}"
136
+ raise "failure 'svn commit -m'added files''#{output}" unless commit_output.include?("Committed")
137
+ end
138
+
139
+ # begin
140
+ # Dir.remove "#{dir}/to_publish_checkout"
141
+ output
142
+ end
143
+ Dir.remove(dir)
144
+ end
145
+ end
146
+ end
data/lib/apps/wix.rb CHANGED
@@ -1,57 +1,54 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if defined?(DEBUG)
2
- puts DELIMITER
3
- puts __FILE__
4
- puts
5
- puts 'candle not found' if(!Command.executes?('candle'))
6
- puts 'light not found' if(!Command.executes?('light'))
7
- puts
8
- end
4
+ puts DELIMITER
5
+ puts __FILE__
6
+ puts
7
+ puts "candle not found" unless Command.executes?("candle")
8
+ puts "light not found" unless Command.executes?("light")
9
+ puts
10
+ end
9
11
 
10
- #
11
- #
12
- #
13
12
  class Wix
14
- def self.get_build_commands wxs_file
15
- build_commands=nil
16
- if(File.exists?(wxs_file) && !defined?(NO_WIX))
17
- if(Environment.windows?)
18
- ext='msi'
19
- ext='exe' if(IO.read(wxs_file).include?('<Bundle'))
20
- extensions=''
21
- ['WixNetFxExtension','WixBalExtension','WixUtilExtension','WixUiExtension'].each{|e|
22
- extensions="#{extensions}-ext #{e} "
23
- }
24
- build_commands=Array.new if build_commands.nil?
25
- build_commands << "candle #{wxs_file} #{extensions}"
26
-
27
- if(defined?(VERSION))
28
- build_commands << "light #{File.basename(wxs_file,'.*')}.wixobj -out #{File.basename(wxs_file,'.*')}-#{VERSION}.#{ext} #{extensions}"
29
- else
30
- build_commands << "light #{File.basename(wxs_file,'.*')}.wixobj #{extensions}"
31
- end
32
- end
33
- end
34
- build_commands
13
+ def self.get_build_commands(wxs_file)
14
+ build_commands = nil
15
+ if File.exist?(wxs_file) && !defined?(NO_WIX) && Environment.windows?
16
+ ext = "msi"
17
+ ext = "exe" if IO.read(wxs_file).include?("<Bundle")
18
+ extensions = ""
19
+ %w[WixNetFxExtension WixBalExtension WixUtilExtension WixUiExtension].each do |e|
20
+ extensions = "#{extensions}-ext #{e} "
35
21
  end
22
+ build_commands = [] if build_commands.nil?
23
+ build_commands << "candle #{wxs_file} #{extensions}"
36
24
 
37
- def self.get_wix_with_files wxs_template_text, component_id, filenames
38
- # <Component[-\s\w="]+Id="ApplicationFiles"[-"\s\w=]+>([-<="\/.>\s\w]+)<\/C
39
- search=wxs_template_text.scan(/<Component[-\s\w="]+Id="ApplicationFiles"[-"\s\w=]+>([-<="\/.>\s\w]+)<\/C/)[0][0]
40
- replace=""
41
- index = 0
42
- filenames.each{|f|
43
- replace += "\n <File Id=\"#{component_id}#{index}\" Source=\"#{f}\"/>"
44
- index += 1
45
- }
46
- replace += "\n"
47
- wxs_template_text.gsub(search,replace)
48
- end
49
-
50
- def self.update_wix_files wxs_filename, component_id, filenames
51
- wix_text = IO.read(wxs_filename)
52
- new_text = get_wix_with_files(wix_text, component_id,filenames)
53
- if(wix_text != new_text)
54
- File.open(wxs_filename,'w'){|f| f.write(new_text) }
55
- end
25
+ if defined?(VERSION)
26
+ build_commands << "light #{File.basename(wxs_file,
27
+ ".*")}.wixobj -out #{File.basename(wxs_file,
28
+ ".*")}-#{VERSION}.#{ext} #{extensions}"
29
+ else
30
+ build_commands << "light #{File.basename(wxs_file, ".*")}.wixobj #{extensions}"
56
31
  end
32
+ end
33
+ build_commands
34
+ end
35
+
36
+ def self.get_wix_with_files(wxs_template_text, component_id, filenames)
37
+ # <Component[-\s\w="]+Id="ApplicationFiles"[-"\s\w=]+>([-<="\/.>\s\w]+)<\/C
38
+ search = wxs_template_text.scan(%r{<Component[-\s\w="]+Id="ApplicationFiles"[-"\s\w=]+>([-<="/.>\s\w]+)</C})[0][0]
39
+ replace = ""
40
+ index = 0
41
+ filenames.each do |f|
42
+ replace += "\n <File Id=\"#{component_id}#{index}\" Source=\"#{f}\"/>"
43
+ index += 1
44
+ end
45
+ replace += "\n"
46
+ wxs_template_text.gsub(search, replace)
47
+ end
48
+
49
+ def self.update_wix_files(wxs_filename, component_id, filenames)
50
+ wix_text = IO.read(wxs_filename)
51
+ new_text = get_wix_with_files(wix_text, component_id, filenames)
52
+ File.open(wxs_filename, "w") { |f| f.write(new_text) } if wix_text != new_text
53
+ end
57
54
  end
@@ -1,16 +1,18 @@
1
- #COMMANDS[:build]=['xcodebuild clean -scheme Hydrogen -destination "name=iPhone 6"',
1
+ # frozen_string_literal: true
2
+
3
+ # COMMANDS[:build]=['xcodebuild clean -scheme Hydrogen -destination "name=iPhone 6"',
2
4
  # 'xcodebuild build -scheme Hydrogen -destination "name=iPhone 6"']
3
5
  # COMMANDS[:test]=['xcodebuild test -scheme Hydrogen -destination "name=iPhone 6"'] if RUBY_PLATFORM.include?('darwin')
4
6
 
5
7
  class XCodeBuild < Hash
6
- def self.get_build_commands xcodeproj_filename
7
- #build_commands=Array.new
8
- #build_command=Command.new('xcodebuild build')
9
- #build_command[:directory] = File.dirname(xcodeproj_filename)
8
+ def self.get_build_commands(xcodeproj_filename)
9
+ # build_commands=Array.new
10
+ # build_command=Command.new('xcodebuild build')
11
+ # build_command[:directory] = File.dirname(xcodeproj_filename)
10
12
 
11
- #name=xcodeproj_filename.gsub('.xcodeproj','')
12
- #build_commands << "xcodebuild clean -scheme #{name} -destination \"name=iPhone 6\""
13
- #build_commands << "xcodebuild build -scheme #{name} -destination \"name=iPhone 6\""
14
- #build_commands << build_command
15
- end
16
- end
13
+ # name=xcodeproj_filename.gsub('.xcodeproj','')
14
+ # build_commands << "xcodebuild clean -scheme #{name} -destination \"name=iPhone 6\""
15
+ # build_commands << "xcodebuild build -scheme #{name} -destination \"name=iPhone 6\""
16
+ # build_commands << build_command
17
+ end
18
+ end
data/lib/apps/zip.rb CHANGED
@@ -1,18 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  puts __FILE__ if defined?(DEBUG)
2
4
 
3
- require 'zip'
4
- require 'fileutils'
5
+ require "zip"
6
+ require "fileutils"
5
7
 
6
8
  module Zip
7
- extend self
8
9
  # exports a zip file to a destination directory
9
10
  # zip_file full path to a zip file to be exported
10
11
  # destination directory where the zip file contents are to be placed
11
- def self.export zip_file, destination
12
- raise "#{zip_file} does not exist." unless(::File.exists?(zip_file))
12
+ def self.export(zip_file, destination)
13
+ raise "#{zip_file} does not exist." unless ::File.exist?(zip_file)
13
14
 
14
- unzip(zip_file, destination) unless(Dir.exists?(destination))
15
- sleep(0.5) # I guess we need to give the OS some time to get things in order?
15
+ unzip(zip_file, destination) unless Dir.exist?(destination)
16
+ sleep(0.5) # I guess we need to give the OS some time to get things in order?
16
17
  end
17
18
 
18
19
  # publish a directory to a file path
@@ -20,40 +21,39 @@ module Zip
20
21
  # destination is the zip file path
21
22
  # source_glob is a string or array of glob directives to specify files in source_dir to be publish
22
23
  # source_glob defaults to '**/*' to publish all files in the source_dir
23
- def self.publish source_dir, destination, source_filelist=FileList.new('**/*')
24
- Dir.mktmpdir do |dir| # Build zip file locally
24
+ def self.publish(source_dir, destination, source_filelist = FileList.new("**/*"))
25
+ Dir.mktmpdir do |dir| # Build zip file locally
25
26
  tmp_file_name = "#{dir}/#{::File.basename(destination)}"
26
-
27
+
27
28
  zip(source_dir, source_filelist, tmp_file_name)
28
-
29
+
29
30
  destination_dir = ::File.dirname(destination)
30
- FileUtils.mkpath(destination_dir) unless(Dir.exists?(destination_dir))
31
-
31
+ FileUtils.mkpath(destination_dir) unless Dir.exist?(destination_dir)
32
+
32
33
  FileUtils.cp(tmp_file_name, destination)
33
34
  end
34
35
  end
35
36
 
36
- private
37
- def self.zip(base_directory, files_to_archive, zip_file)
38
- FileUtils.mkpath(::File.dirname(zip_file)) unless(Dir.exists?(::File.dirname(zip_file)))
39
- io = Zip::File.open(zip_file, Zip::File::CREATE);
40
-
37
+ def self.zip(base_directory, files_to_archive, zip_file)
38
+ FileUtils.mkpath(::File.dirname(zip_file)) unless Dir.exist?(::File.dirname(zip_file))
39
+ io = Zip::File.open(zip_file, Zip::File::CREATE)
40
+
41
41
  files_to_archive.each do |file|
42
- io.get_output_stream(file) { |f| f.puts(::File.open("#{base_directory}/#{file}", "rb").read())}
42
+ io.get_output_stream(file) { |f| f.puts(::File.open("#{base_directory}/#{file}", "rb").read) }
43
43
  end
44
-
45
- io.close();
46
- end
44
+
45
+ io.close
46
+ end
47
47
 
48
48
  def self.unzip(zip_file, destination)
49
- FileUtils.mkpath(destination) unless(Dir.exists?(destination))
49
+ FileUtils.mkpath(destination) unless Dir.exist?(destination)
50
50
  Zip::File.open(zip_file) do |files|
51
51
  files.each do |entry|
52
52
  destination_file = "#{destination}/#{entry.name}"
53
53
 
54
54
  directory = ::File.dirname(destination_file)
55
- FileUtils.mkpath(directory) unless(Dir.exists?(directory))
56
-
55
+ FileUtils.mkpath(directory) unless Dir.exist?(directory)
56
+
57
57
  entry.extract(destination_file)
58
58
  end
59
59
  end