Skip to content

Commit

Permalink
Merge pull request #2788 from refinery/guide-binstubs
Browse files Browse the repository at this point in the history
[DOC] Use bundler binstubs in guides.
  • Loading branch information
parndt committed Dec 6, 2014
2 parents 3aea1ee + e50b400 commit 3c359cf
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ cache: bundler
bundler_args: --without development
before_script:
- "sh -e /etc/init.d/xvfb start"
- "bundle exec rake refinery:testing:dummy_app"
- "bin/rake refinery:testing:dummy_app"
script:
- "DISPLAY=:99.0 bundle exec rspec $EXTENSION/spec"
- "DISPLAY=:99.0 bin/rspec $EXTENSION/spec"
env:
- DB=postgresql EXTENSION=authentication
- DB=mysql EXTENSION=authentication
Expand Down
16 changes: 16 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rake', 'rake')
16 changes: 16 additions & 0 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rspec-core', 'rspec')
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ In the case of a controller method, you can get easy access to the code with
the +refinery:uncrudify+ rake task:

<shell>
$ bundle exec rake refinery:uncrudify controller=refinery/admin/pages action=create
$ bin/rake refinery:uncrudify controller=refinery/admin/pages action=create
</shell>

TIP. Running the +rake refinery:uncrudify+ task outputs to +stdout+, and will not modify any files, so you can do so without fear of overwriting your existing controller modifications.
Expand Down Expand Up @@ -112,5 +112,5 @@ In Refinery 1.0.x, you have have two choices. The more severe one is to reset al
slugs for that model:

<shell>
MODEL=news_item bundle exec rake friendly_id:redo_slugs
MODEL=news_item bin/rake friendly_id:redo_slugs
</shell>
8 changes: 4 additions & 4 deletions doc/guides/2 - Refinery Basics/7 - Translate Refinery.textile
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ h3. Finding missing keys

First, you must create a 'dummy' application to enable additional useful +rake+ tasks. Do so with the following command:
<shell>
$ bundle exec rake refinery:testing:dummy_app
$ bin/rake refinery:testing:dummy_app
</shell>

Then execute the following to get a list of missing translations for all locales:

<shell>
$ bundle exec rake app:translate:lost_in_translation_all
$ bin/rake app:translate:lost_in_translation_all
</shell>

Or execute the following rake task to get a list of missing translations for a given locale:

<shell>
$ bundle exec rake app:translate:lost_in_translation LOCALE=nl
$ bin/rake app:translate:lost_in_translation LOCALE=nl
</shell>

The output of this will look like this:
Expand Down Expand Up @@ -74,7 +74,7 @@ h3. Run the Refinery tests
Run the Refinery tests to be sure you didn't break something, and that your YAML is valid.

<shell>
$ bundle exec rake spec
$ bin/rake spec
</shell>

h3. Commit & Push
Expand Down
8 changes: 4 additions & 4 deletions doc/guides/4 - Refinery Extensions/3 - Testing.textile
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ Refinery::Testing::Railtie.load_dummy_tasks ENGINE_PATH
And run the dummy application generator:

<shell>
$ bundle exec rake refinery:testing:dummy_app
$ bin/rake refinery:testing:dummy_app
</shell>

NOTE: To successfully run rake tasks within your project you may need to add the +refinerycms-testing+ gem to your application's Gemfile, too.

h3. Running the tests with Rake

<shell>
$ bundle exec rake spec
$ bin/rake spec
</shell>

This will run the rspec specs.

This is the most simple way to execute the test suite and useful for a one time run.

NOTE: If you get +Could not find table+ errors, it may help to delete the +spec/dummy+ directory and run +bundle exec rake refinery:testing:dummy_app+ again.
NOTE: If you get +Could not find table+ errors, it may help to delete the +spec/dummy+ directory and run +bin/rake refinery:testing:dummy_app+ again.

h3. Running the tests with Guard

Expand All @@ -67,7 +67,7 @@ We recommend using Guard if you like to develop using TDD. Guard will watch your
At your extension's root directory run:

