Last active
September 30, 2015 20:27
Revisions
-
RISCfuture revised this gist
Mar 28, 2013 . 1 changed file with 26 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,27 @@ # encoding: utf-8 require 'open3' def rvm_env(cmd) Open3.popen3 "bash -c 'source ~/.rvm/scripts/rvm && #{cmd}'" do |stdin, stdout, stderr, thread| thread.join end end def rvm(env, cmd) rvm_env "rvm #{env} do #{cmd}" end pretty_name = ARGV[1] pretty_name = 'TODO' if ARGV[1] == '--skip-bundle' author = `dscl localhost -read /Local/Default/Users/$USER RealName`.match(/^RealName:\n\s*(.+?)\n$/m)[1] create_file '.ruby-version', '2.0.0' create_file '.ruby-gemset' app_name gem 'erector' gem 'redcarpet', :require => nil, :group => 'development' gem 'yard', :require => nil, :group => 'development' gem 'rspec-rails', :group => 'test' gem 'factory_girl_rails', :group => 'test' @@ -18,8 +30,8 @@ selected_gems.each { |g| gem g } say_status 'gemset', 'Creating gemset' rvm_env "rvm use --create 1.9.3@#{app_name}" rvm "1.9.3@#{app_name}", 'bundle install' # create database say_status 'db', "Creating database" @@ -28,11 +40,11 @@ run "createdb -O #{app_name} --encoding=utf8 #{app_name}_test", :verbose => false say_status 'generate', 'rspec:install' rvm "1.9.3@#{app_name}", 'rails g rspec:install' selected_gems.each do |g| say_status 'generate', g rvm "1.9.3@#{app_name}", "rails g #{g}" end remove_file 'app/assets/images/rails.png' @@ -101,10 +113,12 @@ def inline_css gsub_file 'app/assets/stylesheets/application.css', ' *= require_tree .', " *\n *= require normalize" gsub_file 'Gemfile', /:(\w+)\s*=>\s*/, '\1: ' gsub_file 'config/application.rb', /:(\w+)\s*=>\s*/, '\1: ' gsub_file 'config/application.rb', "# config.time_zone = 'Central Time (US & Canada)'", "config.time_zone = 'Pacific Time (US & Canada)'" gsub_file 'config/application.rb', "config.active_record.schema_format = :ruby", "config.active_record.schema_format = :sql" gsub_file 'config/application.rb', '# config.autoload_paths += %W(#{config.root}/extras)", "config.autoload_paths << config.root.join(\'lib\')' gsub_file 'config/application.rb', '+= [:password]', '<< :password' gsub_file 'config/application.rb', '"utf-8"', "'utf-8'" inject_into_file 'config/application.rb', <<-RUBY, :after => "config.assets.version = '1.0'" @@ -156,9 +170,9 @@ def inline_css not_an_integer: not an integer odd: must be odd taken: already taken too_long: must be %{count} characters or shorter too_short: must be %{count} characters or longer wrong_length: must be %{count} characters long invalid_date: not a valid date invalid_time: not a valid time invalid_datetime: not a valid date and time @@ -196,7 +210,7 @@ def inline_css doc.options << '--protected' << '--no-private' doc.options << '-r' << 'doc/README_FOR_APP.md' doc.options << '-o' << 'doc/app' doc.options << '--title' << "#{pretty_name} Documentation'" doc.files = %w( app/**/*.rb lib/**/*.rb doc/README_FOR_APP.md ) end @@ -211,8 +225,6 @@ def inline_css TODO MARKDOWN gsub_file '.rspec', '--colour', '-cfs' gsub_file 'spec/spec_helper.rb', 'Rails.root.join("spec/support/**/*.rb")', "Rails.root.join('spec', 'support', '**', '*.rb')" @@ -231,6 +243,6 @@ def inline_css git :init git :add => '-f tmp/.gitignore' #run "mine ." say "Be sure to do a project-wide search for the word 'TODO' now." -
RISCfuture revised this gist
May 15, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,8 +18,8 @@ selected_gems.each { |g| gem g } say_status 'gemset', 'Creating gemset' run "source $HOME/.rvm/scripts/rvm && rvm ruby-1.9.3-p194 do rvm gemset create #{app_name}", :verbose => false run "source $HOME/.rvm/scripts/rvm && rvm ruby-1.9.3-p194@#{app_name} do bundle install", :verbose => false # create database say_status 'db', "Creating database" -
RISCfuture revised this gist
Feb 22, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -211,6 +211,8 @@ def inline_css TODO MARKDOWN inject_into_file 'app/controllers/application_controller.rb', 'layout false # handled by view class inheritance', :before => 'protect_from_forgery' gsub_file '.rspec', '--colour', '-cfs' gsub_file 'spec/spec_helper.rb', 'Rails.root.join("spec/support/**/*.rb")', "Rails.root.join('spec', 'support', '**', '*.rb')" -
RISCfuture revised this gist
Feb 21, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -196,7 +196,7 @@ def inline_css doc.options << '--protected' << '--no-private' doc.options << '-r' << 'doc/README_FOR_APP.md' doc.options << '-o' << 'doc/app' doc.options << '--title' << "#{pretty_name} Documentation" doc.files = %w( app/**/*.rb lib/**/*.rb doc/README_FOR_APP.md ) end -
RISCfuture revised this gist
Feb 21, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -206,7 +206,7 @@ def inline_css remove_file 'doc/README_FOR_APP' create_file 'doc/README_FOR_APP.md', <<-MARKDOWN #{pretty_name} #{'='*pretty_name.size} TODO MARKDOWN -
RISCfuture revised this gist
Feb 21, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ selected_gems.each { |g| gem g } say_status 'gemset', 'Creating gemset' run "source ~/.rvm/scripts/rvm && rvm --create 1.9.3@#{app_name}", :verbose => false run "rvm 1.9.3@#{app_name} do bundle install", :verbose => false # create database -
RISCfuture revised this gist
Feb 21, 2012 . 1 changed file with 15 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,37 +2,37 @@ pretty_name = ARGV[1] pretty_name = 'TODO' if ARGV[1] == '--skip-bundle' author = `dscl localhost -read /Local/Default/Users/$USER RealName`.match(/^RealName:\n\s*(.+?)\n$/m)[1] create_file '.rvmrc', "rvm 1.9.3@#{app_name} --create" gem 'erector' gem 'redcarpet', :require => nil, :group => 'development' gem 'yard', :require => nil, :group => 'development' gem 'rails3-generators', :require => nil, :group => 'development' gem 'rspec-rails', :group => 'test' gem 'factory_girl_rails', :group => 'test' OPTIONAL_GEMS = %w( configoro has_metadata slugalicious paperclip ) selected_gems = OPTIONAL_GEMS.select { |g| yes? "Will this project be using #{g}?" } selected_gems.each { |g| gem g } say_status 'gemset', 'Creating gemset' run "rvm use 1.9.3 && rvm gemset create #{app_name}", :verbose => false run "rvm 1.9.3@#{app_name} do bundle install", :verbose => false # create database say_status 'db', "Creating database" run "createuser -DRS #{app_name}", :verbose => false run "createdb -O #{app_name} --encoding=utf8 #{app_name}_development", :verbose => false run "createdb -O #{app_name} --encoding=utf8 #{app_name}_test", :verbose => false say_status 'generate', 'rspec:install' run "rvm 1.9.3@#{app_name} do rails g rspec:install", :verbose => false selected_gems.each do |g| say_status 'generate', g run "rvm 1.9.3@#{app_name} do rails g #{g}", :verbose => false end remove_file 'app/assets/images/rails.png' @@ -107,7 +107,7 @@ def inline_css gsub_file 'config/application.rb', "# config.time_zone = 'Central Time (US & Canada)'", "config.time_zone = 'Pacific Time (US & Canada)'" gsub_file 'config/application.rb', '+= [:password]', '<< :password' gsub_file 'config/application.rb', '"utf-8"', "'utf-8'" inject_into_file 'config/application.rb', <<-RUBY, :after => "config.assets.version = '1.0'" config.generators do |g| g.template_engine :erector @@ -227,7 +227,7 @@ def inline_css create_file 'doc/.gitignore', 'app' git :init git :add => '-f tmp/.gitignore' run "mine ." -
RISCfuture revised this gist
Feb 19, 2012 . 1 changed file with 62 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ # encoding: utf-8 pretty_name = ARGV[1] pretty_name = 'TODO' if ARGV[1] == '--skip-bundle' author = `dscl localhost -read /Users/$USER RealName`.match(/^RealName:\n\s*(.+?)\n$/m)[1] @@ -115,6 +117,66 @@ def inline_css end RUBY remove_file 'config/locales/en.yml' create_file 'config/locales/en.yml', <<-YAML en: activerecord: errors: models: TODO: attributes: TODO: TODO: TODO models: TODO: TODO attributes: TODO: TODO: TODO date: formats: TODO: TODO errors: messages: accepted: must be accepted blank: can’t be blank confirmation: doesn’t match confirmation empty: can’t be empty equal_to: must be equal to %{count} even: must be even exclusion: reserved greater_than: must be greater than %{count} greater_than_or_equal_to: must be greater than or equal to %{count} inclusion: not acceptable incorrect_type: incorrect type invalid: invalid invalid_email: not a valid email address less_than: must be less than %{count} less_than_or_equal_to: must be less than or equal to %{count} not_a_number: not a number not_an_integer: not an integer odd: must be odd taken: already taken too_long: must be shorter than %{count} characters too_short: must be longer than %{count} characters wrong_length: must be be %{count} characters long invalid_date: not a valid date invalid_time: not a valid time invalid_datetime: not a valid date and time is_at: must be at %{restriction} before: must be before %{restriction} on_or_before: must be on or before %{restriction} after: must be after %{restriction} on_or_after: must be on or after %{restriction} helpers: submit: TODO: create: TODO update: TODO time: formats: TODO: TODO YAML create_file 'config/initializers/field_error_proc.rb', <<-RUBY # Change the behavior of fields with bad data. This wraps them in a span with # data-errors attributes listing the errors. JavaScript then creates the -
RISCfuture revised this gist
Feb 18, 2012 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -134,7 +134,7 @@ def inline_css doc.options << '--protected' << '--no-private' doc.options << '-r' << 'doc/README_FOR_APP.md' doc.options << '-o' << 'doc/app' doc.options << '--title' << "#{pretty_name} Documentation'" doc.files = %w( app/**/*.rb lib/**/*.rb doc/README_FOR_APP.md ) end @@ -159,7 +159,7 @@ def inline_css remove_file 'log/.gitkeep' create_file 'log/.gitignore', '*.log' remove_file '.gitignore' create_file '.gitignore', ".bundle\n.yardoc" create_file 'db/.gitignore', '*.sqlite3' create_file 'tmp/.gitignore', '*' create_file 'doc/.gitignore', 'app' @@ -169,4 +169,4 @@ def inline_css run "mine ." say "Be sure to do a project-wide search for the word 'TODO' now." -
Tim Morgan revised this gist
Feb 18, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -134,7 +134,7 @@ def inline_css doc.options << '--protected' << '--no-private' doc.options << '-r' << 'doc/README_FOR_APP.md' doc.options << '-o' << 'doc/app' doc.options << '--title' << "#{pretty_name} Documentation" doc.files = %w( app/**/*.rb lib/**/*.rb doc/README_FOR_APP.md ) end -
RISCfuture revised this gist
Feb 18, 2012 . 1 changed file with 13 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -96,6 +96,8 @@ def inline_css end RUBY gsub_file 'app/assets/stylesheets/application.css', ' *= require_tree .', " *\n *= require normalize" gsub_file 'Gemfile', /:(\w+)\s*=>\s*/, '\1: ' gsub_file 'Gemfile', "source 'https://rubygems.org'", 'source :rubygems' @@ -134,11 +136,19 @@ def inline_css doc.options << '-o' << 'doc/app' doc.options << '--title' << "#{pretty_name} Documentation'" doc.files = %w( app/**/*.rb lib/**/*.rb doc/README_FOR_APP.md ) end end RUBY remove_file 'doc/README_FOR_APP' create_file 'doc/README_FOR_APP.md', <<-MARKDOWN #{pretty_name} #{'-'*pretty_name.size} TODO MARKDOWN gsub_file '.rspec', '--colour', '-cfs' gsub_file 'spec/spec_helper.rb', 'Rails.root.join("spec/support/**/*.rb")', "Rails.root.join('spec', 'support', '**', '*.rb')" @@ -152,10 +162,11 @@ def inline_css create_file '.gitignore', '.bundle' create_file 'db/.gitignore', '*.sqlite3' create_file 'tmp/.gitignore', '*' create_file 'doc/.gitignore', 'app' git :init git add: '-f tmp/.gitignore' run "mine ." say "Be sure to do a project-wide search for the word 'TODO' now." -
RISCfuture revised this gist
Feb 18, 2012 . 1 changed file with 8 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,11 +11,9 @@ gem 'rspec-rails', group: 'test' gem 'factory_girl_rails', group: 'test' OPTIONAL_GEMS = %w( configoro has_metadata slugalicious paperclip ) selected_gems = OPTIONAL_GEMS.select { |g| yes? "Will this project be using #{g}?" } selected_gems.each { |g| gem g } say_status 'gemset', 'Creating gemset' run "rvm use 1.9.3 && rvm gemset create #{app_name}", verbose: false @@ -27,13 +25,14 @@ run "createdb -O #{app_name} --encoding=utf8 #{app_name}_development", verbose: false run "createdb -O #{app_name} --encoding=utf8 #{app_name}_test", verbose: false say_status 'generate', 'rspec:install' run "rvm 1.9.3@#{app_name} do rails g rspec:install", verbose: false selected_gems.each do |g| say_status 'generate', g run "rvm 1.9.3@#{app_name} do rails g #{g}", verbose: false end remove_file 'app/assets/images/rails.png' remove_file 'public/index.html' -
RISCfuture created this gist
Feb 18, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,162 @@ pretty_name = ARGV[1] pretty_name = 'TODO' if ARGV[1] == '--skip-bundle' author = `dscl localhost -read /Users/$USER RealName`.match(/^RealName:\n\s*(.+?)\n$/m)[1] create_file '.rvmrc', "rvm 1.9.3@#{app_name} --create" gem 'erector' gem 'redcarpet', require: nil, group: 'development' gem 'yard', require: nil, group: 'development' gem 'rails3-generators', require: nil, group: 'development' gem 'rspec-rails', group: 'test' gem 'factory_girl_rails', group: 'test' # other gems to consider? #gem 'configoro' #gem 'has_metadata' #gem 'slugalicious' #gem 'paperclip say_status 'gemset', 'Creating gemset' run "rvm use 1.9.3 && rvm gemset create #{app_name}", verbose: false run "rvm 1.9.3@#{app_name} do bundle install", verbose: false # create database say_status 'db', "Creating database" run "createuser -DRS #{app_name}", verbose: false run "createdb -O #{app_name} --encoding=utf8 #{app_name}_development", verbose: false run "createdb -O #{app_name} --encoding=utf8 #{app_name}_test", verbose: false #generate 'metadata' #generate 'slugalicious' #generate 'paperclip say_status 'generate', 'rspec:install' run "rvm 1.9.3@#{app_name} do rails g rspec:install", verbose: false remove_file 'app/assets/images/rails.png' remove_file 'public/index.html' remove_file 'app/views/layouts/application.html.erb' create_file 'app/views/layouts/application.html.rb', <<-RUBY # encoding: utf-8 module Views module Layouts class Application < Erector::Widget def content rawtext "<!DOCTYPE html>" html(lang: 'en') do head_portion body_portion end end protected def body_content raise NotImplementedError end def body_id() nil end private def head_portion metas title "#{pretty_name}" stylesheet_link_tag 'application' inline_css end def metas meta(charset: 'utf-8') meta(name: 'description', content: "TODO") meta(name: 'author', content: "#{author}") end def body_portion body do body_content javascript_include_tag 'application' inline_javascript end end def inline_javascript file = Rails.root.join('app', self.class.to_s.underscore + '.js') script(raw(File.read(file)), type: 'text/javascript') if File.exist?(file) end def inline_css file = Rails.root.join('app', self.class.to_s.underscore + '.css') style(raw(File.read(file)), type: 'text/css') if File.exist?(file) end end end end RUBY gsub_file 'Gemfile', /:(\w+)\s*=>\s*/, '\1: ' gsub_file 'Gemfile', "source 'https://rubygems.org'", 'source :rubygems' gsub_file 'config/application.rb', /:(\w+)\s*=>\s*/, '\1: ' gsub_file 'config/application.rb', "# config.time_zone = 'Central Time (US & Canada)'", "config.time_zone = 'Pacific Time (US & Canada)'" gsub_file 'config/application.rb', '+= [:password]', '<< :password' gsub_file 'config/application.rb', '"utf-8"', "'utf-8'" inject_into_file 'config/application.rb', <<-RUBY, after: "config.assets.version = '1.0'" config.generators do |g| g.template_engine :erector g.test_framework :rspec, fixture: true, views: false g.integration_tool :rspec g.fixture_replacement :factory_girl, dir: 'spec/factories' end RUBY create_file 'config/initializers/field_error_proc.rb', <<-RUBY # Change the behavior of fields with bad data. This wraps them in a span with # data-errors attributes listing the errors. JavaScript then creates the # appropriate visual error display. ActionView::Base.field_error_proc = Proc.new do |html, object| errors = Array.wrap(object.error_message).map { |error| %(data-error="\#{error}") }.join(' ') %(<span class="field-with-errors" \#{errors}>\#{html}</span>).html_safe end RUBY create_file 'lib/tasks/doc.rake', <<-RUBY if Rails.env.development? then require 'yard' YARD::Rake::YardocTask.new do |doc| doc.options << '-m' << 'markdown' << '-M' << 'redcarpet' doc.options << '--protected' << '--no-private' doc.options << '-r' << 'doc/README_FOR_APP.md' doc.options << '-o' << 'doc/app' doc.options << '--title' << "#{pretty_name} Documentation'" doc.files = ['app/**/*.rb', 'lib/**/*.rb', 'doc/README_FOR_APP.md'] end end RUBY gsub_file '.rspec', '--colour', '-cfs' gsub_file 'spec/spec_helper.rb', 'Rails.root.join("spec/support/**/*.rb")', "Rails.root.join('spec', 'support', '**', '*.rb')" gsub_file 'spec/spec_helper.rb', 'config.fixture_path = "#{::Rails.root}/spec/fixtures"', '# config.fixture_path = "#{::Rails.root}/spec/fixtures"' get "https://raw.github.com/necolas/normalize.css/master/normalize.css", 'vendor/assets/stylesheets/normalize.css' remove_file 'log/.gitkeep' create_file 'log/.gitignore', '*.log' remove_file '.gitignore' create_file '.gitignore', '.bundle' create_file 'db/.gitignore', '*.sqlite3' create_file 'tmp/.gitignore', '*' git :init git add: '-f tmp/.gitignore' run "mine ." say "Be sure to do a project-wide search for the word 'TODO' now."