forked from russfrisch/h5bp-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
h5bp_apply.rb
75 lines (64 loc) · 3.45 KB
/
h5bp_apply.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# See README for additional information.
# Written by: Russ Frisch
# http://github.com/russfrisch/h5bp-rails
# Download HTML5 Boilerplate plugins.js (converted to CoffeeScript)
get "https://github.com/russfrisch/h5bp-rails/raw/master/assets/plugins.js.coffee", "app/assets/javascripts/plugins.js.coffee"
# Download and merge HTML5 Boilerplate stylesheet with application.css
get "https://github.com/paulirish/html5-boilerplate/raw/master/css/style.css", "app/assets/stylesheets/application.css.new"
prepend_to_file 'app/assets/stylesheets/application.css.new' do
" /*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*/
"
end
gsub_file 'app/assets/stylesheets/application.css', /==\|==/, '==|==.'
# Download HTML5 Boilerplate site root assets
get "https://github.com/russfrisch/html5-boilerplate/raw/master/apple-touch-icon-114x114-precomposed.png", "public/apple-touch-icon-114x114-precomposed.png"
get "https://github.com/russfrisch/html5-boilerplate/raw/master/apple-touch-icon-57x57-precomposed.png", "public/apple-touch-icon-57x57-precomposed.png"
get "https://github.com/russfrisch/html5-boilerplate/raw/master/apple-touch-icon-72x72-precomposed.png", "public/apple-touch-icon-72x72-precomposed.png"
get "https://github.com/russfrisch/html5-boilerplate/raw/master/apple-touch-icon-precomposed.png", "public/apple-touch-icon-precomposed.png"
get "https://github.com/russfrisch/html5-boilerplate/raw/master/apple-touch-icon.png", "public/apple-touch-icon.png"
get "https://github.com/russfrisch/html5-boilerplate/raw/master/crossdomain.xml", "public/crossdomain.xml"
get "https://github.com/russfrisch/html5-boilerplate/raw/master/humans.txt", "public/humans.txt"
get "https://github.com/russfrisch/html5-boilerplate/raw/master/.htaccess", "public/.htaccess"
# Update application.html.erb with HTML5 Boilerplate index.html content
get "https://github.com/russfrisch/html5-boilerplate/raw/master/index.html", "app/views/layouts/application.html.erb.new"
gsub_file 'app/views/layouts/application.html.erb.new', /<link rel="stylesheet" href="css\/style.css">/ do
"<%= stylesheet_link_tag \"application\" %>"
end
gsub_file 'app/views/layouts/application.html.erb.new', /<script.*<\/head>/mi do
"<%= javascript_include_tag \"modernizr\" %>
</head>"
end
gsub_file 'app/views/layouts/application.html.erb.new', /<meta charset="utf-8">/ do
"<meta charset=\"utf-8\">
<%= csrf_meta_tag %>"
end
gsub_file 'app/views/layouts/application.html.erb.new', /<div id="container">[\s\S]*<\/div>/, '<%= yield %>'
gsub_file 'app/views/layouts/application.html.erb.new', /<!-- JavaScript[\s\S]*!-- end scripts-->/, '<%= javascript_include_tag "application" %>'
# Add Modernizr-Rails dependency to get Modernizr.js support,
# optional blueprint-rails, coffeebeans, and Heroku dependencies.
gsub_file 'Gemfile', /gem 'jquery-rails'/ do
"# JavasScript libs
gem 'jquery-rails'
gem 'modernizr-rails'
# Stylesheet libs
# gem 'blueprint-rails'
# Ajax request CoffeeScript support
# gem 'coffeebeans'
# Heroku deployment requirements
# group :production do
# gem 'therubyracer-heroku'
# gem 'pg'
# end
"
end
puts <<EOF
merge these files manually
app/assets/stylesheets/application.css.new
app/views/layouts/application.html.erb.new
EOF