Rails new…. ciągle to samo i samo
Za każdym razem, gdy tworzę nowy projekt muszę powtarzać praktycznie te same czynności, dołączanie gemów, ich konfiguracja, etc. Poniżej ściąga z potrzebnych kroków:
$ rails new ichef -T -d postgresql
— ustawienia Gemfile —
$ rails g devise:install
Running via Spring preloader in process 14519 Expected string default value for '--jbuilder'; got true (boolean) create config/initializers/devise.rb create config/locales/devise.en.yml =============================================================================== Some setup you must do manually if you haven't yet: 1. Ensure you have defined default url options in your environments files. Here is an example of default_url_options appropriate for a development environment in config/environments/development.rb: config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } In production, :host should be set to the actual host of your application. 2. Ensure you have defined root_url to *something* in your config/routes.rb. For example: root to: "home#index" 3. Ensure you have flash messages in app/views/layouts/application.html.erb. For example: <p class="notice"><%= notice %></p> <p class="alert"><%= alert %></p> 4. You can copy Devise views (for customization) to your app by running: rails g devise:views ===============================================================================
Here is a possible configuration for config/environments/development.rb:
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
$ rails g devise user
Running via Spring preloader in process 14629
Expected string default value for '–jbuilder'; got true (boolean)
invoke active_record
create db/migrate/20170212134245_devise_create_users.rb
create app/models/user.rb
invoke rspec
create spec/models/user_spec.rb
invoke factory_girl
create spec/factories/users.rb
insert app/models/user.rb
route devise_for :users
$ git init
$ git flow init
add to db/seed.rb
User.create(email: 'admin@email.pl', password: 'xxx', password_confirmation: 'xxx')
$ rails db:migrate
$ rails generate devise:views
next use html2haml to convert html views to haml (if you dont have generated views in haml)
in config/environment/development.rb (to be sure for updateing controllers in dev env)
remove: config.file_watcher = ActiveSupport::EventedFileUpdateChecker
add: config.file_watcher = ActiveSupport::FileUpdateChecker
configure heroku… on heroku.com
https://devcenter.heroku.com/articles/getting-started-with-rails5
# set production.rb:
production:
url: <%= ENV[’DATABASE_URL'] %>
than:
$ heroku login
$ heroku git:remote -a app_name
$ git push heroku develop:master
$ heroku run rails db:migrate
$ heroku run rails db:seed
https://devcenter.heroku.com/articles/getting-started-with-rails5
— configure rspec
Najnowsze komentarze