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
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
|
# File 'lib/generators/instance/instance_generator.rb', line 45
def manifest
root = File.expand_path(TRUSTY_CMS_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 config/initializers db log script public vendor/plugins vendor/extensions)
text_files = %w(CHANGELOG.md CONTRIBUTORS.md LICENSE.md INSTALL.md README.md)
environments = Dir["#{root}/config/environments/*.rb"]
bundler_compatibility_files = %w{config/preinitializer.rb}
schema_file = %w{db/schema.rb}
scripts = Dir["#{root}/script/**/*"].reject { |f| f =~ /(destroy|generate|plugin)$/ }
public_files = ["public/.htaccess"] + Dir["#{root}/public/**/*"]
test_files = ["config/cucumber.yml"]
files = base_dirs + text_files + environments + bundler_compatibility_files + schema_file + scripts + public_files + test_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 radiant_root(file), file, script_options
when file =~ %r{^public/dispatch}
m.file radiant_root(file), file, dispatcher_options
else
m.file radiant_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.template "instance_gemfile", "Gemfile", :assigns => {
:radiant_version => TrustyCms::VERSION.to_s,
:db => options[:db]
}
m.file "instance_rakefile", "Rakefile"
m.file "instance_config.ru", "config.ru"
m.file "instance_routes.rb", "config/routes.rb"
m.template "instance_environment.rb", "config/environment.rb", :assigns => {
:radiant_environment => File.join(File.dirname(__FILE__), 'templates', radiant_root("config/environment.rb")),
:app_name => File.basename(File.expand_path(@destination_root))
}
m.template "instance_boot.rb", "config/boot.rb"
m.file "instance_radiant_config.rb", "config/initializers/radiant_config.rb"
m.run_bundler @destination_root
m.readme radiant_root("INSTALL.md")
end
end
|