<shell>
$ bundle exec guard start
$ bin/guard start
</shell>

Larger Rails apps, particularly on Ruby 1.9.2, may take several seconds (or more) to start up. If that's the case, you might also want to use Spork, which loads a single instance of the Rails environment and forks it to run tests, for even faster feedback cycles.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ cd ExistingApp
bundle
rails generate devise:install
rails generate devise User # Devise might be using another model name in your existing application
bundle exec rake db:migrate
bin/rake db:migrate
</shell>

Next we'll add a static, unrestricted home page, the notice and alert flashes to the application default layout, and a restricted_content controller and view.
Expand Down Expand Up @@ -321,7 +321,7 @@ end
</ruby>

<shell>
bundle exec rake db:migrate
bin/rake db:migrate
</shell>

Now we need to add authentication goodness manually, it will just consist in telling refinery to use your devise helpers.
Expand Down Expand Up @@ -410,7 +410,7 @@ If you try to access http://localhost:3000/refinery (Refinery's administrative b
Indeed, we have to correct one view to set the proper url helper.

<shell>
bundle exec rake refinery:override view=refinery/_site_bar
bin/rake refinery:override view=refinery/_site_bar
</shell>

Now the partial has been moved to your app, change @destroy_refinery_user_session_path@, with @destroy_user_session_path@.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ This command will do a couple of things:
* Update +app/views/sitemap/index.xml.builder+ template.
* Wrap +config.action_mailer+ config entry in a conditional +if config.respond_to?(:action_mailer)+ clause for each environment file located in +app/config/environments+.
* Copy new migrations.
* Run +bundle exec rake db:migrate+ and +bundle exec rake db:seed+ commands.
* Run +bin/rake db:migrate db:seed+ command

NOTE: Please check that the command has put refinery/formatting and refinery/theme into your CSS manifest file, as per the following "issue on GitHub":https://github.com/refinery/refinerycms/issues/2577

NOTE: If you don't want the generator to run +bundle exec rake db:migrate+ and +bundle exec rake db:seed+ commands pass the +--skip_db+ option when invoking refinery:cms generator:
NOTE: If you don't want the generator to run +db:migrate+ and +db:seed+ rake tasks pass the +--skip_db+ option when invoking refinery:cms generator:

<shell>
rails generate refinery:cms --skip_db
Expand All @@ -62,6 +62,6 @@ What this will do is check if the +seo_meta+ table has an index named +index_seo
* Remove the +meta_keywords+ column.
* Add back the original index but with a shorter name.

Now run +bundle exec rake db:migrate+.
Now run +bin/rake db:migrate+.

h3. Profit!
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ $ rails generate refinery:cms --update
Database migrations and new gem dependencies may have been added, so finish your Refinery update with:

<shell>
$ bundle exec rake db:migrate
$ bin/rake db:migrate
$ bundle install
</shell>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ gem 'refinerycms', :git => 'https://github.com/refinery/refinerycms'
Now, inside the application's directory, use the refinerycms generator to update your application:

<shell>
$ bundle exec rails generate refinery:cms --update
$ bin/rails generate refinery:cms --update
</shell>

h3. Solve any deprecation problems.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ h5. In terminal
$ git clone git@github.com:USERNAME/refinerycms.git
$ cd refinerycms
$ bundle install
$ bundle exec rake refinery:testing:dummy_app
$ bin/rake refinery:testing:dummy_app
$ rails server
</shell>

Expand All @@ -50,9 +50,9 @@ h4. Contributing a fix
Make your changes to fix a bug. Next regenerate the dummy app and run the Refinery tests

<shell>
$ bundle exec rake refinery:testing:clean_dummy_app
$ bundle exec rake refinery:testing:dummy_app
$ bundle exec rspec ./*/spec
$ bin/rake refinery:testing:clean_dummy_app
$ bin/rake refinery:testing:dummy_app
$ bin/rspec ./*/spec
</shell>

If this doesn't work. Follow the "How to test Refinery guide":/guides/testing
Expand Down

0 comments on commit 3c359cf

Please sign in to comment.