Created
November 19, 2012 21:48
-
-
Save plainprogrammer/4114249 to your computer and use it in GitHub Desktop.
The Ready Project Ruby Application Templates
This file contains 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 characters
require 'rvm' | |
rvm_env = RVM::Environment.new("jruby") | |
rvm_env.gemset_create(app_name) | |
rvm_env.gemset_use!(app_name) | |
create_file ".rvmrc", "rvm use jruby@trpsoa-#{app_name} --create" | |
run "rm README.rdoc" | |
run "rm doc/README_FOR_APP" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" | |
run "rm -rf app/assets" | |
run "rm -rf test/" | |
run "touch doc/.gitkeep" | |
run "rm Gemfile" | |
file 'Gemfile', <<-eos | |
source :rubygems | |
gem 'rails', '~> 3.2.9' | |
gem 'jruby-openssl' | |
gem 'activerecord-jdbcpostgresql-adapter' | |
gem 'activerecord-postgres-hstore', git: 'git://github.com/engageis/activerecord-postgres-hstore.git' | |
gem 'trinidad', require: nil | |
gem 'jquery-rails' | |
gem 'jbuilder' | |
gem 'versioncake' | |
gem "sentry-raven", :git => "https://github.com/getsentry/raven-ruby.git" | |
group :development, :test do | |
gem 'rspec-rails' | |
end | |
group :test do | |
gem 'factory_girl_rails' | |
gem 'shoulda' | |
gem 'simplecov', require: false | |
end | |
eos | |
run 'bundle install' | |
generate("rspec:install") | |
inject_into_file 'spec/spec_helper.rb', "\nrequire 'factory_girl'", :after => "require 'rspec/rails'" | |
inject_into_file 'spec/spec_helper.rb', "\n\nrequire 'simplecov'\nSimpleCov.start 'rails'\n", :after => "ENV["RAILS_ENV"] ||= 'test'" | |
run "rm config/application.rb" | |
file 'config/application.rb', <<-eos | |
require File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
if defined?(Bundler) | |
# If you precompile assets before deploying to production, use this line | |
Bundler.require(*Rails.groups(:assets => %w(development test))) | |
# If you want your assets lazily compiled in production, use this line | |
# Bundler.require(:default, :assets, Rails.env) | |
end | |
module #{app_name.classify} | |
class Application < Rails::Application | |
#config.autoload_paths += %W(\#{config.root}/extras) | |
#config.plugins = [ :exception_notification, :ssl_requirement, :all ] | |
#config.active_record.observers = :cacher, :garbage_collector, :forum_observer | |
config.time_zone = 'UTC' | |
config.i18n.default_locale = :en | |
config.encoding = "utf-8" | |
#config.filter_parameters += [:password] | |
config.active_support.escape_html_entities_in_json = true | |
config.active_record.schema_format = :sql | |
config.active_record.whitelist_attributes = true | |
# Enable the asset pipeline | |
config.assets.enabled = false | |
config.generators do |g| | |
g.stylesheets false | |
g.test_framework :rspec | |
g.fixture_replacement :factory_girl | |
end | |
config.view_versions = [1] | |
config.view_version_extraction_strategy = [:http_header, :http_accept_parameter, :query_parameter] | |
end | |
end | |
eos | |
run "createdb sharktank_#{app_name}_dev" | |
run "createdb sharktank_#{app_name}_test" | |
run "rm config/database.yml" | |
file 'config/database.yml', <<-eos | |
development: | |
adapter: jdbcpostgresql | |
encoding: unicode | |
database: sharktank_#{app_name}_dev | |
username: #{ENV['USER']} | |
password: | |
test: | |
adapter: jdbcpostgresql | |
encoding: unicode | |
database: sharktank_#{app_name}_test | |
username: #{ENV['USER']} | |
password: | |
eos | |
run "echo 'config/database.yml' >> .gitignore" | |
generate("hstore:setup") | |
rake "db:migrate" | |
git :init | |
git :add => "." | |
git :commit => %Q{ -m 'Initial commit' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment