17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/integra/commands.rb', line 17
def init(options)
require 'fileutils'
if (app_host = options[:args].first)
Integra.config.app_host = self.build_url(app_host)
end
['integra', 'rspec'].each do |file|
File.open(File.expand_path("./.#{file}"), 'w+') do |f|
data = open("#{Integra.gem_libdir}/template/#{file}").read
data.gsub!('{lang}', Integra.config.lang.to_s)
data.gsub!('{app_host}', Integra.config.app_host.to_s)
f.write(data)
end
Integra.logger.action('create', ".#{file}")
end
FileUtils.mkdir_p(File.expand_path('./features/support/'))
FileUtils.mkdir_p(File.expand_path('./features/reports/'))
Integra.logger.action('create', 'features/reports/')
FileUtils.cp(Integra.gem_libdir + "/template/i18n/sample.#{Integra.config.lang}.feature", File.expand_path('./features/sample.feature'))
Integra.logger.action('create', 'features/sample.feature')
support_dest = 'features/support/'
Dir.glob(Integra.gem_libdir + "/template/features/support/*.rb").each do |source|
unless File.exists?(File.expand_path("#{support_dest}#{File.basename(source)}"))
FileUtils.cp(source, File.expand_path(support_dest))
Integra.logger.action('create', "#{support_dest}#{File.basename(source)}")
end
end
end
|