Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 3304 Bytes
1 | begin |
2 | require 'git' |
3 | rescue LoadError |
4 | end |
5 | |
6 | class ExtensionGenerator < Rails::Generator::NamedBase |
7 | default_options :with_test_unit => false |
8 | |
9 | attr_reader :extension_path, :extension_file_name |
10 | |
11 | def initialize(runtime_args, runtime_options = {}) |
12 | super |
13 | @extension_file_name = "#{file_name}_extension" |
14 | @extension_path = "vendor/extensions/#{file_name}" |
15 | end |
16 | |
17 | def manifest |
18 | record do |m| |
19 | m.directory "#{extension_path}/app/controllers" |
20 | m.directory "#{extension_path}/app/helpers" |
21 | m.directory "#{extension_path}/app/models" |
22 | m.directory "#{extension_path}/app/views" |
23 | m.directory "#{extension_path}/config/locales" |
24 | m.directory "#{extension_path}/db/migrate" |
25 | m.directory "#{extension_path}/lib/tasks" |
26 | |
27 | m.template 'README', "#{extension_path}/README" |
28 | m.template 'extension.rb', "#{extension_path}/#{extension_file_name}.rb" |
29 | m.template 'tasks.rake', "#{extension_path}/lib/tasks/#{extension_file_name}_tasks.rake" |
30 | m.template 'en.yml', "#{extension_path}/config/locales/en.yml" |
31 | m.template 'routes.rb', "#{extension_path}/config/routes.rb" |
32 | |
33 | if options[:with_test_unit] |
34 | m.directory "#{extension_path}/test/fixtures" |
35 | m.directory "#{extension_path}/test/functional" |
36 | m.directory "#{extension_path}/test/unit" |
37 | |
38 | m.template 'Rakefile', "#{extension_path}/Rakefile" |
39 | m.template 'test_helper.rb', "#{extension_path}/test/test_helper.rb" |
40 | m.template 'functional_test.rb', "#{extension_path}/test/functional/#{extension_file_name}_test.rb" |
41 | else |
42 | m.directory "#{extension_path}/spec/controllers" |
43 | m.directory "#{extension_path}/spec/models" |
44 | m.directory "#{extension_path}/spec/views" |
45 | m.directory "#{extension_path}/spec/helpers" |
46 | m.directory "#{extension_path}/features/support" |
47 | m.directory "#{extension_path}/features/step_definitions/admin" |
48 | |
49 | m.template 'RSpecRakefile', "#{extension_path}/Rakefile" |
50 | m.template 'spec_helper.rb', "#{extension_path}/spec/spec_helper.rb" |
51 | m.file 'spec.opts', "#{extension_path}/spec/spec.opts" |
52 | m.file 'cucumber.yml', "#{extension_path}/cucumber.yml" |
53 | m.template 'cucumber_env.rb', "#{extension_path}/features/support/env.rb" |
54 | m.template 'cucumber_paths.rb', "#{extension_path}/features/support/paths.rb" |
55 | end |
56 | end |
57 | end |
58 | |
59 | def class_name |
60 | super.to_name.gsub(' ', '') + 'Extension' |
61 | end |
62 | |
63 | def extension_name |
64 | class_name.to_name('Extension') |
65 | end |
66 | |
67 | def author_info |
68 | @author_info ||= begin |
69 | Git.global_config |
70 | rescue NameError |
71 | {} |
72 | end |
73 | end |
74 | |
75 | def homepage |
76 | author_info['github.user'] ? "http://github.com/#{author_info['github.user']}/radiant-#{file_name}-extension" : "http://yourwebsite.com/#{file_name}" |
77 | end |
78 | |
79 | def author_email |
80 | author_info['user.email'] || 'your email' |
81 | end |
82 | |
83 | def author_name |
84 | author_info['user.name'] || 'Your Name' |
85 | end |
86 | |
87 | def add_options!(opt) |
88 | opt.separator '' |
89 | opt.separator 'Options:' |
90 | opt.on("--with-test-unit", |
91 | "Use Test::Unit for this extension instead of RSpec") { |v| options[:with_test_unit] = v } |
92 | end |
93 | end |