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/base/dir.rb
CHANGED
@@ -1,114 +1,111 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "fileutils"
|
2
4
|
|
3
5
|
class Dir
|
4
|
-
def self.make
|
5
|
-
|
6
|
+
def self.make(directory)
|
7
|
+
FileUtils.mkdir_p directory unless File.exist? directory
|
6
8
|
end
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
rescue
|
9
|
+
|
10
|
+
def self.remove(directory, remove_empty_parents = false)
|
11
|
+
FileUtils.rm_rf directory unless Dir.empty?(directory)
|
12
|
+
FileUtils.rm_r directory if File.exist?(directory)
|
13
|
+
if remove_empty_parents
|
14
|
+
parent_dir = File.dirname(directory)
|
15
|
+
Dir.remove parent_dir, true if Dir.empty?(parent_dir)
|
16
16
|
end
|
17
|
+
rescue StandardError
|
17
18
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
|
20
|
+
def self.empty?(directory)
|
21
|
+
return true if (Dir.entries(directory) - %w[. ..]).empty?
|
22
|
+
|
22
23
|
false
|
23
24
|
end
|
24
25
|
|
25
|
-
def self.get_latest_mtime
|
26
|
-
mtime=Time.new(1980)
|
27
|
-
Dir.chdir(directory)
|
28
|
-
latest_filename=
|
29
|
-
Dir.glob(
|
26
|
+
def self.get_latest_mtime(directory)
|
27
|
+
mtime = Time.new(1980)
|
28
|
+
Dir.chdir(directory) do
|
29
|
+
latest_filename = ""
|
30
|
+
Dir.glob("**/*.*").each do |f|
|
30
31
|
if mtime.nil? || File.mtime(f) > mtime
|
31
|
-
mtime=File.mtime(f)
|
32
|
-
latest_filename=f
|
32
|
+
mtime = File.mtime(f)
|
33
|
+
latest_filename = f
|
33
34
|
end
|
34
|
-
|
35
|
-
puts " latest_mtime #{mtime
|
35
|
+
end
|
36
|
+
puts " latest_mtime #{mtime} #{latest_filename}" if Environment.default.debug?
|
36
37
|
end
|
37
38
|
mtime
|
38
39
|
end
|
39
40
|
|
40
|
-
def self.get_project_name
|
41
|
-
name = directory.split(
|
41
|
+
def self.get_project_name(directory)
|
42
|
+
name = directory.split("/").last
|
42
43
|
rakefile = "#{directory}/rakefile.rb"
|
43
|
-
if
|
44
|
-
txt=IO.read(rakefile)
|
45
|
-
if
|
44
|
+
if File.exist?(rakefile)
|
45
|
+
txt = IO.read(rakefile)
|
46
|
+
if txt.include?("NAME=")
|
46
47
|
scan = txt.scan(/NAME=['"]([\w.]+)/)
|
47
|
-
if(!scan.nil?)
|
48
|
-
name = scan[0][0] if(scan.length > 0 && !scan[0].nil? && scan[0].length > 0)
|
49
|
-
end
|
48
|
+
name = scan[0][0] if !scan.nil? && (scan.length.positive? && !scan[0].nil? && scan[0].length.positive?)
|
50
49
|
end
|
51
50
|
end
|
52
51
|
name
|
53
52
|
end
|
54
53
|
|
55
|
-
def self.zip(directory,files,zipfilename)
|
56
|
-
if Gem::Specification
|
57
|
-
require
|
58
|
-
File.delete(zipfilename) if
|
59
|
-
Zip::File.open(zipfilename,Zip::File::CREATE) do |zipfile|
|
54
|
+
def self.zip(directory, files, zipfilename)
|
55
|
+
if Gem::Specification.find_all_by_name("rubyzip").any?
|
56
|
+
require "zip"
|
57
|
+
File.delete(zipfilename) if File.exist?(zipfilename)
|
58
|
+
Zip::File.open(zipfilename, Zip::File::CREATE) do |zipfile|
|
60
59
|
Dir.chdir(directory) do
|
61
60
|
count = 0
|
62
|
-
files.each
|
63
|
-
zipfile.add(source_file,"#{directory}/#{source_file}")
|
64
|
-
count
|
65
|
-
|
61
|
+
files.each do |source_file|
|
62
|
+
zipfile.add(source_file, "#{directory}/#{source_file}")
|
63
|
+
count += 1
|
64
|
+
end
|
66
65
|
puts "added #{count} files to #{zipfilename}"
|
67
66
|
end
|
68
67
|
end
|
69
68
|
else
|
70
69
|
puts "rubyzip gem is not installed 'gem install rubyzip'"
|
71
70
|
end
|
72
|
-
end
|
71
|
+
end
|
73
72
|
|
74
|
-
def self.unzip(zipfilename,directory)
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
73
|
+
def self.unzip(zipfilename, directory)
|
74
|
+
if Gem::Specification.find_all_by_name("rubyzip").any?
|
75
|
+
require "zip"
|
76
|
+
count = 0
|
77
|
+
Zip::File.open(zipfilename) do |zip_file|
|
78
|
+
zip_file.each do |entry|
|
79
|
+
dest = "#{directory}/#{entry}"
|
80
|
+
parent_dir = File.dirname(dest)
|
81
|
+
FileUtils.mkdir_p parent_dir unless Dir.exist?(parent_dir)
|
82
|
+
entry.extract("#{directory}/#{entry}")
|
83
|
+
count += 1
|
84
|
+
end
|
85
85
|
end
|
86
|
+
puts "extracted #{count} files to #{directory}"
|
87
|
+
else
|
88
|
+
puts "rubyzip gem is not installed 'gem install rubyzip'"
|
86
89
|
end
|
87
|
-
puts "extracted #{count} files to #{directory}"
|
88
|
-
else
|
89
|
-
puts "rubyzip gem is not installed 'gem install rubyzip'"
|
90
90
|
end
|
91
|
-
end
|
92
91
|
|
93
|
-
def self.copy_files(src_dir,glob_pattern,exclude_patterns,target_dir)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
92
|
+
def self.copy_files(src_dir, glob_pattern, exclude_patterns, target_dir)
|
93
|
+
if Dir.exist?(src_dir)
|
94
|
+
Dir.chdir(src_dir) do
|
95
|
+
Dir.glob(glob_pattern).each do |f|
|
96
|
+
next unless File.file?(f)
|
97
|
+
|
98
98
|
exclude = false
|
99
|
-
|
100
|
-
|
101
|
-
exclude = true if(f.include?(p))
|
102
|
-
}
|
103
|
-
end
|
104
|
-
if(!exclude)
|
105
|
-
dest = "#{target_dir}/#{f}"
|
106
|
-
FileUtils.mkdir_p(File.dirname(dest)) if(!Dir.exists?(File.dirname(dest)))
|
107
|
-
FileUtils.cp(f,dest)
|
99
|
+
exclude_patterns&.each do |p|
|
100
|
+
exclude = true if f.include?(p)
|
108
101
|
end
|
102
|
+
next if exclude
|
103
|
+
|
104
|
+
dest = "#{target_dir}/#{f}"
|
105
|
+
FileUtils.mkdir_p(File.dirname(dest)) unless Dir.exist?(File.dirname(dest))
|
106
|
+
FileUtils.cp(f, dest)
|
109
107
|
end
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
113
111
|
end
|
114
|
-
end
|
data/lib/base/environment.rb
CHANGED
@@ -1,138 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
puts DELIMITER if defined?(DEBUG)
|
2
4
|
puts __FILE__ if defined?(DEBUG)
|
3
5
|
|
4
|
-
require_relative(
|
6
|
+
require_relative("string")
|
5
7
|
|
6
8
|
class Environment < Hash
|
7
|
-
attr_accessor :output
|
8
|
-
|
9
|
+
attr_accessor :output, :publish_dir
|
10
|
+
|
11
|
+
@@default = nil
|
9
12
|
def self.default
|
10
|
-
@@default=Environment.new if @@default.nil?
|
13
|
+
@@default = Environment.new if @@default.nil?
|
11
14
|
@@default
|
12
15
|
end
|
13
16
|
|
14
|
-
def initialize
|
15
|
-
@output=
|
17
|
+
def initialize(env = nil)
|
18
|
+
@output = ""
|
16
19
|
|
17
|
-
@env=
|
18
|
-
@env_aliases={
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
|
23
|
-
@@default=self if @@default.nil?
|
20
|
+
@env = {}
|
21
|
+
@env_aliases = { "HOME" => ["USERPROFILE"],
|
22
|
+
"DEV_ROOT" => %w[DEV_HOME HOME USERPROFILE],
|
23
|
+
"USERNAME" => %w[USER USR] }
|
24
|
+
env&.each { |k, v| @env[k.to_s] = v }
|
25
|
+
@@default = self if @@default.nil?
|
24
26
|
|
25
|
-
@publish_dir="#{root_dir}/publish"
|
26
|
-
FileUtils.mkdir_p @publish_dir
|
27
|
+
@publish_dir = "#{root_dir}/publish"
|
28
|
+
FileUtils.mkdir_p @publish_dir unless File.exist? @publish_dir
|
27
29
|
end
|
28
30
|
|
29
|
-
|
31
|
+
# ####Begin LEGACY support
|
30
32
|
def self.dev_root
|
31
33
|
default.root_dir
|
32
34
|
end
|
33
|
-
|
35
|
+
# ####End LEGACY support
|
34
36
|
|
35
37
|
def admin?
|
36
|
-
rights
|
37
|
-
|
38
|
+
rights = `whoami /priv`
|
39
|
+
rights.include?("SeCreateGlobalPrivilege")
|
38
40
|
end
|
41
|
+
|
39
42
|
def root_dir
|
40
|
-
get_env(
|
43
|
+
get_env("DEV_ROOT").gsub('\\', "/")
|
41
44
|
end
|
42
|
-
|
45
|
+
|
43
46
|
def home_dir
|
44
|
-
get_env(
|
47
|
+
get_env("HOME").gsub('\\', "/")
|
45
48
|
end
|
46
49
|
|
47
50
|
def log_dir
|
48
|
-
dir="#{root_dir}/log/#{user}@#{machine}"
|
49
|
-
FileUtils.mkdir_p dir
|
51
|
+
dir = "#{root_dir}/log/#{user}@#{machine}"
|
52
|
+
FileUtils.mkdir_p dir unless File.exist? dir
|
50
53
|
dir
|
51
54
|
end
|
52
55
|
|
53
56
|
def dropbox_dir
|
54
|
-
dropbox_info = "#{ENV[
|
55
|
-
if
|
57
|
+
dropbox_info = "#{ENV["LOCALAPPDATA"]}/Dropbox/info.json"
|
58
|
+
if File.exist?(dropbox_info)
|
56
59
|
info = JSON.parse(IO.read(dropbox_info))
|
57
|
-
if
|
58
|
-
if(info['personal'].has_key?('path'))
|
59
|
-
return info['personal']['path']
|
60
|
-
end
|
61
|
-
end
|
60
|
+
return info["personal"]["path"] if info.key?("personal") && info["personal"].key?("path")
|
62
61
|
end
|
63
62
|
""
|
64
63
|
end
|
65
64
|
|
66
65
|
def tmp_dir
|
67
|
-
dir="#{root_dir}/tmp"
|
68
|
-
FileUtils.mkdir_p dir
|
66
|
+
dir = "#{root_dir}/tmp"
|
67
|
+
FileUtils.mkdir_p dir unless File.exist? dir
|
69
68
|
dir
|
70
69
|
end
|
71
70
|
|
72
71
|
def make_dir
|
73
|
-
dir="#{root_dir}/make"
|
74
|
-
FileUtils.mkdir_p dir
|
72
|
+
dir = "#{root_dir}/make"
|
73
|
+
FileUtils.mkdir_p dir unless File.exist? dir
|
75
74
|
dir
|
76
75
|
end
|
77
76
|
|
78
77
|
def wrk_dir
|
79
|
-
dir="#{root_dir}/work"
|
80
|
-
FileUtils.mkdir_p dir
|
78
|
+
dir = "#{root_dir}/work"
|
79
|
+
FileUtils.mkdir_p dir unless File.exist? dir
|
81
80
|
dir
|
82
81
|
end
|
83
82
|
|
84
83
|
def machine
|
85
|
-
return ENV[
|
84
|
+
return ENV["COMPUTERNAME"] unless ENV["COMPUTERNAME"].nil?
|
85
|
+
|
86
86
|
machine = `hostname`
|
87
|
-
machine = machine.split(
|
88
|
-
|
87
|
+
machine = machine.split(".")[0] if machine.include?(".")
|
88
|
+
machine.strip
|
89
89
|
end
|
90
90
|
|
91
91
|
def user
|
92
|
-
get_env(
|
92
|
+
get_env("USERNAME")
|
93
93
|
end
|
94
94
|
|
95
|
-
def get_env
|
96
|
-
if
|
97
|
-
|
98
|
-
end
|
95
|
+
def get_env(key)
|
96
|
+
return @env[key] if !@env.nil? && @env.key?(key)
|
97
|
+
|
99
98
|
value = ENV[key]
|
100
|
-
if
|
101
|
-
|
102
|
-
|
103
|
-
value=get_env(akey) if value.nil?
|
104
|
-
}
|
99
|
+
if value.nil? && @env_aliases.key?(key)
|
100
|
+
@env_aliases[key].each do |akey|
|
101
|
+
value = get_env(akey) if value.nil?
|
105
102
|
end
|
106
103
|
end
|
107
104
|
value
|
108
105
|
end
|
109
106
|
|
110
|
-
def set_env
|
111
|
-
@env[key]=value
|
107
|
+
def set_env(key, value)
|
108
|
+
@env[key] = value
|
112
109
|
end
|
113
110
|
|
114
111
|
def debug?
|
115
112
|
return true if defined?(DEBUG)
|
113
|
+
|
116
114
|
false
|
117
115
|
end
|
118
116
|
|
119
117
|
def colorize?
|
120
|
-
colorize=true
|
118
|
+
colorize = true
|
121
119
|
if Environment.windows?
|
122
|
-
if
|
123
|
-
require
|
120
|
+
if `gem list win32console`.include?("win32console")
|
121
|
+
require "ansi/code"
|
124
122
|
else
|
125
|
-
colorize=false
|
123
|
+
colorize = false
|
126
124
|
end
|
127
125
|
end
|
128
|
-
if Environment.mac?
|
129
|
-
colorize=false
|
130
|
-
end
|
126
|
+
colorize = false if Environment.mac?
|
131
127
|
colorize
|
132
128
|
end
|
133
129
|
|
134
130
|
def working?
|
135
131
|
return true if Rake.application.original_dir.include? wrk_dir
|
132
|
+
|
136
133
|
false
|
137
134
|
end
|
138
135
|
|
@@ -140,9 +137,9 @@ class Environment < Hash
|
|
140
137
|
true
|
141
138
|
end
|
142
139
|
|
143
|
-
def out
|
144
|
-
|
145
|
-
|
140
|
+
def out(message)
|
141
|
+
puts message unless get_env("SUPPRESS_CONSOLE_OUTPUT")
|
142
|
+
@output = "#{@output}#{message}\\n"
|
146
143
|
end
|
147
144
|
|
148
145
|
def show_success?
|
@@ -151,17 +148,13 @@ class Environment < Hash
|
|
151
148
|
|
152
149
|
def self.OS
|
153
150
|
if windows?
|
154
|
-
|
151
|
+
"windows"
|
152
|
+
elsif mac?
|
153
|
+
"mac"
|
154
|
+
elsif linux?
|
155
|
+
"linux"
|
155
156
|
else
|
156
|
-
|
157
|
-
return "mac"
|
158
|
-
else
|
159
|
-
if linux?
|
160
|
-
return "linux"
|
161
|
-
else
|
162
|
-
return "unix"
|
163
|
-
end
|
164
|
-
end
|
157
|
+
"unix"
|
165
158
|
end
|
166
159
|
end
|
167
160
|
|
@@ -170,7 +163,7 @@ class Environment < Hash
|
|
170
163
|
end
|
171
164
|
|
172
165
|
def self.mac?
|
173
|
-
|
166
|
+
(/darwin/ =~ RUBY_PLATFORM) != nil
|
174
167
|
end
|
175
168
|
|
176
169
|
def self.unix?
|
@@ -178,46 +171,48 @@ class Environment < Hash
|
|
178
171
|
end
|
179
172
|
|
180
173
|
def self.linux?
|
181
|
-
unix? and
|
174
|
+
unix? and !mac?
|
182
175
|
end
|
183
176
|
|
184
177
|
def self.check
|
185
|
-
puts
|
186
|
-
missing_command=false
|
187
|
-
[
|
188
|
-
|
189
|
-
command
|
190
|
-
command[:
|
178
|
+
puts "checking commands..."
|
179
|
+
missing_command = false
|
180
|
+
["ruby --version", "svn --version --quiet", "git --version", "msbuild /version", "nunit-console", "nuget", "candle",
|
181
|
+
"light", "gem --version"].each do |cmd|
|
182
|
+
command = Command.new(cmd)
|
183
|
+
command[:quiet] = true
|
184
|
+
command[:ignore_failure] = true
|
191
185
|
command.execute
|
192
|
-
if(command[:exit_code]
|
193
|
-
puts "#{cmd.split(
|
186
|
+
if (command[:exit_code]).zero?
|
187
|
+
puts "#{cmd.split(" ")[0]} #{get_version(command[:output])}"
|
194
188
|
else
|
195
|
-
puts "#{cmd.split(
|
196
|
-
|
189
|
+
puts "#{cmd.split(" ")[0]} not found."
|
190
|
+
missing_command = true
|
197
191
|
end
|
198
|
-
|
199
|
-
|
200
|
-
|
192
|
+
end
|
193
|
+
if missing_command
|
194
|
+
puts "missing commands may be resolved by making sure that are installed and in PATH environment variable."
|
195
|
+
end
|
201
196
|
end
|
202
197
|
|
203
|
-
def self.get_version
|
198
|
+
def self.get_version(text)
|
204
199
|
text.match(/(\d+\.\d+\.[\d\w]+)/)
|
205
200
|
end
|
206
201
|
|
207
|
-
def info
|
202
|
+
def info
|
208
203
|
puts "Environment"
|
209
204
|
puts " ruby version: #{`ruby --version`}"
|
210
205
|
puts " ruby platform: #{RUBY_PLATFORM}"
|
211
|
-
puts " dev_root: #{
|
212
|
-
puts " machine: #{
|
213
|
-
puts " user: #{
|
206
|
+
puts " dev_root: #{root_dir}"
|
207
|
+
puts " machine: #{machine}"
|
208
|
+
puts " user: #{user}"
|
214
209
|
puts " os: #{Environment.OS}"
|
215
|
-
#puts " configuration: #{self.configuration}"
|
216
|
-
puts " debug: #{
|
217
|
-
#puts "git user.email: #{Git.user_email}"
|
210
|
+
# puts " configuration: #{self.configuration}"
|
211
|
+
puts " debug: #{debug?}"
|
212
|
+
# puts "git user.email: #{Git.user_email}"
|
218
213
|
puts " "
|
219
|
-
#puts "Path Commands"
|
220
|
-
#['svn --version --quiet','git --version','msbuild /version','nuget','candle','light','gem --version'].each{|cmd|
|
214
|
+
# puts "Path Commands"
|
215
|
+
# ['svn --version --quiet','git --version','msbuild /version','nuget','candle','light','gem --version'].each{|cmd|
|
221
216
|
# command=Command.new(cmd)
|
222
217
|
# command[:quiet]=true
|
223
218
|
# command[:ignore_failure]=true
|
@@ -228,9 +223,9 @@ class Environment < Hash
|
|
228
223
|
# puts "#{cmd.split(' ')[0].fix(14)} not found."
|
229
224
|
# missing_command=true
|
230
225
|
# end
|
231
|
-
#}
|
226
|
+
# }
|
232
227
|
end
|
233
228
|
end
|
234
229
|
|
235
230
|
puts "" if defined?(DEBUG)
|
236
|
-
puts Environment.default.info if defined?(DEBUG)
|
231
|
+
puts Environment.default.info if defined?(DEBUG)
|
data/lib/base/file.rb
CHANGED
@@ -1,40 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
puts __FILE__ if defined?(DEBUG)
|
2
4
|
|
3
|
-
require
|
5
|
+
require "fileutils"
|
4
6
|
|
5
7
|
class File
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def self.publish destination, source_dir, source_glob='**/*', exclude_glob=nil# overwrite_existing=false
|
8
|
+
def self.amalgamate(filename, source)
|
9
|
+
File.open(filename, "w") do |file|
|
10
|
+
source.each do |source_file|
|
11
|
+
file.puts IO.read(source_file)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
# overwrite_existing=false
|
17
|
+
def self.publish(destination, source_dir, source_glob = "**/*", exclude_glob = nil)
|
18
|
+
output = "\n"
|
19
|
+
FileUtils.mkdir_p destination unless File.exist? destination
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
files = nil
|
22
|
+
Dir.chdir(source_dir) do
|
23
|
+
files = FileList.new(source_glob).to_a
|
24
|
+
unless exclude_glob.nil?
|
25
|
+
FileList.new(exclude_glob).to_a.each do |f|
|
26
|
+
files.delete(f) if files.include?(f)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
output += "\nfiles: #{files}.to_s"
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
32
|
+
Dir.chdir(source_dir) do
|
33
|
+
files.each do |f|
|
34
|
+
file = "#{destination}/#{f}"
|
35
|
+
dirname = File.dirname(file)
|
36
|
+
FileUtils.mkdir_p dirname unless File.exist? dirname
|
37
|
+
FileUtils.cp(f, file) unless File.exist? file # || overwrite_existing
|
38
|
+
end
|
39
|
+
end
|
40
|
+
output
|
41
|
+
end
|
42
|
+
end
|