corl 0.4.0 → 0.4.1
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.
- data/Gemfile +5 -10
- data/Gemfile.lock +13 -11
- data/README.rdoc +1 -1
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/bin/corl +2 -54
- data/bootstrap/bootstrap.sh +91 -0
- data/bootstrap/lib/shell/LICENSE.txt +674 -0
- data/bootstrap/lib/shell/command.sh +214 -0
- data/bootstrap/lib/shell/filesystem.sh +139 -0
- data/bootstrap/lib/shell/load.sh +73 -0
- data/bootstrap/lib/shell/os.sh +67 -0
- data/bootstrap/lib/shell/script.sh +160 -0
- data/bootstrap/lib/shell/starter.sh +64 -0
- data/bootstrap/lib/shell/validators.sh +50 -0
- data/bootstrap/os/ubuntu/00_base.sh +5 -0
- data/bootstrap/os/ubuntu/01_git.sh +5 -0
- data/bootstrap/os/ubuntu/05_ruby.sh +7 -0
- data/bootstrap/os/ubuntu/06_puppet.sh +38 -0
- data/bootstrap/os/ubuntu/10_corl.sh +9 -0
- data/corl.gemspec +61 -124
- data/lib/{corl → CORL}/action/bootstrap.rb +13 -7
- data/lib/CORL/action/exec.rb +39 -0
- data/lib/CORL/action/image.rb +31 -0
- data/lib/{corl → CORL}/action/images.rb +1 -1
- data/lib/CORL/action/lookup.rb +34 -0
- data/lib/{corl → CORL}/action/machines.rb +1 -1
- data/lib/CORL/action/provision.rb +31 -0
- data/lib/{corl → CORL}/action/seed.rb +3 -3
- data/lib/{corl → CORL}/action/spawn.rb +2 -2
- data/lib/CORL/action/start.rb +31 -0
- data/lib/CORL/action/stop.rb +31 -0
- data/lib/{corl → CORL}/configuration/file.rb +1 -1
- data/lib/{corl → CORL}/event/puppet.rb +1 -1
- data/lib/{corl → CORL}/extension/puppetloader.rb +1 -1
- data/lib/{corl → CORL}/machine/fog.rb +3 -3
- data/lib/{corl → CORL}/machine/physical.rb +2 -2
- data/lib/{corl → CORL}/network/default.rb +1 -1
- data/lib/{corl → CORL}/node/aws.rb +0 -4
- data/lib/{corl → CORL}/node/google.rb +0 -4
- data/lib/{corl → CORL}/node/local.rb +1 -1
- data/lib/{corl → CORL}/node/rackspace.rb +0 -4
- data/lib/{corl → CORL}/provisioner/puppetnode.rb +1 -14
- data/lib/{corl → CORL}/provisioner/puppetnode/resource.rb +0 -0
- data/lib/{corl → CORL}/provisioner/puppetnode/resource_group.rb +0 -0
- data/lib/{corl → CORL}/template/environment.rb +1 -1
- data/lib/core/facade.rb +49 -0
- data/lib/{corl_core → core}/mixin/action/keypair.rb +10 -10
- data/lib/{corl_core → core}/mixin/lookup.rb +0 -0
- data/lib/{corl_core → core}/mod/hiera_backend.rb +0 -0
- data/lib/{corl_core/mixin/action/node.rb → core/plugin/action.rb} +66 -33
- data/lib/{corl_core → core}/plugin/configuration.rb +2 -2
- data/lib/{corl/node → core/plugin}/fog.rb +5 -1
- data/lib/{corl_core → core}/plugin/machine.rb +2 -2
- data/lib/{corl_core → core}/plugin/network.rb +4 -4
- data/lib/{corl_core → core}/plugin/node.rb +11 -9
- data/lib/{corl_core → core}/plugin/provisioner.rb +2 -2
- data/lib/{corl_core → core}/util/ssh.rb +1 -1
- data/lib/corl.rb +53 -112
- data/lib/puppet/parser/functions/ensure.rb +0 -4
- data/locales/en.yml +55 -148
- metadata +84 -222
- data/lib/corl/action/add.rb +0 -69
- data/lib/corl/action/clone.rb +0 -40
- data/lib/corl/action/create.rb +0 -55
- data/lib/corl/action/exec.rb +0 -41
- data/lib/corl/action/extract.rb +0 -49
- data/lib/corl/action/image.rb +0 -30
- data/lib/corl/action/lookup.rb +0 -35
- data/lib/corl/action/provision.rb +0 -37
- data/lib/corl/action/remove.rb +0 -51
- data/lib/corl/action/save.rb +0 -53
- data/lib/corl/action/start.rb +0 -37
- data/lib/corl/action/stop.rb +0 -30
- data/lib/corl/action/update.rb +0 -37
- data/lib/corl/command/shell.rb +0 -164
- data/lib/corl/event/regex.rb +0 -52
- data/lib/corl/project/git.rb +0 -465
- data/lib/corl/project/github.rb +0 -108
- data/lib/corl/template/json.rb +0 -16
- data/lib/corl/template/wrapper.rb +0 -16
- data/lib/corl/template/yaml.rb +0 -16
- data/lib/corl/translator/json.rb +0 -27
- data/lib/corl/translator/yaml.rb +0 -27
- data/lib/corl_core/codes.rb +0 -107
- data/lib/corl_core/config.rb +0 -337
- data/lib/corl_core/config/collection.rb +0 -57
- data/lib/corl_core/config/options.rb +0 -70
- data/lib/corl_core/core.rb +0 -59
- data/lib/corl_core/corl.rb +0 -254
- data/lib/corl_core/errors.rb +0 -84
- data/lib/corl_core/facade.rb +0 -126
- data/lib/corl_core/gems.rb +0 -72
- data/lib/corl_core/manager.rb +0 -425
- data/lib/corl_core/mixin/action/commit.rb +0 -58
- data/lib/corl_core/mixin/action/project.rb +0 -53
- data/lib/corl_core/mixin/action/push.rb +0 -52
- data/lib/corl_core/mixin/config/collection.rb +0 -53
- data/lib/corl_core/mixin/config/ops.rb +0 -53
- data/lib/corl_core/mixin/config/options.rb +0 -39
- data/lib/corl_core/mixin/macro/object_interface.rb +0 -361
- data/lib/corl_core/mixin/macro/plugin_interface.rb +0 -380
- data/lib/corl_core/mixin/settings.rb +0 -46
- data/lib/corl_core/mixin/sub_config.rb +0 -148
- data/lib/corl_core/mod/hash.rb +0 -29
- data/lib/corl_core/plugin/action.rb +0 -381
- data/lib/corl_core/plugin/base.rb +0 -374
- data/lib/corl_core/plugin/command.rb +0 -98
- data/lib/corl_core/plugin/event.rb +0 -53
- data/lib/corl_core/plugin/extension.rb +0 -12
- data/lib/corl_core/plugin/project.rb +0 -927
- data/lib/corl_core/plugin/template.rb +0 -80
- data/lib/corl_core/plugin/translator.rb +0 -38
- data/lib/corl_core/util/cli.rb +0 -352
- data/lib/corl_core/util/data.rb +0 -404
- data/lib/corl_core/util/disk.rb +0 -114
- data/lib/corl_core/util/git.rb +0 -47
- data/lib/corl_core/util/interface.rb +0 -319
- data/lib/corl_core/util/liquid.rb +0 -17
- data/lib/corl_core/util/package.rb +0 -93
- data/lib/corl_core/util/shell.rb +0 -239
- data/spec/corl_core/interface_spec.rb +0 -489
data/lib/corl_core/util/git.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
module CORL
|
2
|
-
module Util
|
3
|
-
class Git < ::Grit::Repo
|
4
|
-
|
5
|
-
#-----------------------------------------------------------------------------
|
6
|
-
# Constructor / Destructor
|
7
|
-
|
8
|
-
def initialize(path, options = {})
|
9
|
-
epath = File.expand_path(path)
|
10
|
-
git_dir = File.join(epath, '.git')
|
11
|
-
|
12
|
-
@bare = (options[:is_bare] ? true : false)
|
13
|
-
|
14
|
-
Grit.debug = true if CORL.log_level == :debug
|
15
|
-
|
16
|
-
if File.exist?(git_dir)
|
17
|
-
self.working_dir = epath
|
18
|
-
|
19
|
-
if File.directory?(git_dir)
|
20
|
-
self.path = git_dir
|
21
|
-
else
|
22
|
-
git_dir = Util::Disk.read(git_dir)
|
23
|
-
unless git_dir.nil?
|
24
|
-
git_dir = git_dir.gsub(/^gitdir\:\s*/, '').strip
|
25
|
-
self.path = git_dir if File.directory?(git_dir)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
elsif File.directory?(epath) && (options[:is_bare] || (epath =~ /\.git$/ && File.exist?(File.join(epath, 'HEAD'))))
|
30
|
-
self.path = epath
|
31
|
-
@bare = true
|
32
|
-
|
33
|
-
else
|
34
|
-
self.path = git_dir
|
35
|
-
end
|
36
|
-
|
37
|
-
self.git = ::Grit::Git.new(self.path)
|
38
|
-
self.git.work_tree = epath
|
39
|
-
|
40
|
-
#unless File.directory?(epath) && self.git.exist?
|
41
|
-
# FileUtils.mkdir_p(epath) unless File.directory?(epath)
|
42
|
-
# self.git.init({ :bare => @bare })
|
43
|
-
#end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,319 +0,0 @@
|
|
1
|
-
|
2
|
-
module CORL
|
3
|
-
module Util
|
4
|
-
class Interface
|
5
|
-
|
6
|
-
#-----------------------------------------------------------------------------
|
7
|
-
# Properties
|
8
|
-
|
9
|
-
@@log_level = nil
|
10
|
-
@@loggers = {}
|
11
|
-
|
12
|
-
def self.log_level
|
13
|
-
@@log_level
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.log_level=level
|
17
|
-
@@log_level = set_log_level(level)
|
18
|
-
end
|
19
|
-
|
20
|
-
#---
|
21
|
-
|
22
|
-
def self.loggers
|
23
|
-
@@loggers
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.add_log_levels(*levels)
|
27
|
-
levels = levels.flatten.collect do |level|
|
28
|
-
level.to_s.upcase
|
29
|
-
end
|
30
|
-
Log4r::Configurator.custom_levels(*levels)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.add_logger(name, logger)
|
34
|
-
logger.outputters = Log4r::StdoutOutputter.new('console')
|
35
|
-
|
36
|
-
level = log_level.nil? ? 'off' : log_level
|
37
|
-
set_log_level(level, logger)
|
38
|
-
|
39
|
-
@@loggers[name] = logger
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.set_log_level(level, logger = nil)
|
43
|
-
level_sym = level.to_s.downcase.to_sym
|
44
|
-
level_id = level.to_s.upcase
|
45
|
-
|
46
|
-
if logger.nil?
|
47
|
-
loggers.each do |name, registered_logger|
|
48
|
-
@@loggers[name].level = Log4r.const_get(level_id)
|
49
|
-
end
|
50
|
-
else
|
51
|
-
if logger.levels.include?(level_id)
|
52
|
-
logger.level = Log4r.const_get(level_id)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
level_sym
|
56
|
-
end
|
57
|
-
|
58
|
-
#---
|
59
|
-
|
60
|
-
# Initialize log levels
|
61
|
-
|
62
|
-
add_log_levels :debug, :info, :warn, :error, :hook
|
63
|
-
|
64
|
-
if ENV['CORL_LOG']
|
65
|
-
Interface.log_level = ENV['CORL_LOG']
|
66
|
-
end
|
67
|
-
|
68
|
-
#---
|
69
|
-
|
70
|
-
@@ui_lock = Mutex.new
|
71
|
-
|
72
|
-
#---
|
73
|
-
|
74
|
-
COLORS = {
|
75
|
-
:clear => "\e[0m",
|
76
|
-
:red => "\e[31m",
|
77
|
-
:green => "\e[32m",
|
78
|
-
:yellow => "\e[33m"
|
79
|
-
}
|
80
|
-
|
81
|
-
COLOR_MAP = {
|
82
|
-
:warn => COLORS[:yellow],
|
83
|
-
:error => COLORS[:red],
|
84
|
-
:success => COLORS[:green]
|
85
|
-
}
|
86
|
-
|
87
|
-
#-----------------------------------------------------------------------------
|
88
|
-
# Constructor
|
89
|
-
|
90
|
-
def initialize(options = {})
|
91
|
-
if options.is_a?(String)
|
92
|
-
options = { :resource => options, :logger => options }
|
93
|
-
end
|
94
|
-
config = Config.ensure(options)
|
95
|
-
|
96
|
-
@resource = config.get(:resource, '')
|
97
|
-
|
98
|
-
if config.get(:logger, false)
|
99
|
-
self.logger = config[:logger]
|
100
|
-
else
|
101
|
-
self.logger = Log4r::Logger.new(@resource)
|
102
|
-
end
|
103
|
-
|
104
|
-
@color = config.get(:color, true)
|
105
|
-
@printer = config.get(:printer, :puts)
|
106
|
-
|
107
|
-
@input = config.get(:input, $stdin)
|
108
|
-
@output = config.get(:output, $stdout)
|
109
|
-
@error = config.get(:error, $stderr)
|
110
|
-
|
111
|
-
@delegate = config.get(:ui_delegate, nil)
|
112
|
-
end
|
113
|
-
|
114
|
-
#---
|
115
|
-
|
116
|
-
def inspect
|
117
|
-
"#<#{self.class}: #{@resource}>"
|
118
|
-
end
|
119
|
-
|
120
|
-
#-----------------------------------------------------------------------------
|
121
|
-
# Accessors / Modifiers
|
122
|
-
|
123
|
-
attr_reader :logger
|
124
|
-
attr_accessor :resource, :color, :input, :output, :error, :delegate
|
125
|
-
|
126
|
-
#---
|
127
|
-
|
128
|
-
def logger=logger
|
129
|
-
if logger.is_a?(String)
|
130
|
-
@logger = Log4r::Logger.new(logger)
|
131
|
-
else
|
132
|
-
@logger = logger
|
133
|
-
end
|
134
|
-
self.class.add_logger(@resource, @logger)
|
135
|
-
end
|
136
|
-
|
137
|
-
#-----------------------------------------------------------------------------
|
138
|
-
# UI functionality
|
139
|
-
|
140
|
-
def say(type, message, options = {})
|
141
|
-
return @delegate.say(type, message, options) if check_delegate('say')
|
142
|
-
|
143
|
-
defaults = { :new_line => true, :prefix => true }
|
144
|
-
options = defaults.merge(options)
|
145
|
-
printer = options[:new_line] ? :puts : :print
|
146
|
-
channel = type == :error || options[:channel] == :error ? @error : @output
|
147
|
-
|
148
|
-
options[:sync] = true unless options.has_key?(:sync)
|
149
|
-
|
150
|
-
render = lambda do
|
151
|
-
safe_puts(format_message(type, message, options),
|
152
|
-
:channel => channel, :printer => printer)
|
153
|
-
end
|
154
|
-
|
155
|
-
if options[:sync]
|
156
|
-
@@ui_lock.synchronize do
|
157
|
-
render.call
|
158
|
-
end
|
159
|
-
else
|
160
|
-
render.call
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
#---
|
165
|
-
|
166
|
-
def ask(message, options = {})
|
167
|
-
return @delegate.ask(message, options) if check_delegate('ask')
|
168
|
-
|
169
|
-
options[:new_line] = false if ! options.has_key?(:new_line)
|
170
|
-
options[:prefix] = false if ! options.has_key?(:prefix)
|
171
|
-
options[:echo] = true if ! options.has_key?(:echo)
|
172
|
-
|
173
|
-
options[:sync] = true unless options.has_key?(:sync)
|
174
|
-
|
175
|
-
user_input = nil
|
176
|
-
|
177
|
-
collect = lambda do
|
178
|
-
say(:info, message, Config.ensure(options).import({ :sync => false }).export)
|
179
|
-
|
180
|
-
if options[:echo]
|
181
|
-
user_input = @input.gets.chomp
|
182
|
-
else
|
183
|
-
require 'io/console'
|
184
|
-
user_input = @input.noecho(&:gets).chomp
|
185
|
-
end
|
186
|
-
safe_puts("\n")
|
187
|
-
user_input
|
188
|
-
end
|
189
|
-
|
190
|
-
if options[:sync]
|
191
|
-
@@ui_lock.synchronize do
|
192
|
-
return collect.call
|
193
|
-
end
|
194
|
-
else
|
195
|
-
return collect.call
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
#---
|
200
|
-
|
201
|
-
def password(type, options = {})
|
202
|
-
return @delegate.password(type, options) if check_delegate('password')
|
203
|
-
|
204
|
-
options[:sync] = true unless options.has_key?(:sync)
|
205
|
-
|
206
|
-
collect = lambda do
|
207
|
-
try_again = true
|
208
|
-
password = nil
|
209
|
-
|
210
|
-
while try_again
|
211
|
-
# Get and check a password from the keyboard
|
212
|
-
password = ask("Enter #{type} password: ", { :echo => false, :sync => false })
|
213
|
-
confirmation_password = ask("Confirm #{type} password: ", { :echo => false, :sync => false })
|
214
|
-
|
215
|
-
if password != confirmation_password
|
216
|
-
choice = ask('Passwords do not match! Try again? (Y|N): ', { :sync => false })
|
217
|
-
try_again = choice.upcase == "Y"
|
218
|
-
password = nil unless try_again
|
219
|
-
else
|
220
|
-
try_again = false
|
221
|
-
end
|
222
|
-
end
|
223
|
-
password
|
224
|
-
end
|
225
|
-
|
226
|
-
if options[:sync]
|
227
|
-
@@ui_lock.synchronize do
|
228
|
-
return collect.call
|
229
|
-
end
|
230
|
-
else
|
231
|
-
return collect.call
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
#-----------------------------------------------------------------------------
|
236
|
-
|
237
|
-
def info(message, *args)
|
238
|
-
@logger.info("info: #{message}")
|
239
|
-
|
240
|
-
return @delegate.info(message, *args) if check_delegate('info')
|
241
|
-
say(:info, message, *args)
|
242
|
-
end
|
243
|
-
|
244
|
-
#---
|
245
|
-
|
246
|
-
def warn(message, *args)
|
247
|
-
@logger.info("warn: #{message}")
|
248
|
-
|
249
|
-
return @delegate.warn(message, *args) if check_delegate('warn')
|
250
|
-
say(:warn, message, *args)
|
251
|
-
end
|
252
|
-
|
253
|
-
#---
|
254
|
-
|
255
|
-
def error(message, *args)
|
256
|
-
@logger.info("error: #{message}")
|
257
|
-
|
258
|
-
return @delegate.error(message, *args) if check_delegate('error')
|
259
|
-
say(:error, message, *args)
|
260
|
-
end
|
261
|
-
|
262
|
-
#---
|
263
|
-
|
264
|
-
def success(message, *args)
|
265
|
-
@logger.info("success: #{message}")
|
266
|
-
|
267
|
-
return @delegate.success(message, *args) if check_delegate('success')
|
268
|
-
say(:success, message, *args)
|
269
|
-
end
|
270
|
-
|
271
|
-
#-----------------------------------------------------------------------------
|
272
|
-
# Utilities
|
273
|
-
|
274
|
-
def format_message(type, message, options = {})
|
275
|
-
return @delegate.format_message(type, message, options) if check_delegate('format_message')
|
276
|
-
return '' if message.to_s.strip.empty?
|
277
|
-
|
278
|
-
if @resource && ! @resource.empty? && options[:prefix]
|
279
|
-
prefix = "[#{@resource}]"
|
280
|
-
end
|
281
|
-
message = "#{prefix} #{message}".lstrip.gsub(/\n+$/, '')
|
282
|
-
|
283
|
-
if @color
|
284
|
-
if options.has_key?(:color)
|
285
|
-
color = COLORS[options[:color]]
|
286
|
-
message = "#{color}#{message}#{COLORS[:clear]}"
|
287
|
-
else
|
288
|
-
message = "#{COLOR_MAP[type]}#{message}#{COLORS[:clear]}" if COLOR_MAP[type]
|
289
|
-
end
|
290
|
-
end
|
291
|
-
return message
|
292
|
-
end
|
293
|
-
|
294
|
-
#---
|
295
|
-
|
296
|
-
def safe_puts(message = nil, options = {})
|
297
|
-
return @delegate.safe_puts(message, options) if check_delegate('safe_puts')
|
298
|
-
|
299
|
-
message ||= ""
|
300
|
-
options = {
|
301
|
-
:channel => @output,
|
302
|
-
:printer => @printer,
|
303
|
-
}.merge(options)
|
304
|
-
|
305
|
-
begin
|
306
|
-
options[:channel].send(options[:printer], message)
|
307
|
-
rescue Errno::EPIPE
|
308
|
-
return
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
#-----------------------------------------------------------------------------
|
313
|
-
|
314
|
-
def check_delegate(method)
|
315
|
-
return ( @delegate && @delegate.respond_to?(method.to_s) )
|
316
|
-
end
|
317
|
-
end
|
318
|
-
end
|
319
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
|
2
|
-
module CORL
|
3
|
-
module Util
|
4
|
-
class Package
|
5
|
-
|
6
|
-
#-----------------------------------------------------------------------------
|
7
|
-
# Constructor / Destructor
|
8
|
-
|
9
|
-
def initialize(options = {})
|
10
|
-
if options.is_a?(String)
|
11
|
-
@data = Config.new
|
12
|
-
decode(options)
|
13
|
-
else
|
14
|
-
@data = Config.ensure(options)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
#-----------------------------------------------------------------------------
|
19
|
-
# Property accessors / modifiers
|
20
|
-
|
21
|
-
attr_reader :data
|
22
|
-
|
23
|
-
#-----------------------------------------------------------------------------
|
24
|
-
# Operations
|
25
|
-
|
26
|
-
def encode
|
27
|
-
Base64.encode64(Data.to_json(data.export, false))
|
28
|
-
end
|
29
|
-
|
30
|
-
def decode(encoded_string)
|
31
|
-
data.import(Data.symbol_map(Data.parse_json(Base64.decode64(encoded_string))))
|
32
|
-
end
|
33
|
-
|
34
|
-
#---
|
35
|
-
|
36
|
-
def add_file(file, target_path = nil, perm = 0600)
|
37
|
-
target_path = file if target_path.nil?
|
38
|
-
file = File.expand_path(file)
|
39
|
-
|
40
|
-
if File.exists?(file)
|
41
|
-
content = Disk.read(file)
|
42
|
-
data.set([ :files, target_path ], { :perm => perm, :content => content }) if content
|
43
|
-
end
|
44
|
-
self
|
45
|
-
end
|
46
|
-
|
47
|
-
#---
|
48
|
-
|
49
|
-
def add_files(base_path, file_glob, target_path = nil, perm = 0600)
|
50
|
-
target_path = base_path if target_path.nil?
|
51
|
-
curr_dir = Dir.pwd
|
52
|
-
|
53
|
-
Dir.chdir(File.expand_path(base_path))
|
54
|
-
Dir.glob(file_glob.gsub(/^[\/\\]+/, '')) do |file|
|
55
|
-
content = Disk.read(file)
|
56
|
-
|
57
|
-
if content
|
58
|
-
data.set([ :dir, target_path, file ], { :perm => perm, :content => content })
|
59
|
-
end
|
60
|
-
end
|
61
|
-
Dir.chdir(curr_dir)
|
62
|
-
self
|
63
|
-
end
|
64
|
-
|
65
|
-
#---
|
66
|
-
|
67
|
-
def extract(base_path)
|
68
|
-
success = true
|
69
|
-
|
70
|
-
data.get_hash(:files).each do |target_path, info|
|
71
|
-
file = File.join(base_path.to_s, target_path.to_s)
|
72
|
-
perm = info[:perm]
|
73
|
-
content = info[:content]
|
74
|
-
|
75
|
-
FileUtils.mkdir_p(File.dirname(file))
|
76
|
-
success = false unless Disk.write(file, content) && File.chmod(perm, file)
|
77
|
-
end
|
78
|
-
|
79
|
-
data.get_hash(:dir).each do |target_path, files|
|
80
|
-
files.each do |file, info|
|
81
|
-
file = File.join(base_path.to_s, target_path.to_s, file.to_s)
|
82
|
-
perm = info[:perm]
|
83
|
-
content = info[:content]
|
84
|
-
|
85
|
-
FileUtils.mkdir_p(File.dirname(file))
|
86
|
-
success = false unless Disk.write(file, content) && File.chmod(perm, file)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
success
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|