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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/generators/instance/instance_generator.rb', line 29
def manifest
root = File.expand_path BRISKBILLS_ROOT
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
dispatcher_options = { :chmod => 0755, :shebang => options[:shebang] }
record do |m|
m.directory ""
base_dirs = %w(config config/environments db log script public vendor/plugins)
text_files = %w(CHANGELOG COPYING COPYING.LESSER INSTALL README)
environments = Dir["#{root}/config/environments/*.rb"]
scripts = Dir["#{root}/script/**/*"].reject { |f| f =~ /(destroy|generate|plugin)$/ }
public_files = ["public/.htaccess"] + Dir["#{root}/public/**/*"]
files = base_dirs + text_files + environments + scripts + public_files
files.map! { |f| f = $1 if f =~ %r{^#{root}/(.+)$}; f }
files.sort!
files.each do |file|
case
when File.directory?("#{root}/#{file}")
m.directory file
when file =~ %r{^script/}
m.file brisk_bills_root(file), file, script_options
when file =~ %r{^public/dispatch}
m.file brisk_bills_root(file), file, dispatcher_options
else
m.file brisk_bills_root(file), file
end
end
m.file "instance_generate", "script/generate", script_options
m.template "databases/#{options[:db]}.yml", "config/database.yml", :assigns => {
:app_name => File.basename(File.expand_path(@destination_root)),
:socket => options[:db] == "mysql" ? mysql_socket_location : nil
}
m.file "instance_rakefile", "Rakefile"
m.file "instance_routes.rb", "config/routes.rb"
m.template "instance_environment.rb", "config/environment.rb", :assigns => {
:brisk_bills_environment => File.join(File.dirname(__FILE__), 'templates', brisk_bills_root("config/environment.rb")),
:app_name => File.basename(File.expand_path(@destination_root))
}
m.template "instance_boot.rb", "config/boot.rb"
m.readme brisk_bills_root("INSTALL")
end
end
|