forked from leshill/rails3-app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.rb
71 lines (53 loc) · 1.69 KB
/
app.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
rvmrc = <<-RVMRC
rvm_gemset_create_on_use_flag=1
rvm gemset use #{app_name}
RVMRC
create_file ".rvmrc", rvmrc
empty_directory "lib/generators"
git :clone => "--depth 0 http://github.com/leshill/rails3-app.git lib/generators"
remove_dir "lib/generators/.git"
gem "haml", ">= 3.0.0.rc.4"
gem "rspec-rails", ">= 2.0.0.beta.8", :group => :test
gem "factory_girl", ">= 1.2.4", :group => :test
generators = <<-GENERATORS
config.generators do |g|
g.template_engine :haml
g.test_framework :rspec, :fixture => true, :views => false
g.fixture_replacement :factory_girl, :dir => "spec/factories"
end
GENERATORS
application generators
get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "public/javascripts/jquery.js"
get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js", "public/javascripts/jquery-ui.js"
get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
jquery = <<-JQUERY
ActionView::Helpers::AssetTagHelper.register_javascript_expansion \
:jquery => %w(jquery jquery-ui rails)
JQUERY
initializer "jquery.rb", jquery
layout = <<-LAYOUT
!!!
%html
%head
%title #{app_name.humanize}
= stylesheet_link_tag :all
= javascript_include_tag :jquery
= csrf_meta_tag
%body
= yield
LAYOUT
remove_file "app/views/layouts/application.html.erb"
create_file "app/views/layouts/application.html.haml", layout
create_file "log/.gitkeep"
create_file "tmp/.gitkeep"
git :init
git :add => "."
docs = <<-DOCS
Run the following commands to complete the setup of #{app_name.humanize}:
% cd #{app_name}
% gem install bundler
% bundle install
% bundle lock
% script/rails generate rspec:install
DOCS
log docs