Skip to content

Instantly share code, notes, and snippets.

@Lumbe
Last active February 14, 2017 15:25
Show Gist options
  • Save Lumbe/c553b7f1ef6105f731cb3a85fab358cf to your computer and use it in GitHub Desktop.
Save Lumbe/c553b7f1ef6105f731cb3a85fab358cf to your computer and use it in GitHub Desktop.
Create new rails project with onotole gem

Create new rails project with onotole gem on c9.io

1.Create new hosted workspace with 'Ruby' template on c9.io

  1. Install gem onotole

$ gem install onotole
  1. Install qt5 package on Ubuntu 14.04('capybara-webkit' gem dependancy, which is part of onotole app)

$ sudo apt-get install qt5-default
$ sudo apt-get install libqt5webkit5-dev
  1. Generate rails app scaffold with onotole

$ onotole projectname -c

This will generate project with mandatory gems and will provide a menu for gem selection, where you will need to choose all options

Database will not be created and migrations will fail because of unknown encoding 'UTF-8' for new postresql database. Add template: template0 to config/database.yml, development section:

development: &default
  ...
  template: template0

and run migrations again:

rails db:create db:migrate db:seed

amend changes to last commit(if you choose to init git repository):

git add .
git commit --amend
  1. Change port to 8080 for puma server(config/puma.rb)

port ENV.fetch("PROJECTNAME_PORT") { 8080 }

and Guardfile in the root of your project

guard :puma, port: 8080 do
  watch("Gemfile.lock")
  watch(%r{^config|lib|api/.*})
end

and .env file in the root of your project(gem dotenv-rails). File must look like this:

# https://github.com/ddollar/forego
PINSHOP_ASSET_HOST=localhost:8080
PINSHOP_APPLICATION_HOST=localhost:8080
PINSHOP_PORT=8080
PINSHOP_SECRET_KEY_BASE=development_secret
PINSHOP_SMTP_ADDRESS=smtp.example.com
PINSHOP_SMTP_DOMAIN=example.com
PINSHOP_SMTP_PORT=587
PINSHOP_SMTP_PASSWORD=password
PINSHOP_SMTP_USERNAME=username
PINSHOP_WEB_CONCURRENCY=1
PINSHOP_MAX_THREADS=16
PINSHOP_COVERAGE=false        # simplecov flag
RACK_ENV=development
EXECJS_RUNTIME=Node
RAILS_SERVE_STATIC_FILES=true
DEFER_GC=1      # Garbage collector flag. Used in RSpec
  1. Start rails server to check that app is working correctly

$ rails s -p $PORT -b $IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment