bullrico (owner)

Fork Of

gist: 33337 by peterc Fully featured Rails templa...

Revisions

gist: 51326 Download_button fork
public
Description:
Rails template
Public Clone URL: git://gist.github.com/51326.git
Ruby
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Rails template - first pass
# Culled stuff from Peter Cooper, Jeremy McAnally
 
# Run it like this
# ruby ~/rails/dev/edge_rails/vendor/rails/railties/bin/rails my_new_app -m http://gist.github.com/51326.txt
 
# Link to local copy of edge rails
inside('vendor') { run 'ln -s /Users/bobby/rails/dev/edge_rails/vendor/rails rails' }
 
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "rm -f public/javascripts/*"
 
# Set up git repository
git :init
git :add => '.'
puts "git add done"
 
# Download JQuery
git :rm => "public/javascripts/*"
# run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js > public/javascripts/jquery.js"
# run "curl -L http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js > public/javascripts/jquery.form.js"
 
 
file 'public/javascripts/jquery.js', open('http://ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.min.js').read
file 'public/javascripts/jquery.full.js', open('http://ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.js').read
file 'public/javascripts/jquery-ui.js', open('http://ajax.googleapis.com/ajax/libs/jqueryui/1.5/jquery-ui.min.js').read
file 'public/javascripts/jquery-ui.full.js', open('http://ajax.googleapis.com/ajax/libs/jqueryui/1.5/jquery-ui.js').read
file 'public/javascripts/jquery.form.js', open('http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js').read
  
# Copy database.yml for distribution use
run "cp config/database.yml config/database.yml.example"
  
# Set up .gitignore files
run "touch tmp/.gitignore log/.gitignore vendor/.gitignore"
run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore}
file '.gitignore', <<-END
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
END
 
# Install submoduled plugins
plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git', :submodule => true
plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git', :submodule => true
plugin 'asset_packager', :git => 'git://github.com/sbecker/asset_packager.git', :submodule => true
plugin 'open_id_authentication', :git => 'git://github.com/rails/open_id_authentication.git', :submodule => true
plugin 'role_requirement', :git => 'git://github.com/timcharper/role_requirement.git', :submodule => true
plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :submodule => true
plugin 'acts_as_taggable_redux', :git => 'git://github.com/monki/acts_as_taggable_redux.git', :submodule => true
 
# Install all gems
gem 'thoughtbot-factory_girl', :lib => 'factory_girl', :source => 'http://gems.github.com'
gem 'ruby-openid', :lib => 'openid'
gem 'sqlite3-ruby', :lib => 'sqlite3'
gem 'hpricot', :source => 'http://code.whytheluckystiff.net'
gem 'RedCloth', :lib => 'redcloth'
gem 'haml', :version => '>= 2.1'
gem 'chriseppstein-compass', :lib => 'compass', :version => '>= 0.3.4'
gem 'rubyist-aasm'
gem 'mislav-will_paginate', :version => '~> 2.2.3', :lib => 'will_paginate', :source => 'http://gems.github.com'
 
rake('gems:install', :sudo => true)
 
# Set up sessions, RSpec, user model, OpenID, etc, and run migrations
rake('db:sessions:create')
generate("authenticated", "user session")
generate("roles", "Role User")
generate("rspec")
rake('acts_as_taggable:db:create')
rake('open_id_authentication:db:create')
rake('db:migrate')
 
run "haml --rails ."
run "echo -e 'y\nn\n' | compass --rails -f blueprint"
  
# Set up session store initializer
initializer 'session_store.rb', <<-END
ActionController::Base.session = { :session_key => '_#{(1..6).map { |x| (65 + rand(26)).chr }.join}_session', :secret => '#{(1..40).map { |x| (65 + rand(26)).chr }.join}' }
ActionController::Base.session_store = :active_record_store
END
 
# Initialize submodules
git :submodule => "init"
 
# Commit all work so far to the repository
git :add => '.'
git :commit => "-a -m 'Initial commit'"
 
# Success!
puts "SUCCESS!"