rails_apps_composer 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/recipes/boilerplate.rb +141 -0
- data/recipes/cucumber.rb +2 -2
- data/recipes/devise_navigation.rb +25 -4
- data/version.rb +1 -1
- metadata +5 -4
@@ -0,0 +1,141 @@
|
|
1
|
+
# Application template recipe for the rails_apps_composer. Check for a newer version here:
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/boilerplate.rb
|
3
|
+
|
4
|
+
if config['boilerplate']
|
5
|
+
if recipes.include? 'rails 3.1'
|
6
|
+
after_bundler do
|
7
|
+
say_wizard "Boilerplate recipe running 'after bundler'"
|
8
|
+
# Download HTML5 Boilerplate JavaScripts
|
9
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/js/libs/modernizr-2.0.min.js", "app/assets/javascripts/modernizr.js"
|
10
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/js/libs/respond.min.js", "app/assets/javascripts/respond.js"
|
11
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/js/plugins.js", "app/assets/javascripts/plugins.js"
|
12
|
+
# Download HTML5 Boilerplate Stylesheet
|
13
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/css/style.css", "app/assets/stylesheets/boilerplate.scss"
|
14
|
+
# Download HTML5 Boilerplate Site Root Assets
|
15
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-114x114-precomposed.png", "app/assets/images/apple-touch-icon-114x114-precomposed.png"
|
16
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-57x57-precomposed.png", "app/assets/images/apple-touch-icon-57x57-precomposed.png"
|
17
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-72x72-precomposed.png", "app/assets/images/apple-touch-icon-72x72-precomposed.png"
|
18
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-precomposed.png", "app/assets/images/apple-touch-icon-precomposed.png"
|
19
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon.png", "app/assets/images/apple-touch-icon.png"
|
20
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/crossdomain.xml", "public/crossdomain.xml"
|
21
|
+
get "https://raw.github.com/paulirish/html5-boilerplate/master/humans.txt", "public/humans.txt"
|
22
|
+
# Set up the default application layout
|
23
|
+
if recipes.include? 'haml'
|
24
|
+
# Haml version of default application layout
|
25
|
+
# create some Haml helpers
|
26
|
+
inject_into_class 'app/helpers/application_helper.rb', ApplicationHelper do <<-RUBY
|
27
|
+
# Create a named haml tag to wrap IE conditional around a block
|
28
|
+
# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
|
29
|
+
def ie_tag(name=:body, attrs={}, &block)
|
30
|
+
attrs.symbolize_keys!
|
31
|
+
haml_concat("<!--[if lt IE 7]> #{ tag(name, add_class('ie6', attrs), true) } <![endif]-->".html_safe)
|
32
|
+
haml_concat("<!--[if IE 7]> #{ tag(name, add_class('ie7', attrs), true) } <![endif]-->".html_safe)
|
33
|
+
haml_concat("<!--[if IE 8]> #{ tag(name, add_class('ie8', attrs), true) } <![endif]-->".html_safe)
|
34
|
+
haml_concat("<!--[if gt IE 8]><!-->".html_safe)
|
35
|
+
haml_tag name, attrs do
|
36
|
+
haml_concat("<!--<![endif]-->".html_safe)
|
37
|
+
block.call
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def ie_html(attrs={}, &block)
|
42
|
+
ie_tag(:html, attrs, &block)
|
43
|
+
end
|
44
|
+
|
45
|
+
def ie_body(attrs={}, &block)
|
46
|
+
ie_tag(:body, attrs, &block)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def add_class(name, attrs)
|
52
|
+
classes = attrs[:class] || ''
|
53
|
+
classes.strip!
|
54
|
+
classes = ' ' + classes if !classes.blank?
|
55
|
+
classes = name + classes
|
56
|
+
attrs.merge(:class => classes)
|
57
|
+
end
|
58
|
+
RUBY
|
59
|
+
end
|
60
|
+
remove_file 'app/views/layouts/application.html.erb'
|
61
|
+
remove_file 'app/views/layouts/application.html.haml'
|
62
|
+
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
|
63
|
+
create_file 'app/views/layouts/application.html.haml' do <<-HAML
|
64
|
+
- ie_html :lang => 'en', :class => 'no-js' do
|
65
|
+
%head
|
66
|
+
%title #{app_name}
|
67
|
+
= stylesheet_link_tag :application
|
68
|
+
= javascript_include_tag :application
|
69
|
+
= csrf_meta_tags
|
70
|
+
%body
|
71
|
+
#container
|
72
|
+
%header
|
73
|
+
- flash.each do |name, msg|
|
74
|
+
= content_tag :div, msg, :id => "flash_\#{name}" if msg.is_a?(String)
|
75
|
+
#main{:role => "main"}
|
76
|
+
= yield
|
77
|
+
%footer
|
78
|
+
HAML
|
79
|
+
end
|
80
|
+
else
|
81
|
+
# ERB version of default application layout
|
82
|
+
remove_file 'app/views/layouts/application.html.erb'
|
83
|
+
remove_file 'app/views/layouts/application.html.haml'
|
84
|
+
create_file 'app/views/layouts/application.html.erb' do <<-ERB
|
85
|
+
<!doctype html>
|
86
|
+
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
|
87
|
+
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
|
88
|
+
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
|
89
|
+
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
90
|
+
<head>
|
91
|
+
<meta charset="utf-8">
|
92
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
93
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
94
|
+
<title>#{app_name}</title>
|
95
|
+
<meta name="description" content="">
|
96
|
+
<meta name="author" content="">
|
97
|
+
</head>
|
98
|
+
<body>
|
99
|
+
<div id="container">
|
100
|
+
<header>
|
101
|
+
</header>
|
102
|
+
<div id="main" role="main">
|
103
|
+
</div>
|
104
|
+
<footer>
|
105
|
+
</footer>
|
106
|
+
</div> <!--! end of #container -->
|
107
|
+
</body>
|
108
|
+
</html>
|
109
|
+
ERB
|
110
|
+
inject_into_file 'app/views/layouts/application.html.erb', :after => "<header>\n" do
|
111
|
+
<<-ERB
|
112
|
+
<%- flash.each do |name, msg| -%>
|
113
|
+
<%= content_tag :div, msg, :id => "flash_\#{name}" if msg.is_a?(String) %>
|
114
|
+
<%- end -%>
|
115
|
+
ERB
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
elsif recipes.include? 'rails 3.0'
|
120
|
+
say_wizard "Not supported for Rails version #{Rails::VERSION::STRING}. Boilerplate recipe skipped."
|
121
|
+
else
|
122
|
+
say_wizard "Don't know what to do for Rails version #{Rails::VERSION::STRING}. Boilerplate recipe skipped."
|
123
|
+
end
|
124
|
+
else
|
125
|
+
recipes.delete('boilerplate')
|
126
|
+
end
|
127
|
+
|
128
|
+
__END__
|
129
|
+
|
130
|
+
name: boilerplate
|
131
|
+
description: "Install HTML5 Boilerplate."
|
132
|
+
author: RailsApps
|
133
|
+
|
134
|
+
category: other
|
135
|
+
tags: [utilities, configuration]
|
136
|
+
|
137
|
+
config:
|
138
|
+
- boilerplate:
|
139
|
+
type: boolean
|
140
|
+
prompt: Would you like to install HTML5 Boilerplate?
|
141
|
+
|
data/recipes/cucumber.rb
CHANGED
@@ -5,13 +5,13 @@ if config['cucumber']
|
|
5
5
|
if recipes.include? 'rails 3.0'
|
6
6
|
# for Rails 3.0, use only gem versions we know that work
|
7
7
|
gem 'cucumber-rails', '0.5.1', :group => :test
|
8
|
-
gem 'capybara', '1.0.0
|
8
|
+
gem 'capybara', '1.0.0', :group => :test
|
9
9
|
gem 'database_cleaner', '0.6.7', :group => :test
|
10
10
|
gem 'launchy', '0.4.0', :group => :test
|
11
11
|
else
|
12
12
|
# for Rails 3.1+, use optimistic versioning for gems
|
13
13
|
gem 'cucumber-rails', '>= 0.5.2', :group => :test
|
14
|
-
gem 'capybara', '>= 1.0.0
|
14
|
+
gem 'capybara', '>= 1.0.0', :group => :test
|
15
15
|
gem 'database_cleaner', '>= 0.6.7', :group => :test
|
16
16
|
gem 'launchy', '>= 0.4.0', :group => :test
|
17
17
|
end
|
@@ -61,22 +61,43 @@ ERB
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# Add navigation links to the default application layout
|
64
|
-
if recipes.include? '
|
65
|
-
|
66
|
-
|
64
|
+
if recipes.include? 'boilerplate'
|
65
|
+
if recipes.include? 'haml'
|
66
|
+
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
|
67
|
+
inject_into_file 'app/views/layouts/application.html.haml', :after => "%body\n" do <<-HAML
|
67
68
|
%ul.hmenu
|
68
69
|
= render 'devise/menu/registration_items'
|
69
70
|
= render 'devise/menu/login_items'
|
70
71
|
HAML
|
72
|
+
end
|
73
|
+
else
|
74
|
+
inject_into_file 'app/views/layouts/application.html.erb', :after => "<body>\n" do
|
75
|
+
<<-ERB
|
76
|
+
<ul class="hmenu">
|
77
|
+
<%= render 'devise/menu/registration_items' %>
|
78
|
+
<%= render 'devise/menu/login_items' %>
|
79
|
+
</ul>
|
80
|
+
ERB
|
81
|
+
end
|
71
82
|
end
|
72
83
|
else
|
73
|
-
|
84
|
+
if recipes.include? 'haml'
|
85
|
+
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
|
86
|
+
inject_into_file 'app/views/layouts/application.html.haml', :after => "%header\n" do <<-HAML
|
87
|
+
%ul.hmenu
|
88
|
+
= render 'devise/menu/registration_items'
|
89
|
+
= render 'devise/menu/login_items'
|
90
|
+
HAML
|
91
|
+
end
|
92
|
+
else
|
93
|
+
inject_into_file 'app/views/layouts/application.html.erb', :after => "<header>\n" do
|
74
94
|
<<-ERB
|
75
95
|
<ul class="hmenu">
|
76
96
|
<%= render 'devise/menu/registration_items' %>
|
77
97
|
<%= render 'devise/menu/login_items' %>
|
78
98
|
</ul>
|
79
99
|
ERB
|
100
|
+
end
|
80
101
|
end
|
81
102
|
end
|
82
103
|
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rails_apps_composer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Daniel Kehoe
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-18 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: i18n
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- recipes/add_user_name.rb
|
112
112
|
- recipes/application_layout.rb
|
113
113
|
- recipes/ban_spiders.rb
|
114
|
+
- recipes/boilerplate.rb
|
114
115
|
- recipes/capybara.rb
|
115
116
|
- recipes/cleanup.rb
|
116
117
|
- recipes/css_setup.rb
|
@@ -175,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
176
|
requirements:
|
176
177
|
- - ">="
|
177
178
|
- !ruby/object:Gem::Version
|
178
|
-
hash:
|
179
|
+
hash: 3173488338098663201
|
179
180
|
segments:
|
180
181
|
- 0
|
181
182
|
version: "0"
|
@@ -184,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
185
|
requirements:
|
185
186
|
- - ">="
|
186
187
|
- !ruby/object:Gem::Version
|
187
|
-
hash:
|
188
|
+
hash: 3173488338098663201
|
188
189
|
segments:
|
189
190
|
- 0
|
190
191
|
version: "0"
|