web-app-theme 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{LICENSE → MIT-LICENSE} +0 -0
- data/README.md +17 -1
- data/Rakefile +21 -23
- data/{stylesheets → app/assets/images/web-app-theme}/themes/activo/images/arrow.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/activo/images/boxbar-background.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/activo/images/button-background-active.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/activo/images/button-background.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/activo/images/menubar-background.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/arrow.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/bgd.jpg +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/boxbar-background.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/button-background-active.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/button-background.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/messages/error.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/messages/notice.png +0 -0
- data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/messages/warning.png +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/base.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/activo/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/amro/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/bec-green/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/bec/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/blue/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museo700-regular-webfont.eot +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museo700-regular-webfont.svg +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museo700-regular-webfont.ttf +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museo700-regular-webfont.woff +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museosans_500-webfont.eot +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museosans_500-webfont.svg +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museosans_500-webfont.ttf +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museosans_500-webfont.woff +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museosans_500_italic-webfont.eot +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museosans_500_italic-webfont.svg +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museosans_500_italic-webfont.ttf +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/fonts/museosans_500_italic-webfont.woff +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/default/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/djime-cerulean/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/drastic-dark/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/kathleene/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/olive/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/orange/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/red/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/reidb-greenish/style.css +0 -0
- data/{stylesheets → app/assets/stylesheets/web-app-theme}/themes/warehouse/style.css +0 -0
- data/features/assets_generator.feature +18 -0
- data/features/step_definitions/assets_step.rb +11 -0
- data/features/step_definitions/common_steps.rb +82 -0
- data/features/step_definitions/theme_steps.rb +35 -0
- data/features/step_definitions/themed_steps.rb +12 -14
- data/features/support/env.rb +7 -80
- data/features/theme_generator.feature +15 -18
- data/features/themed_generator.feature +10 -10
- data/lib/generators/web_app_theme/assets/assets_generator.rb +17 -0
- data/lib/generators/web_app_theme/theme/templates/layout_admin.html.erb +1 -1
- data/lib/generators/web_app_theme/theme/templates/layout_sign.html.erb +1 -1
- data/lib/generators/web_app_theme/theme/templates/web_app_theme.css.erb +9 -0
- data/lib/generators/web_app_theme/theme/theme_generator.rb +3 -19
- data/lib/web-app-theme.rb +5 -0
- data/lib/web-app-theme/version.rb +3 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/javascripts/testing.js +2 -0
- data/spec/dummy/app/assets/stylesheets/web_app_theme.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/testing_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/testing_helper.rb +2 -0
- data/spec/dummy/app/models/post.rb +2 -0
- data/spec/dummy/app/views/articles/_form.html.erb +8 -0
- data/spec/dummy/app/views/articles/_sidebar.html.erb +13 -0
- data/spec/dummy/app/views/articles/edit.html.erb +19 -0
- data/spec/dummy/app/views/articles/index.html.erb +42 -0
- data/spec/dummy/app/views/articles/new.html.erb +18 -0
- data/spec/dummy/app/views/articles/show.html.erb +19 -0
- data/spec/dummy/app/views/layouts/application.html.erb +46 -0
- data/spec/dummy/app/views/posts/_form.html.erb +8 -0
- data/spec/dummy/app/views/posts/_sidebar.html.erb +13 -0
- data/spec/dummy/app/views/posts/edit.html.erb +19 -0
- data/spec/dummy/app/views/posts/index.html.erb +42 -0
- data/spec/dummy/app/views/posts/new.html.erb +18 -0
- data/spec/dummy/app/views/posts/show.html.erb +19 -0
- data/spec/dummy/app/views/testing/index.html.erb +2 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +42 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +27 -0
- data/spec/dummy/config/environments/production.rb +51 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20110827160301_create_posts.rb +8 -0
- data/spec/dummy/db/schema.rb +21 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/{images → spec/dummy/public/images}/avatar.png +0 -0
- data/{images → spec/dummy/public/images}/icons/application_edit.png +0 -0
- data/{images → spec/dummy/public/images}/icons/cross.png +0 -0
- data/{images → spec/dummy/public/images}/icons/key.png +0 -0
- data/{images → spec/dummy/public/images}/icons/tick.png +0 -0
- data/{index.html → spec/dummy/public/index.html} +3 -3
- data/{javascripts → spec/dummy/public/javascripts}/jquery-1.3.min.js +0 -0
- data/{javascripts → spec/dummy/public/javascripts}/jquery.localscroll.js +0 -0
- data/{javascripts → spec/dummy/public/javascripts}/jquery.scrollTo.js +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/models/post_spec.rb +5 -0
- data/spec/dummy/test/functional/testing_controller_test.rb +9 -0
- data/spec/dummy/test/unit/helpers/testing_helper_test.rb +4 -0
- data/spec/spec_helper.rb +30 -0
- metadata +226 -71
- data/VERSION +0 -1
- data/features/step_definitions/layout_steps.rb +0 -59
- data/lib/web_app_theme.rb +0 -2
- data/stylesheets/override.css +0 -1
- data/test/spec_helper.rb +0 -5
- data/test/themed_generator_spec.rb +0 -115
- data/web-app-theme.gemspec +0 -117
data/{LICENSE → MIT-LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -8,6 +8,13 @@ it wants to be an idea to start developing a complete web application layout.
|
|
8
8
|
Installation
|
9
9
|
------------
|
10
10
|
|
11
|
+
####Rails >= 3.1.0
|
12
|
+
For this version, all the stylesheets are stored inside the gems assets path. They don't need to be copied to the to the application, unless you want to customize them (using the web_app_theme:assets generator). There only css file generated when you run the theme generator is the web_app_theme.css that includes the theme of your choice.
|
13
|
+
Add to your gemfile:
|
14
|
+
|
15
|
+
gem 'web-app-theme', '~> 3.1.0'
|
16
|
+
|
17
|
+
####Other versions
|
11
18
|
You can use web-app-theme >= 0.6.2 with Rails 3. If you want to use it with rails 2, use web-app-theme 0.5.3
|
12
19
|
Specify the web-app-theme gem in your Gemfile, only for :development and :test
|
13
20
|
|
@@ -49,6 +56,15 @@ If you need a layout for login and signup pages, you can use the `--type` option
|
|
49
56
|
|
50
57
|
rails g web_app_theme:theme sign --layout-type=sign
|
51
58
|
|
59
|
+
### Assets Generator
|
60
|
+
|
61
|
+
Used to copy a theme of your choice from the gem to your application, without parameters it will copy the 'default' theme
|
62
|
+
|
63
|
+
rails g web_app_theme:assets --theme=red
|
64
|
+
|
65
|
+
This will copy the theme files on your app/assets/stylesheets/web-app-theme path.
|
66
|
+
Also this will copy theme's images to app/assets/images/web-app-theme path
|
67
|
+
|
52
68
|
### Themed Generator
|
53
69
|
|
54
70
|
Start creating your controllers manually or with a scaffold, and then use the `themed generator` to overwrite the previously generated views.
|
@@ -156,4 +172,4 @@ Credits
|
|
156
172
|
-------
|
157
173
|
|
158
174
|
* Icons: FAMFAMFAM Silk icons <http://www.famfamfam.com/lab/icons/silk/>
|
159
|
-
* Buttons: Particletree - Rediscovering the Button Element <http://particletree.com/features/rediscovering-the-button-element/>
|
175
|
+
* Buttons: Particletree - Rediscovering the Button Element <http://particletree.com/features/rediscovering-the-button-element/>
|
data/Rakefile
CHANGED
@@ -1,25 +1,23 @@
|
|
1
|
-
|
2
|
-
# require "cucumber/rake/task"
|
3
|
-
# require "spec/rake/spectask"
|
4
|
-
#
|
5
|
-
# Cucumber::Rake::Task.new
|
6
|
-
|
7
|
-
# Spec::Rake::SpecTask.new do |t|
|
8
|
-
# t.spec_files = FileList['test/**/*_spec.rb']
|
9
|
-
# end
|
10
|
-
|
11
|
-
# task :default => [:spec, :cucumber]
|
12
|
-
|
1
|
+
#!/usr/bin/env rake
|
13
2
|
begin
|
14
|
-
require '
|
15
|
-
Jeweler::Tasks.new do |gemspec|
|
16
|
-
gemspec.name = "web-app-theme"
|
17
|
-
gemspec.summary = "Web app theme generator"
|
18
|
-
gemspec.description = "Web app theme generator for rails projects"
|
19
|
-
gemspec.email = "andrea@gravityblast.com"
|
20
|
-
gemspec.homepage = "http://github.com/pilu/web-app-theme"
|
21
|
-
gemspec.authors = ["Andrea Franz"]
|
22
|
-
end
|
3
|
+
require 'bundler/setup'
|
23
4
|
rescue LoadError
|
24
|
-
puts
|
25
|
-
end
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'TestingGem'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
Bundler::GemHelper.install_tasks
|
File without changes
|
data/{stylesheets → app/assets/images/web-app-theme}/themes/activo/images/boxbar-background.png
RENAMED
File without changes
|
File without changes
|
data/{stylesheets → app/assets/images/web-app-theme}/themes/activo/images/button-background.png
RENAMED
File without changes
|
data/{stylesheets → app/assets/images/web-app-theme}/themes/activo/images/menubar-background.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/boxbar-background.png
RENAMED
File without changes
|
File without changes
|
data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/button-background.png
RENAMED
File without changes
|
data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/messages/error.png
RENAMED
File without changes
|
data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/messages/notice.png
RENAMED
File without changes
|
data/{stylesheets → app/assets/images/web-app-theme}/themes/default/images/messages/warning.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Layout generation
|
2
|
+
In order to customize my great application layout
|
3
|
+
I should be able to copy web-app-theme default's styles to my application assets path
|
4
|
+
|
5
|
+
# script/generate theme
|
6
|
+
Scenario: Generate assets
|
7
|
+
Given I have a new rails app
|
8
|
+
When I generate assets
|
9
|
+
Then I should have a stylesheet named "web-app-theme/base.css"
|
10
|
+
And I should have a stylesheet named "web-app-theme/themes/default/style.css"
|
11
|
+
|
12
|
+
# script/generate theme
|
13
|
+
Scenario: Generate assets with --theme=red
|
14
|
+
Given I have a new rails app
|
15
|
+
And I have no stylesheets
|
16
|
+
When I generate assets choosing the "red" theme
|
17
|
+
Then I should have a stylesheet named "web-app-theme/base.css"
|
18
|
+
And I should have a stylesheet named "web-app-theme/themes/red/style.css"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Given /^I generate assets$/ do
|
2
|
+
steps %Q{
|
3
|
+
And I run `rails generate web_app_theme:assets`
|
4
|
+
}
|
5
|
+
end
|
6
|
+
|
7
|
+
Given /^I generate assets choosing the "([^\"]*)" theme$/ do |theme_name|
|
8
|
+
steps %Q{
|
9
|
+
And I run `rails generate web_app_theme:assets --theme=#{theme_name}`
|
10
|
+
}
|
11
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
Given /^I have a new rails app$/ do
|
2
|
+
random = Random.rand(20)
|
3
|
+
steps %Q{
|
4
|
+
Given I run `rails new test_app#{random}`
|
5
|
+
And I cd to "test_app#{random}"
|
6
|
+
And a file named "Gemfile" with:
|
7
|
+
"""
|
8
|
+
source 'http://rubygems.org'
|
9
|
+
gem 'rails', '3.1.0.rc6'
|
10
|
+
gem 'web-app-theme', :path => '../../../'
|
11
|
+
"""
|
12
|
+
And I run `bundle install`
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
Then /^I should have a stylesheet named "([^"]*)"$/ do |css_file_name|
|
17
|
+
steps %Q{
|
18
|
+
When I run `ls -R app/assets/stylesheets`
|
19
|
+
Then the output should contain "#{css_file_name}"
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
Then /^I should have an image named "([^"]*)"$/ do |image_name|
|
24
|
+
steps %Q{
|
25
|
+
When I run `ls -R app/assets/images`
|
26
|
+
Then the output should contain "#{image_name}"
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
Then /^I should have a view named "([^"]*)"$/ do |view_name|
|
31
|
+
steps %Q{
|
32
|
+
When I run `ls -R app/views`
|
33
|
+
Then the output should contain "#{view_name}"
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
Then /^I should have a layout named "([^"]*)"$/ do |layout_name|
|
38
|
+
steps %Q{
|
39
|
+
When I run `ls -R app/views/layouts`
|
40
|
+
Then the output should contain "#{layout_name}"
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
Given /^I have no stylesheets$/ do
|
45
|
+
steps %Q{
|
46
|
+
And I run `rm -r app/assets/stylesheets/*`
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
Given /^I have no layouts$/ do
|
51
|
+
steps %Q{
|
52
|
+
And I run `rm -r app/views/layouts/*`
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
Given /^I have a model named "([^"]*)"$/ do |model_name|
|
57
|
+
steps %Q{
|
58
|
+
Given I run `rails g model #{model_name}`
|
59
|
+
Given I run `bundle exec rake db:migrate RAILS_ENV=test`
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
Then /^The stylesheet "([^"]*)" should contain "([^"]*)"$/ do |css_file, patern|
|
64
|
+
steps %Q{
|
65
|
+
When I run `cat app/assets/stylesheets/#{css_file}`
|
66
|
+
Then the output should contain "#{patern}"
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
Then /^The layout "([^"]*)" should contain "([^"]*)"$/ do |layout_file, patern|
|
71
|
+
steps %Q{
|
72
|
+
When I run `cat app/views/layouts/#{layout_file}`
|
73
|
+
Then the output should contain "#{patern}"
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
Then /^I should not have any layouts$/ do
|
78
|
+
steps %Q{
|
79
|
+
Then the file "application.html.erb" should not exist
|
80
|
+
Then the file "application.html.haml" should not exist
|
81
|
+
}
|
82
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Given /^I generate a theme$/ do
|
2
|
+
steps %Q{
|
3
|
+
And I run `rails g web_app_theme:theme`
|
4
|
+
}
|
5
|
+
end
|
6
|
+
|
7
|
+
Given /^I generate a theme with name "(.*)"$/ do |name|
|
8
|
+
steps %Q{
|
9
|
+
And I run `rails g web_app_theme:theme #{name}`
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /^I generate a theme choosing the "(.*)" theme$/ do |theme_name|
|
14
|
+
steps %Q{
|
15
|
+
And I run `rails g web_app_theme:theme --theme=#{theme_name}`
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
Given /^I generate a theme without layout choosing the "(.*)" theme$/ do |theme_name|
|
20
|
+
steps %Q{
|
21
|
+
And I run `rails g web_app_theme:theme --theme=#{theme_name} --no_layout`
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
Given /^I generate a theme with application name "(.*)"$/ do |app_name|
|
26
|
+
steps %Q{
|
27
|
+
And I run `rails g web_app_theme:theme --app_name=#{app_name}`
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
Given /^I generate a theme for signin and signup$/ do
|
32
|
+
steps %Q{
|
33
|
+
And I run `rails g web_app_theme:theme --layout_type=sign`
|
34
|
+
}
|
35
|
+
end
|
@@ -1,19 +1,17 @@
|
|
1
|
-
Given /^
|
2
|
-
|
1
|
+
Given /^I run the themed generator for the "([^\"]*)" controller$/ do |controller_name|
|
2
|
+
steps %Q{
|
3
|
+
And I run `rails g web_app_theme:themed #{controller_name}`
|
4
|
+
}
|
3
5
|
end
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
When /I run the themed generator for the "([^\"]*)" controller with the model "([^\"]*)"/ do |controller_name, model_name|
|
8
|
+
steps %Q{
|
9
|
+
And I run `rails g web_app_theme:themed #{controller_name} #{model_name}`
|
10
|
+
}
|
7
11
|
end
|
8
12
|
|
9
|
-
|
10
|
-
|
13
|
+
Given /^I run the themed generator for the "([^\"]*)" controller with the option --"([^\"]*)"="([^\"]*)"$/ do |controller_name, option, value|
|
14
|
+
steps %Q{
|
15
|
+
And I run `rails g web_app_theme:themed #{controller_name} --#{option}=#{value}`
|
16
|
+
}
|
11
17
|
end
|
12
|
-
|
13
|
-
When /^I generate text views for "([^\"]*)"/ do |controller_path|
|
14
|
-
generate_views(controller_path, :themed_type => :text)
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^I should have a view named "([^\"]*)"$/ do |view_path|
|
18
|
-
view_exists?(view_path).should be_true
|
19
|
-
end
|
data/features/support/env.rb
CHANGED
@@ -1,86 +1,13 @@
|
|
1
|
-
|
2
|
-
require "
|
3
|
-
|
4
|
-
require 'rails_generator/scripts/generate'
|
5
|
-
require "fileutils"
|
6
|
-
require "theme/theme_generator"
|
1
|
+
ENV["RAILS_ENV"] ||= "test"
|
2
|
+
require File.expand_path("../../../spec/dummy/config/environment.rb", __FILE__)
|
3
|
+
ENV["RAILS_ROOT"] ||= File.dirname(__FILE__) + "../../../spec/dummy"
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
tmp_rails_app_root = File.join(web_app_theme_root, tmp_rails_app_name)
|
5
|
+
require 'cucumber/rails'
|
6
|
+
require 'aruba/cucumber'
|
11
7
|
|
12
|
-
Rails::Generator::Base.append_sources(Rails::Generator::PathSource.new(:plugin, "#{web_app_theme_root}/rails_generators/"))
|
13
|
-
|
14
|
-
module GeneratorHelpers
|
15
|
-
def generate_rails_app
|
16
|
-
FileUtils.mkdir(File.join(@app_root))
|
17
|
-
end
|
18
|
-
|
19
|
-
def remove_layouts
|
20
|
-
FileUtils.rm_rf(File.join(@app_root, "app", "views", "layouts"))
|
21
|
-
end
|
22
|
-
|
23
|
-
def remove_stylesheets
|
24
|
-
FileUtils.rm_rf(File.join(@app_root, "public", "stylesheets"))
|
25
|
-
end
|
26
|
-
|
27
|
-
def generate(*args)
|
28
|
-
options = !args.empty? && args.last.is_a?(Hash) ? args.pop : {}
|
29
|
-
options.merge!({:destination => @app_root, :quiet => true})
|
30
|
-
Rails::Generator::Scripts::Generate.new.run(args, options)
|
31
|
-
end
|
32
|
-
|
33
|
-
def generate_layout(*args)
|
34
|
-
generate(:theme, *args)
|
35
|
-
end
|
36
|
-
|
37
|
-
def generate_views(*args)
|
38
|
-
generate(:themed, *args)
|
39
|
-
end
|
40
|
-
|
41
|
-
def generate_model(model_name)
|
42
|
-
Object.const_get(model_name)
|
43
|
-
rescue NameError
|
44
|
-
Object.const_set(model_name, Class.new)
|
45
|
-
klass = Object.const_get(model_name)
|
46
|
-
def klass.columns; []; end
|
47
|
-
end
|
48
|
-
|
49
|
-
def layouts_count
|
50
|
-
Dir[File.join(@app_root, "app", "views", "layouts", "**", "*.erb")].size
|
51
|
-
end
|
52
|
-
|
53
|
-
def layout_exists?(filename)
|
54
|
-
File.exists?(File.join(@app_root, "app", "views", "layouts", filename))
|
55
|
-
end
|
56
|
-
|
57
|
-
def view_exists?(view_path)
|
58
|
-
File.exists?(File.join(@app_root, "app", "views", view_path))
|
59
|
-
end
|
60
|
-
|
61
|
-
def image_exists?(image_path)
|
62
|
-
File.exists?(File.join(@app_root, "public", "images", image_path))
|
63
|
-
end
|
64
|
-
|
65
|
-
def stylesheet_exists?(relative_path)
|
66
|
-
File.exists?(File.join(@app_root, "public", "stylesheets", relative_path)).should be_true
|
67
|
-
end
|
68
|
-
|
69
|
-
def layout_title(layout)
|
70
|
-
File.open(File.join(@app_root, "app", "views", "layouts", layout), "r").read.match(/<title>([^<]*)<\/title>/)[1]
|
71
|
-
end
|
72
|
-
|
73
|
-
def layout_with_box?(layout)
|
74
|
-
File.open(File.join(@app_root, "app", "views", "layouts", layout), "r").read =~ %r|<div id="box">|
|
75
|
-
end
|
76
|
-
end
|
77
8
|
|
78
9
|
Before do
|
79
|
-
@
|
80
|
-
end
|
81
|
-
|
82
|
-
After do
|
83
|
-
FileUtils.rm_rf(tmp_rails_app_root)
|
10
|
+
@aruba_timeout_seconds = 60
|
84
11
|
end
|
85
12
|
|
86
|
-
|
13
|
+
#require File.expand_path("../../step_definitions/common_steps", __FILE__)
|