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:
- 1785 Bytes
1 | class LanguageExtensionGenerator < Rails::Generator::NamedBase |
2 | default_options :with_test_unit => false |
3 | |
4 | attr_reader :extension_path, :extension_file_name, :localization_name |
5 | |
6 | def initialize(runtime_args, runtime_options = {}) |
7 | super |
8 | @extension_file_name = "#{file_name}_language_pack_extension" |
9 | @extension_path = "vendor/extensions/#{file_name}_language_pack" |
10 | @localization_name = localization_name |
11 | end |
12 | |
13 | def manifest |
14 | record do |m| |
15 | m.directory "#{extension_path}/config/locales" |
16 | m.directory "#{extension_path}/lib/tasks" |
17 | |
18 | m.template 'README', "#{extension_path}/README" |
19 | m.template 'extension.rb', "#{extension_path}/#{extension_file_name}.rb" |
20 | # m.template 'tasks.rake', "#{extension_path}/lib/tasks/#{extension_file_name}_tasks.rake" |
21 | m.template 'lang.yml', "#{extension_path}/config/locales/#{localization_name}.yml" |
22 | m.template 'available_tags.yml', "#{extension_path}/config/locales/#{localization_name}_available_tags.yml" |
23 | end |
24 | |
25 | end |
26 | |
27 | def class_name |
28 | super.to_name.gsub(' ', '') + 'LanguagePackExtension' |
29 | end |
30 | |
31 | def extension_name |
32 | class_name.to_name('Extension') |
33 | end |
34 | |
35 | def add_options!(opt) |
36 | # opt.separator '' |
37 | # opt.separator 'Options:' |
38 | # opt.on("--with-test-unit", |
39 | # "Use Test::Unit for this extension instead of RSpec") { |v| options[:with_test_unit] = v } |
40 | end |
41 | |
42 | def localization_name |
43 | file_name.split('_')[1] ? "#{file_name.split('_')[0]}-#{file_name.split('_')[1].upcase}" : file_name |
44 | end |
45 | |
46 | def copy_files |
47 | FileUtils.cp("#{RADIANT_ROOT}/config/locales/en_available_tags.yml","#{RADIANT_ROOT}/#{extension_path}/config/locales/#{localization_name}_available_tags.yml") |
48 | end |
49 | end |