Skip to content

Instantly share code, notes, and snippets.

@vita
Forked from jkovar/gist:4508830
Last active December 14, 2015 09:29
Show Gist options
  • Save vita/5065535 to your computer and use it in GitHub Desktop.
Save vita/5065535 to your computer and use it in GitHub Desktop.
run 'rm public/index.html'
# RVM
file '.rvmrc', "rvm 1.9.2@#{app_name} --create"
# Setup database
gsub_file 'config/database.yml', /username: (.*)/, 'host: localhost'
gsub_file 'config/database.yml', /password:/, ''
# Gems
gem 'gecon', :git => 'git@gitlab.issmart.sm:gecon.git'
# TODO: zkusit presunout definici dalsich gemu do gecon dependencies
gem 'thin'
gem 'activeadmin'
gem "ckeditor"
gem 'globalize3', '0.2.0.beta8'
gem 'aws-sdk', '1.3.3'
gem 'paperclip', '2.5.2'
gem 'treasure_hunt'
gem 'memcachier'
gem 'dalli'
gem 'asset_sync'
gem 'i18n-js'
gem 'cocaine', '0.3.2'
gem 'net-scp', '1.0.4'
gem_group :production, :staging do
gem "sentry-raven", :git => "https://github.com/getsentry/raven-ruby.git"
end
if yes?('Do you want to install Trivia?')
gem 'trivia'
@trivia = true
else
@trivia = false
end
if yes?('Do you want to generate asynchronous file uploading?')
gem 'jquery-fileupload-rails', git: 'git://github.com/ollnixon/jquery-fileupload-rails.git'
@upload = true
else
@upload = false
end
# Run Bundler
run "rvm 1.9.2@#{app_name} --create"
run 'bundle install'
# Create database
rake 'db:create'
# ActiveAdmin
generate 'active_admin:install'
run 'rm app/assets/javascripts/active_admin.js'
run 'echo "//= require active_admin/base" > app/assets/javascripts/active_admin.js.erb'
run 'echo "window.CKEDITOR_BASEPATH=\"<%= Rails.application.config.action_controller.asset_host %>/assets/ckeditor/\";" >> app/assets/javascripts/active_admin.js.erb'
run 'echo ".cke_chrome {width: 76% !important; overflow: hidden;}" >> app/assets/stylesheets/active_admin.css.scss'
# CkEditor
generate 'ckeditor:install --orm=active_record --backend=paperclip'
# Treasure Hunt
generate 'treasure_hunt:install'
# Gecon
generate 'gecon:install'
# Trivia
if @trivia
generate 'trivia:install'
generate 'gecon:trivia'
end
# Users codes
if yes?('Do you want to generate codes insertion?')
generate 'gecon:users_codes'
end
# Upload form
if @upload
generate 'gecon:upload'
end
# Lokalizace
locales = []
begin
locale = ask("Which locale do you want to add? ('quit' for exit):")
locales << locale unless locale == 'quit'
end while locale != 'quit'
generate "gecon:locales #{locales.join(' ')}"
if locales.include?('cs')
translation = <<-EOF
formtastic:
yes: 'Ano'
no: 'Ne'
create: 'Vytvořit'
update: 'Aktualizovat'
submit: 'Odeslat'
cancel: 'Zrušit'
reset: 'Resetovat'
required: 'povinné'
EOF
run "echo \"#{translation}\" >> config/locales/admin.cs.yml"
end
# Run migrations and seed
rake 'db:migrate'
rake 'db:seed'
# Procfile
run 'echo "web: bundle exec rails server thin -p \$PORT -e \$RACK_ENV" > Procfile'
# Bundle gecon into vendor for an easy heroku deploy
if yes?('Do you want to bundle the Gecon gem into vendor?')
run 'mkdir vendor/gems'
run 'git clone git@gitlab.issmart.sm:gecon.git vendor/gems/gecon'
run 'rm -rf vendor/gems/gecon/.git'
run 'rm -rf vendor/gems/gecon/.rvmrc'
run 'rm -rf vendor/gems/gecon/.gitignore'
gsub_file 'Gemfile', /:git => "git@gitlab.issmart.sm:gecon.git"/, ":path => 'vendor/gems/gecon'"
run 'bundle update gecon'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment