A9 Checklist Starting a New Rails App Throughout the book we recommend several

A9 checklist starting a new rails app throughout the

This preview shows page 513 - 515 out of 517 pages.

A.9 Checklist: Starting a New Rails App Throughout the book we recommend several tools for developing, testing, deploying, and monitoring the code quality of your app. In this section, we pull together in one place a step-by-step list for creating a new app that takes advantage of all these tools. This section will only make sense after you have read all the referenced sections, so use it as a reference and don’t worry if you don’t understand all the steps now. Steps are annotated with the section number(s) in which the tool or concept is first introduced. Set up your app: 4.1 ) 1. rails -v to ensure you’re running the desired version of Rails. If not run gem install rails - v x.x.x with x.x.x set to the version you want; 3.2.19 for example. 2. rails new appname -T to create the new app. -T skips creating the test subdirectory used by the Test::Unit testing framework, since we recommend using RSpec instead. 3. cd appname to navigate into your new app’s root directory. From now on, all shell commands should be issued from this directory. 4. Edit the Gemfile to lock the versions of Ruby and Rails, for example: 1 # in Gemfile: 2 ruby ’1.9.3’ # Ruby version you’re running 3 rails ’3.2.19’ # Rails version for this app If you ended up changing the version(s) already present in the Gemfile, run bundle install --without production to make sure you have compatible versions of Rails and other gems. 5. Make sure your app runs by executing rails server and visiting . You should see the Rails welcome page. 6. git init to set up your app’s root directory as a GitHub repo. (§ A.6 , Screencast A.6.1 ) Connect your app to GitHub, CodeClimate, and Heroku: 1. Create a GitHub repo via GitHub’s web interface, and do the initial commit and push of your new
Image of page 513
app’s repo. (§ A.7 ) 2. Point CodeClimate at your app’s GitHub repo. (§ 9.5 ) 3. Make the changes necessary to deploy to production on Heroku. (§ A.8 ) 4. Run bundle install --without production if you’ve changed your Gemfile . Commit the changes to Gemfile and Gemfile.lock . On future changes to the Gemfile, you can just say bundle with no arguments, since Bundler will remember the option to skip production gems. 4.1 ) 5. heroku apps:create appname to create your new app on Heroku (§ A.8 ) 6. git push heroku master to ensure the app deploys correctly. You should then be able to visit your app’s Rails splash page at http:// appname .herokuapp.com . At this point you can safely remove the default splash page: git rm public/index.html . (§ A.8 ) Set up your testing environment: 1. Add support in your Gemfile for Cucumber (§ 7.6 ), RSpec (§ 8.2 ), interactive debugging (§ 4.1 ), SimpleCov (§ 8.7 ), Autotest (§ 8.2 ), FactoryGirl (§ 8.5 ), Jasmine if you plan to use JavaScript (§ 6.7 ), and Metric-Fu to keep track of your code metrics: 1 # debugger is useful in development mode too 2 group :development, :test do 3 gem ’debugger’ 4 gem ’jasmine-rails’ # if you plan to use JavaScript/CoffeeScript 5 end 6 # setup Cucumber, RSpec, autotest support 7 group :test do 8 gem ’rspec-rails’, ’2.14’ 9 gem ’simplecov’, :require => false 10 gem ’cucumber-rails’,
Image of page 514
Image of page 515

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors