Skip to content

Commit

Permalink
- fix git repo prompts
Browse files Browse the repository at this point in the history
- add stuff for SCSS (initializer and gitignore)
- add reset.scss for HAML
- rework RVM requirement and loading
- overall refactoring
  • Loading branch information
Tanel Suurhans committed Dec 10, 2010
1 parent 5c123d2 commit 7da17b0
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 11 deletions.
1 change: 0 additions & 1 deletion README.markdown
Expand Up @@ -8,7 +8,6 @@ These templates are knowingly a bit opinionated, but feel free to leave feedback
- [RVM] (http://rvm.beginrescueend.com/)
- Ruby 1.9.2 (installed via RVM) - `rvm install 1.9.2`
- Rails 3 (installed in ruby-1.9.2 in RVM) - `rvm use 1.9.2; gem install rails`
- RVM gem - `gem install rvm` (but don't need to run `rvm-install` if RVM is installed using another method already)

### Usage

Expand Down
1 change: 0 additions & 1 deletion cleanup.rb
@@ -1,7 +1,6 @@
remove_file "README"
remove_file "doc/"
remove_file "public/index.html"
remove_file "public/favicon.ico"
remove_file "public/images/rails.png"

# cleanup gemfile, by removing all commented lines
Expand Down
8 changes: 8 additions & 0 deletions gems.rb
Expand Up @@ -28,5 +28,13 @@
(" " * 6) + "generator.template_engine :haml\n"
end

create_file "config/initializers/haml.rb" do
<<-HAML
Haml::Template.options[:attr_wrapper] = '\"'
Haml::Template.options[:format] = :xhtml
Sass::Plugin.options[:style] = :expanded
HAML
end

@use_haml = true
end
4 changes: 2 additions & 2 deletions git.rb
Expand Up @@ -22,12 +22,12 @@
say("\t[#{index + 1}] #{repo.gsub(/<app>/, app_name)}")
end

say("\t[#{options.length}] other repository")
say("\t[#{options.length + 1}] other repository")

question = lambda { ask("Enter number:", :yellow) }
repository = question.call

while !(1..(options.length - 1)).include?(repository.to_i) do
while !(1..(options.length + 1)).include?(repository.to_i) do
say("Incorrect option", :red)
repository = question.call
end
Expand Down
11 changes: 10 additions & 1 deletion layout.rb
@@ -1,4 +1,13 @@
get "#{File.dirname(__FILE__)}/resources/reset.css", "public/stylesheets/reset.css"
if @use_haml
get "#{File.dirname(__FILE__)}/resources/reset.scss", "public/stylesheets/sass/reset.scss"

append_file ".gitignore" do
"public/stylesheets/*.css"
end

else
get "#{File.dirname(__FILE__)}/resources/reset.css", "public/stylesheets/reset.css"
end

inside "app/views/layouts" do
remove_file "application.html.erb"
Expand Down
3 changes: 2 additions & 1 deletion resources/layout.html.haml
@@ -1,6 +1,7 @@
%html{:lang => "en", "xml:lang" => "en", :xmlns => "http://www.w3.org/1999/xhtml", "xmlns:fb" => "http://www.facebook.com/2008/fbml", "xmlns:og" => "http://opengraphprotocol.org/schema/"}
%head
%title ""
%title
Application
%meta{:content => "", :name => "description"}
%meta{:content => "", :name => "keywords"}

Expand Down
46 changes: 46 additions & 0 deletions resources/reset.scss
@@ -0,0 +1,46 @@
@charset "utf-8";
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
background: transparent;
}

:focus {
outline: 0;
}

body {
line-height: 1;
color: #000000;
background: #ffffff;
}

ol, ul {
list-style: none;
}

table {
border-collapse: collapse;
border-spacing: 0;
}

caption, th, td {
text-align: left;
font-weight: normal;
}

blockquote:before, blockquote:after, q:before, q:after {
content: "";
}

blockquote, q {
quotes: "" "";
}
6 changes: 3 additions & 3 deletions rspec.rb
Expand Up @@ -8,9 +8,9 @@
(" " * 6) + "generator.test_framework :rspec, :views => false\n"
end

gem 'rspec', '>= 2.0.0', :group => :test
gem 'rspec-rails', '>= 2.0.0', :group => :test
gem 'database_cleaner', :group => :test
gem 'rspec', '>= 2.0.0', :group => :test
gem 'rspec-rails', '>= 2.0.0', :group => :test
gem 'database_cleaner', :group => :test

unless Gem.available?("rspec", ">= 2.0.0")
run "gem install rspec -v '>= 2.0.0' --no-rdoc --no-ri"
Expand Down
10 changes: 8 additions & 2 deletions rvm.rb
Expand Up @@ -11,6 +11,12 @@
# rvm use 1.9.2

# TODO: check prerequisites
unless Gem.available?("rspec", ">= 2.0.0")
run "gem install rvm --no-rdoc --no-ri"

Gem.refresh
Gem.activate("rvm")
end

require 'rvm'

Expand All @@ -19,9 +25,9 @@
end

run "rvm rvmrc trust"

run "rvm use --create 1.9.2@#{app_name}"
run "rvm use 1.9.2@#{app_name} --create"
run "rvm 1.9.2@#{app_name}"
run "rvm gemset load #{app_name}"

RVM.gemset_use! app_name

Expand Down

0 comments on commit 7da17b0

Please sign in to comment.