dev 2.1.153 → 2.1.154
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apps/git.rb +207 -208
- data/lib/apps/msbuild.rb +90 -90
- data/lib/apps/nbench.rb +2 -1
- data/lib/apps/nuget.rb +57 -59
- data/lib/apps/svn.rb +137 -143
- data/lib/apps/wix.rb +47 -50
- data/lib/apps/xcodebuild.rb +13 -11
- data/lib/apps/zip.rb +25 -25
- data/lib/apps.rb +3 -1
- data/lib/base/array.rb +66 -64
- data/lib/base/command.rb +237 -238
- data/lib/base/dir.rb +73 -76
- data/lib/base/environment.rb +94 -99
- data/lib/base/file.rb +35 -33
- data/lib/base/gemspec.rb +47 -45
- data/lib/base/giturl.rb +88 -90
- data/lib/base/hash.rb +20 -15
- data/lib/base/history.rb +36 -33
- data/lib/base/internet.rb +22 -20
- data/lib/base/project.rb +410 -423
- data/lib/base/projects.rb +231 -246
- data/lib/base/source.rb +22 -20
- data/lib/base/string.rb +6 -4
- data/lib/base/text.rb +16 -14
- data/lib/base/timeout.rb +29 -28
- data/lib/base/timer.rb +23 -19
- data/lib/base/version.rb +68 -72
- data/lib/base.rb +5 -3
- data/lib/commands.rb +47 -43
- data/lib/dev.config.rb +3 -2
- data/lib/dev.rb +65 -66
- data/lib/tasks/add.rb +34 -40
- data/lib/tasks/analyze.rb +17 -15
- data/lib/tasks/build.rb +101 -103
- data/lib/tasks/clean.rb +6 -4
- data/lib/tasks/clobber.rb +20 -18
- data/lib/tasks/commit.rb +42 -44
- data/lib/tasks/default.rb +41 -39
- data/lib/tasks/doc.rb +10 -8
- data/lib/tasks/info.rb +8 -7
- data/lib/tasks/package.rb +23 -20
- data/lib/tasks/publish.rb +20 -25
- data/lib/tasks/pull.rb +9 -9
- data/lib/tasks/push.rb +11 -13
- data/lib/tasks/setup.rb +180 -183
- data/lib/tasks/test.rb +121 -107
- data/lib/tasks/update.rb +13 -11
- data/lib/tasks.rb +38 -42
- metadata +7 -9
- 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
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
|
75
|
+
Nuget.set_versions(destination_filename, new_versions)
|
76
|
+
end
|
77
|
+
end
|
data/lib/apps/svn.rb
CHANGED
@@ -1,152 +1,146 @@
|
|
1
|
-
|
2
|
-
require 'tmpdir'
|
3
|
-
require_relative('../base/dir.rb')
|
4
|
-
class Svn
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
data/lib/apps/xcodebuild.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
#
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
4
|
-
require
|
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
|
12
|
-
raise "#{zip_file} does not exist." unless
|
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
|
15
|
-
sleep(0.5)
|
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
|
24
|
-
Dir.mktmpdir do |dir|
|
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
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
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
|
56
|
-
|
55
|
+
FileUtils.mkpath(directory) unless Dir.exist?(directory)
|
56
|
+
|
57
57
|
entry.extract(destination_file)
|
58
58
|
end
|
59
59
|
end
|