Skip to content
Browse files

work in progress

  • Loading branch information...
1 parent 128ea59 commit 75447a9d591bb38120bd238a0dcc511f86907c64 @taasaa committed Apr 10, 2009
Showing with 120 additions and 85 deletions.
  1. +8 −0 app_lego.rb
  2. +0 −10 basic.rb
  3. +6 −0 compass.rb
  4. +15 −0 frozen_edge.rb
  5. +1 −3 haml.rb
  6. +8 −0 hoptoad.rb
  7. +3 −0 jrails.rb
  8. +58 −0 layout.rb
  9. +9 −0 locale.rb
  10. +5 −72 misc.rb
  11. +7 −0 rspec.rb
View
8 app_lego.rb
@@ -1,7 +1,10 @@
+NAME=File.basename(root)
+
# environment options
@lego_options = ENV['LEGOS'] ? ENV['LEGOS'].downcase.split(/[,\s]+/) : false
@used_legos = []
+
def use_lego?(lego, question)
use = if @lego_options
@lego_options.include?(lego)
@@ -33,12 +36,17 @@ def plugin(name, options)
modules = [
["basic", "Do basic setup? (only exclude this if you already have a Rails app skeleton with Rails 2.3+ frozen, or as a gem)"],
+ ["frozen_edge", "Freeze edge Rails?"],
["rspec", "Use RSpec instead of test/unit?"],
["haml", "Use haml for views and sass for css?"],
+ ["hoptoad", "Use Hoptoad error notifier?"],
+ ["compass", "Use compass for CSS?"],
["jquery", "Use jQuery instead of Prototype + Script.aculo.us?"],
+ ["jrails", "install jquery for rails plugin?"],
["auth", "Add authentication module?"],
["couchdb", "Use CouchDB?"],
["locale", "Add specific localizations?"],
+ ["layout", "Add basic layout?"],
["misc", "Add miscellaneous stuff (helpers, basic layout, flashes, initializers)?"],
]
View
10 basic.rb
@@ -36,14 +36,4 @@
git :add => "."
git :commit => "-a -m 'Setting up a new rails app. Copy config/database.yml.sample to config/database.yml and customize.'"
-# freeze edge rails
-if respond_to?(:braid)
- braid "git://github.com/rails/rails.git", "vendor/rails"
-else
- # Guess full Rails path
- rails_path = Pathname.new($LOAD_PATH.find {|p| p =~ /railties/}.gsub(%r{/railties/.*}, '')).realpath
- run "cp -r '#{rails_path}' vendor/rails"
- run "rm -rf vendor/rails/.git"
-end
-
log "initialized", "application structure"
View
6 compass.rb
@@ -0,0 +1,6 @@
+gem 'chriseppstein-compass', :lib => 'compass', :version => '>= 0.3.4'
+
+run "echo -e 'y\nn\n' | compass --rails -f blueprint"
+
+git :add => "."
+git :commit => "-a -m 'Added compass for css'"
View
15 frozen_edge.rb
@@ -0,0 +1,15 @@
+# freeze edge rails
+if respond_to?(:braid)
+ braid "git://github.com/rails/rails.git", "vendor/rails"
+else
+ # Guess full Rails path
+ rails_path = Pathname.new($LOAD_PATH.find {|p| p =~ /railties/}.gsub(%r{/railties/.*}, '')).realpath
+ run "cp -r '#{rails_path}' vendor/rails"
+ run "rm -rf vendor/rails/.git"
+end
+
+# commit changes
+git :add => "."
+git :commit => "-a -m 'frozen edge rails'"
+
+log "rails", "edge frozen"
View
4 haml.rb
@@ -1,8 +1,6 @@
gem 'haml', :version => '>= 2.1'
-gem 'chriseppstein-compass', :lib => 'compass', :version => '>= 0.3.4'
run "haml --rails ."
-run "echo -e 'y\nn\n' | compass --rails -f blueprint"
git :add => "."
-git :commit => "-a -m 'Added haml for views and compass for css'"
+git :commit => "-a -m 'Added haml for views'"
View
8 hoptoad.rb
@@ -0,0 +1,8 @@
+plugin 'hoptoad_notifier', :git => "git://github.com/thoughtbot/hoptoad_notifier"
+
+hoptoad_key = ask("\nPlease enter your Hoptoad API key: ")
+initializer "hoptoad.rb", <<-HOPTOAD
+HoptoadNotifier.configure do |config|
+ config.api_key = '#{hoptoad_key}'
+end
+HOPTOAD
View
3 jrails.rb
@@ -0,0 +1,3 @@
+plugin "jrails", :git => "git://github.com/aaronchi/jrails"
+plugin "jrails_in_place_editing", :git => "git://github.com/rakuto/jrails_in_place_editing"
+
View
58 layout.rb
@@ -0,0 +1,58 @@
+if File.exists?('vendor/plugins/haml')
+
+ file 'app/views/layouts/_flashes.html.haml', <<-HAML
+#flash
+ - flash.each do |key, value|
+ %div{:id => "flash_\#{key}"}= value
+ HAML
+
+ file 'app/views/layouts/application.html.haml', <<-HAML
+!!! XML
+!!! Strict
+%html{'xmlns' => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', 'lang' => 'en'}
+ %head
+ %meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}
+ %title= "\#{page_title + ' - ' unless page_title.blank?}\#{t(:app_name)}"
+ = stylesheet_link_tag 'screen.css', :media => 'screen, projection'
+ = stylesheet_link_tag 'print.css', :media => 'print'
+ /[if IE]
+ = stylesheet_link_tag 'ie.css', :media => 'screen, projection'
+ %body{:class => body_class}
+ = render :partial => 'layouts/flashes'
+ = yield
+ HAML
+
+else
+
+ file 'app/views/layouts/_flashes.html.erb', <<-ERB
+<div id="flash">
+ <% flash.each do |key, value| -%>
+ <div id="flash_<%= key %>"><%=h value %></div>
+ <% end -%>
+</div>
+ ERB
+
+ file 'app/views/layouts/application.html.erb', <<-ERB
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+ <title><%= page_title + ' - ' unless page_title.blank? %><%=t :app_name %></title>
+ <%= stylesheet_link_tag 'screen.css', :media => 'screen, projection' %>
+ <%= stylesheet_link_tag 'print.css', :media => 'print' %>
+ <!--[if IE]>
+ <%= stylesheet_link_tag 'ie.css', :media => 'screen, projection' %>
+ <![endif]-->
+ </head>
+ <body class="<%= body_class %>">
+ <%= render :partial => 'layouts/flashes' -%>
+ <%= yield %>
+ </body>
+</html>
+ ERB
+
+end
+
+
View
9 locale.rb
@@ -31,5 +31,14 @@ def uri_exists?(uri)
/(#\s*)?config.i18n.default_locale.*$/,
"config.i18n.default_locale = '#{locales.first.gsub(/\.(yml|rb)$/, '')}'"
+Dir['config/locales/*.*'].map {|f| File.basename(f).split(".").first}.uniq.each do |locale|
+ file "config/locales/#{locale}.app.yml", <<-YAML
+#{locale}:
+ app_name: "#{NAME}"
+ YAML
+end
+
+git :rm => 'config/locales/en.yml'
+
git :add => "."
git :commit => "-a -m 'Added #{locales.join(",")} localizations'"
View
77 misc.rb
@@ -1,15 +1,16 @@
# app files
-file 'app/controllers/application_controller.rb',
-%q{class ApplicationController < ActionController::Base
+file 'app/controllers/application_controller.rb', <<-APP
+class ApplicationController < ActionController::Base
helper :all
protect_from_forgery
filter_parameter_logging "password" unless Rails.env.development?
+ #{"include HoptoadNotifier::Catcher" if File.exists?('vendor/plugins/hoptoad_notifier')}
end
-}
+APP
file 'app/helpers/application_helper.rb',
%q{module ApplicationHelper
@@ -27,74 +28,6 @@ def body_class
end
}
-
-Dir['config/locales/*.*'].map {|f| File.basename(f).split(".").first}.uniq.each do |locale|
- file "config/locales/#{locale}.app.yml", <<-YAML
-#{locale}:
- app_name: "APP_NAME"
- YAML
-end
-
-git :rm => 'config/locales/en.yml'
-
-if File.exists?('vendor/plugins/haml')
-
- file 'app/views/layouts/_flashes.html.haml', <<-HAML
-#flash
- - flash.each do |key, value|
- %div{:id => "flash_\#{key}"}= value
- HAML
-
- file 'app/views/layouts/application.html.haml', <<-HAML
-!!! XML
-!!! Strict
-%html{'xmlns' => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', 'lang' => 'en'}
- %head
- %meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}
- %title= "\#{page_title + ' - ' unless page_title.blank?}\#{t(:app_name)}"
- = stylesheet_link_tag 'screen.css', :media => 'screen, projection'
- = stylesheet_link_tag 'print.css', :media => 'print'
- /[if IE]
- = stylesheet_link_tag 'ie.css', :media => 'screen, projection'
- %body{:class => body_class}
- = render :partial => 'layouts/flashes'
- = yield
- HAML
-
-else
-
- file 'app/views/layouts/_flashes.html.erb', <<-ERB
-<div id="flash">
- <% flash.each do |key, value| -%>
- <div id="flash_<%= key %>"><%=h value %></div>
- <% end -%>
-</div>
- ERB
-
- file 'app/views/layouts/application.html.erb', <<-ERB
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <title><%= page_title + ' - ' unless page_title.blank? %><%=t :app_name %></title>
- <%= stylesheet_link_tag 'screen.css', :media => 'screen, projection' %>
- <%= stylesheet_link_tag 'print.css', :media => 'print' %>
- <!--[if IE]>
- <%= stylesheet_link_tag 'ie.css', :media => 'screen, projection' %>
- <![endif]-->
- </head>
- <body class="<%= body_class %>">
- <%= render :partial => 'layouts/flashes' -%>
- <%= yield %>
- </body>
-</html>
- ERB
-
-end
-
-
# initializers
initializer 'requires.rb',
@@ -104,4 +37,4 @@ def body_class
}
git :add => "."
-git :commit => "-a -m 'Added basic ApplicationController, helpers, layout, flashes, app localizations, initializers'"
+git :commit => "-a -m 'Added basic ApplicationController, helpers, initializers'"
View
7 rspec.rb
@@ -8,5 +8,12 @@
# remove test dir
git :rm => '-r test'
+file "spec/spec.opts", <<-OPTS
+--colour
+--format specdoc
+--loadby mtime
+--reverse
+OPTS
+
git :add => "."
git :commit => "-a -m 'Added RSpec for testing'"

0 comments on commit 75447a9

Please sign in to comment.
Something went wrong with that request. Please try again.