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:
- 6100 Bytes
1 | require File.dirname(__FILE__) + "/extension_generators_spec_helper" |
2 | |
3 | share_as :AllInstanceGenerators do |
4 | # Check for directories |
5 | %w(config config/environments config/initializers db log script vendor/plugins vendor/extensions |
6 | public public/images public/stylesheets public/images/admin public/stylesheets/admin public/stylesheets/sass |
7 | public/stylesheets/sass/admin script/performance script/process).each do |dir| |
8 | it "should have a #{dir} directory" do |
9 | ''.should have_generated_directory(dir) |
10 | end |
11 | end |
12 | |
13 | # Check for files |
14 | %w(CHANGELOG CONTRIBUTORS LICENSE INSTALL README Rakefile).each do |file| |
15 | it "should have a #{file}" do |
16 | ''.should have_generated_file(file) |
17 | end |
18 | end |
19 | |
20 | # Check for configs |
21 | %w(boot.rb routes.rb environments/production.rb environments/development.rb environments/test.rb).each do |file| |
22 | it "should have a #{file} config file" do |
23 | 'config'.should have_generated_file(file) |
24 | end |
25 | end |
26 | |
27 | # Check for public files |
28 | %w(.htaccess robots.txt 404.html 500.html favicon.ico dispatch.cgi dispatch.fcgi dispatch.rb).each do |file| |
29 | it "should have a #{file} in public/" do |
30 | 'public'.should have_generated_file(file) |
31 | end |
32 | end |
33 | |
34 | # Check for scripts |
35 | %w(about breakpointer cucumber extension runner spec version autospec console dbconsole generate server |
36 | spec_server performance/benchmarker performance/profiler performance/request process/inspector |
37 | process/reaper process/spawner process/spinner).each do |file| |
38 | it "should have a #{file} script" do |
39 | 'script'.should have_generated_file(file) |
40 | end |
41 | end |
42 | |
43 | # Check for admin sass/css |
44 | %w(main.css modules/_links.sass modules/_opacity.sass modules/_rounded.sass modules/_shadow.sass |
45 | partials/_avatars.sass partials/_footer.sass partials/_layout.sass partials/_reset.sass main.sass |
46 | partials/_base.sass partials/_forms.sass partials/_messages.sass partials/_content.sass |
47 | partials/_header.sass partials/_popup.sass partials/_tabcontrol.sass partials/_dateinput.sass |
48 | partials/_toolbar.sass).each do |file| |
49 | if file.ends_with?('.css') |
50 | it "should have a #{file} css file" do |
51 | 'public/stylesheets/admin'.should have_generated_file(file) |
52 | end |
53 | elsif file.ends_with?('.sass') |
54 | it "should have a #{file} sass file" do |
55 | 'public/stylesheets/sass/admin'.should have_generated_file(file) |
56 | end |
57 | end |
58 | end |
59 | |
60 | # Check for admin images |
61 | %w(navigation_secondary_separator.gif add_tab.png navigation_shadow.png minus_disabled.png |
62 | navigation_tabs.png snippet.png brown_bottom_line.gif new_homepage.png single_form_shadow.png |
63 | spacer.gif buttons_background.png new_layout.png spinner.gif collapse.png new_snippet.png |
64 | status_background.png draft_page.png new_user.png status_bottom_left.png expand.png page.png |
65 | status_bottom_right.png layout.png plus.png status_spinner.gif login_shadow.png plus_grey.png |
66 | status_top_left.png metadata_toggle.png popup_border_background.png status_top_right.png minus.png |
67 | popup_border_bottom_left.png tab_close.png minus_grey.png popup_border_bottom_right.png |
68 | vertical_tan_gradient.png navigation_background.gif popup_border_top_left.png view_site.png |
69 | navigation_secondary_background.png popup_border_top_right.png virtual_page.png).each do |file| |
70 | it "should have a #{file} admin image" do |
71 | 'public/images/admin'.should have_generated_file(file) |
72 | end |
73 | end |
74 | |
75 | # Check for admin javascripts |
76 | %w(application.js controls.js dragdrop.js lowpro.js popup.js ruledtable.js sitemap.js tabcontrol.js |
77 | codearea.js cookie.js effects.js prototype.js shortcuts.js status.js utility.js).each do |file| |
78 | it "should have a #{file} admin image" do |
79 | 'public/javascripts/admin'.should have_generated_file(file) |
80 | end |
81 | end |
82 | |
83 | # Check for initializers |
84 | %w(haml.rb).each do |file| |
85 | it "should have a #{file} initializer" do |
86 | 'config/initializers'.should have_generated_file(file) |
87 | end |
88 | end |
89 | end |
90 | |
91 | describe "IntanceGenerator" do |
92 | include FileUtils |
93 | include GeneratorSpecHelperMethods |
94 | Rails::Generator::Base.prepend_sources(Rails::Generator::PathSource.new(:radiant, File.join(BASE_ROOT, 'lib', 'generators'))) |
95 | |
96 | describe('with no options') do |
97 | it_should_behave_like AllInstanceGenerators |
98 | |
99 | before(:all) do |
100 | with_radiant_root_as_base_root { suppress_stdout { run_generator('instance', [RAILS_ROOT]) } } |
101 | end |
102 | |
103 | after(:all) do |
104 | rm_rf Dir["#{RADIANT_ROOT}"] |
105 | end |
106 | end |
107 | |
108 | { 'db2'=>'ibm_db', 'mysql'=>'mysql', 'postgresql'=>'postgresql', |
109 | 'sqlite3'=>'sqlite3', 'sqlserver'=>'sqlserver' }.each do |db, adapter| |
110 | describe("with #{db} database option") do |
111 | it_should_behave_like AllInstanceGenerators |
112 | |
113 | before(:all) do |
114 | with_radiant_root_as_base_root { suppress_stdout { run_generator('instance', ['-d', db, RAILS_ROOT]) } } |
115 | end |
116 | |
117 | it "should generate database.yml with adapter #{adapter} for #{db}" do |
118 | 'config'.should have_generated_yaml('database') do |yaml| |
119 | %w(production development test).each {|env| yaml[env]['adapter'].should == adapter} |
120 | end |
121 | end |
122 | |
123 | after(:all) do |
124 | rm_rf Dir["#{RADIANT_ROOT}"] |
125 | end |
126 | end |
127 | end |
128 | |
129 | describe('with shebang option') do |
130 | it_should_behave_like AllInstanceGenerators |
131 | |
132 | before(:all) do |
133 | @shebang = '/my/path/to/ruby' |
134 | with_radiant_root_as_base_root { suppress_stdout { run_generator('instance', ['-r', @shebang, RAILS_ROOT]) } } |
135 | @files = Dir.glob("#{RADIANT_ROOT}/script/**/*") + Dir.glob("#{RADIANT_ROOT}/public/dispatch*") |
136 | @files.collect! {|i| [i, i.gsub(/\A#{Regexp.escape(RADIANT_ROOT)}\//, '')] } |
137 | end |
138 | |
139 | it 'should set shebang for scripts & dispatchers' do |
140 | @files.each do |fn, f| |
141 | next if File.directory?(fn) |
142 | ''.should have_generated_file(f) do |body| |
143 | body.should match(/\A\#\!#{@shebang}\n/), "#{f} should have shebang '\#!#{@shebang}' but has '#{body.match(/\A(.*)\n/)[1]}'" |
144 | end |
145 | end |
146 | end |
147 | |
148 | after(:all) do |
149 | rm_rf Dir["#{RADIANT_ROOT}"] |
150 | end |
151 | end |
152 | end |