Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
310 lines (288 sloc) 14.7 KB
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Example Gemfiles for Rails 3.2 &#183; RailsApps</title>
<link href="https://plus.google.com/u/0/b/117374718581973393536/117374718581973393536/posts/" rel="publisher" />
<link rel="stylesheet" href="http://railsapps.github.com/css/bootstrap.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="http://railsapps.github.com/css/screen.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="http://railsapps.github.com/css/gollum.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="http://railsapps.github.com/css/site.css" type="text/css" charset="utf-8" />
<link rel="stylesheet" href="http://railsapps.github.com/css/syntax.css" type="text/css" charset="utf-8" />
<script src="http://code.jquery.com/jquery-1.6.min.js" type="text/javascript"></script>
<script src="http://railsapps.github.com/javascript/jquery.text_selection-1.0.0.min.js" type="text/javascript"></script>
<script src="http://railsapps.github.com/javascript/jquery.previewable_comment_form.js" type="text/javascript"></script>
<script src="http://railsapps.github.com/javascript/jquery.tabs.js" type="text/javascript"></script>
<script src="http://railsapps.github.com/javascript/gollum.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5109366-14']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a href="http://railsapps.github.com/" class="brand">RailsApps Project</a>
<ul class="pull-right nav">
<li><a href="http://blog.railsapps.org/" class="twitter">Blog</a></li>
<li><a href="http://twitter.com/rails_apps" class="twitter">Twitter</a></li>
<li><a href="https://plus.google.com/117374718581973393536" class="google">Google +</a></li>
<li><a href="https://github.com/RailsApps" class="github">GitHub Repository</a></li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="content wikistyle gollum textile">
<h1>Example Gemfiles for Rails 3.2</h1>
<h4>by Daniel Kehoe</h4>
<p><em>Last updated 13 June 2012</em></p>
<p>Here are example Gemfiles for typical applications built with Rails 3.2.</p>
<p>See <a href="http://railsapps.github.com/installing-rails.html">Installing Rails 3.2</a> for detailed instructions and advice.</p>
<p>Did you find what you’re looking for? Leave a comment below if there’s anything useful I could add.</p>
<h2>Rails 3.2 Gemfile</h2>
<p>A Rails 3.2.6 application includes the following Gemfile when created with the <code>rails new</code> command:</p>
<pre>
source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~&gt; 3.2.3'
gem 'coffee-rails', '~&gt; 3.2.1'
gem 'uglifier', '&gt;= 1.0.3'
end
gem 'jquery-rails'
</pre>
<p>Check for the newest versions of these gems:</p>
<ul>
<li><a href="http://rubygems.org/gems/rails">rails</a></li>
<li><a href="http://rubygems.org/gems/sqlite3">sqlite3</a></li>
<li><a href="http://rubygems.org/gems/sass-rails">sass-rails</a></li>
<li><a href="http://rubygems.org/gems/coffee-rails">coffee-rails</a></li>
<li><a href="http://rubygems.org/gems/uglifier">uglifier</a></li>
<li><a href="http://rubygems.org/gems/jquery-rails">jquery-rails</a></li>
</ul><h2>Common Additions</h2>
<p>Here are gems that are often added to a new Rails application.</p>
<h4>Gemfile for Ubuntu Linux</h4>
<p>Since Rails 3.1, a JavaScript runtime has been needed for development on Linux Ubuntu. It is not needed for Mac OS X or Windows.</p>
<p>For development on Linux Ubuntu, it’s best to install the <a href="http://nodejs.org/">Node.js</a> server-side JavaScript environment:</p>
<p><code>sudo apt-get install nodejs</code></p>
<p>and set it in your <code>$PATH</code>.</p>
<p>If you don’t install Node.js, you’ll need to add this to the Gemfile for each Rails application you build:</p>
<pre>
gem 'therubyracer', '&gt;= 0.9.9'
</pre>
<p>Check for the newest version of <a href="http://rubygems.org/gems/therubyracer">therubyracer</a>.</p>
<h4>Gemfile for Heroku</h4>
<p>Heroku provides low cost, easily configured Rails application hosting. For your convenience, see <a href="http://railsapps.github.com/rails-heroku-tutorial.html">Tutorial: Rails 3.2 with Ruby 1.9.3 on Heroku</a>.</p>
<p>Heroku uses PostgreSQL as its default database. If you don’t want to install PostgreSQL locally, you can set your Gemfile to use SQLite locally and PostgreSQL in production (see <a href="http://railsapps.github.com/rails-heroku-tutorial.html">the article</a> for pros and cons). You’ll likely use the Thin web server for a production app though you may wish to use the default Webrick locally.</p>
<p>Run <code>bundle install --without production</code> to update your gems. Here’s the Gemfile you’d use:</p>
<pre>
source 'https://rubygems.org'
gem 'rails', '3.2.6'
# for deployment on Heroku
gem "heroku"
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'thin'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~&gt; 3.2.3'
gem 'coffee-rails', '~&gt; 3.2.1'
gem 'uglifier', '&gt;= 1.0.3'
end
gem 'jquery-rails'
</pre>
<h4>Gemfile for RSpec and Cucumber</h4>
<p><a href="https://www.relishapp.com/rspec">RSpec</a> is a popular alternative to the Test::Unit testing framework. <a href="http://cukes.info/">Cucumber</a> is used with RSpec for Behaviour Driven Development.</p>
<p>Several gems are commonly used with RSpec and Cucumber. <a href="https://github.com/thoughtbot/factory_girl">Factory_girl</a> is a fixtures library used to create objects needed for testing. <a href="https://github.com/jnicklas/capybara">Capybara</a> allows testing of web pages by simulating <span class="caps">HTTP</span> requests as if someone was using a browser. <a href="https://github.com/bmabey/database_cleaner">Database_cleaner</a> is used to initialize a database to a clean state during tests. <a href="http://www.copiousfreetime.org/projects/launchy/">Launchy</a> is used to launch a web browser to display the state of a web page during testing (primarily for debugging tests).</p>
<p>Here’s a Gemfile configured for RSpec and Cucumber:</p>
<pre>
source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~&gt; 3.2.3'
gem 'coffee-rails', '~&gt; 3.2.1'
gem 'uglifier', '&gt;= 1.0.3'
end
gem 'jquery-rails'
group :development, :test do
gem "rspec-rails", "&gt;= 2.8.1"
end
group :test do
gem "factory_girl_rails", "&gt;= 1.6.0"
gem "cucumber-rails", "&gt;= 1.2.1"
gem "capybara", "&gt;= 1.1.2"
gem "database_cleaner"
gem "launchy"
end
</pre>
<p>Check for the newest versions of these gems:</p>
<ul>
<li><a href="http://rubygems.org/gems/rspec-rails">rspec-rails</a></li>
<li><a href="http://rubygems.org/gems/factory_girl_rails">factory_girl_rails</a></li>
<li><a href="http://rubygems.org/gems/cucumber-rails">cucumber-rails</a></li>
<li><a href="http://rubygems.org/gems/capybara">capybara</a></li>
<li><a href="http://rubygems.org/gems/database_cleaner">database_cleaner</a></li>
<li><a href="http://rubygems.org/gems/launchy">launchy</a></li>
</ul><h2>Gems for the RailsApps Examples</h2>
<p>Here are Gemfiles for the example apps in the <a href="http://railsapps.github.com/">Rails Apps</a> repository.</p>
<p>A few of the example apps use the <a href="http://mongoid.org/">Mongoid</a> gem for access to a MongoDB datastore.</p>
<ul>
<li><a href="http://rubygems.org/gems/mongoid">mongoid</a></li>
</ul><p>A few of the example apps use <a href="http://github.com/plataformatec/devise">Devise</a> for authentication.</p>
<ul>
<li><a href="http://rubygems.org/gems/devise">devise</a></li>
</ul><p>One of the example apps uses <a href="https://github.com/intridea/omniauth">OmniAuth</a> for authentication.</p>
<ul>
<li><a href="http://rubygems.org/gems/omniauth">omniauth</a></li>
</ul><p>The example apps have been tested with the indicated versions.</p>
<p>For the RailsApps example apps built with Rails 3.2, use the following gems and specify versions optimistically (using the <code>&gt;=</code> operator).</p>
<p>The RailsApps example apps have been tested with this configuration:</p>
<ul>
<li>Ruby 1.9.3</li>
<li>RubyGems 1.8.24</li>
<li>Rails 3.2.6</li>
<li>Rake 0.9.2.2</li>
</ul><p><em>Note:</em> The RailsApps examples are generated with application templates created by the <a href="https://github.com/RailsApps/rails_apps_composer">Rails Apps Composer Gem</a>. For that reason, groups such as <code>:development</code> or <code>:test</code> are specified inline. You can reformat the Gemfiles to organize groups in an eye-pleasing block style (as presented in the Gemfiles shown above). The functionality is the same.</p>
<h4><a href="https://github.com/RailsApps/rails3-devise-rspec-cucumber">rails3-devise-rspec-cucumber</a></h4>
<pre>
source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'sqlite3'
group :assets do
gem 'sass-rails', '~&gt; 3.2.3'
gem 'coffee-rails', '~&gt; 3.2.1'
gem 'uglifier', '&gt;= 1.0.3'
end
gem 'jquery-rails'
gem "rspec-rails", "&gt;= 2.8.1", :group =&gt; [:development, :test]
gem "factory_girl_rails", "&gt;= 1.7.0", :group =&gt; :test
gem "email_spec", "&gt;= 1.2.1", :group =&gt; :test
gem "cucumber-rails", "&gt;= 1.3.0", :group =&gt; :test
gem "capybara", "&gt;= 1.1.2", :group =&gt; :test
gem "database_cleaner", "&gt;= 0.7.1", :group =&gt; :test
gem "launchy", "&gt;= 2.0.5", :group =&gt; :test
gem "devise", "&gt;= 2.0.4"
</pre>
<h4><a href="https://github.com/RailsApps/rails3-mongoid-devise">rails3-mongoid-devise</a></h4>
<pre>
source 'https://rubygems.org'
gem 'rails', '3.2.6'
group :assets do
gem 'sass-rails', '~&gt; 3.2.3'
gem 'coffee-rails', '~&gt; 3.2.1'
gem 'uglifier', '&gt;= 1.0.3'
end
gem 'jquery-rails'
gem "rspec-rails", "&gt;= 2.8.1", :group =&gt; [:development, :test]
gem "database_cleaner", "&gt;= 0.7.1", :group =&gt; :test
gem "mongoid-rspec", "&gt;= 1.4.4", :group =&gt; :test
gem "factory_girl_rails", "&gt;= 1.6.0", :group =&gt; :test
gem "cucumber-rails", "&gt;= 1.2.1", :group =&gt; :test
gem "capybara", "&gt;= 1.1.2", :group =&gt; :test
gem "launchy", "&gt;= 2.0.5", :group =&gt; :test
gem "bson_ext", "&gt;= 1.3.1"
gem "mongoid", "&gt;= 2.4.3"
gem "devise", "&gt;= 2.0.0"
</pre>
<h4><a href="https://github.com/RailsApps/rails3-mongoid-omniauth">rails3-mongoid-omniauth</a></h4>
<pre>
source 'https://rubygems.org'
gem 'rails', '3.2.6'
group :assets do
gem 'sass-rails', '~&gt; 3.2.3'
gem 'coffee-rails', '~&gt; 3.2.1'
gem 'uglifier', '&gt;= 1.0.3'
end
gem 'jquery-rails'
gem "rspec-rails", "&gt;= 2.8.1", :group =&gt; [:development, :test]
gem "database_cleaner", "&gt;= 0.7.1", :group =&gt; :test
gem "mongoid-rspec", "&gt;= 1.4.4", :group =&gt; :test
gem "factory_girl_rails", "&gt;= 1.6.0", :group =&gt; :test
gem "cucumber-rails", "&gt;= 1.2.1", :group =&gt; :test
gem "capybara", "&gt;= 1.1.2", :group =&gt; :test
gem "launchy", "&gt;= 2.0.5", :group =&gt; :test
gem "bson_ext", "&gt;= 1.3.1"
gem "mongoid", "&gt;= 2.4.3"
gem "omniauth", "&gt;= 1.0.2"
gem "omniauth-twitter"
</pre>
<h4><a href="https://github.com/RailsApps/rails3-subdomains">rails3-subdomains</a></h4>
<pre>
source 'https://rubygems.org'
gem 'rails', '3.2.6'
group :assets do
gem 'sass-rails', '~&gt; 3.2.3'
gem 'coffee-rails', '~&gt; 3.2.1'
gem 'uglifier', '&gt;= 1.0.3'
end
gem 'jquery-rails'
gem "haml", "&gt;= 3.1.4"
gem "haml-rails", "&gt;= 0.3.4", :group =&gt; :development
gem "rspec-rails", "&gt;= 2.8.1", :group =&gt; [:development, :test]
gem "database_cleaner", "&gt;= 0.7.1", :group =&gt; :test
gem "mongoid-rspec", "&gt;= 1.4.4", :group =&gt; :test
gem "factory_girl_rails", "&gt;= 1.6.0", :group =&gt; :test
gem "cucumber-rails", "&gt;= 1.2.1", :group =&gt; :test
gem "capybara", "&gt;= 1.1.2", :group =&gt; :test
gem "launchy", "&gt;= 2.0.5", :group =&gt; :test
gem "bson_ext", "&gt;= 1.3.1"
gem "mongoid", "&gt;= 2.4.3"
gem "devise", "&gt;= 2.0.0"
</pre>
</div><!-- class="content" -->
<div class="comments">
<div class="content wikistyle gollum">
<h2>Comments and Issues</h2>
</div>
<p>Is this helpful? Please add a comment below. Your encouragement fuels the project.</p>
<p>Did you find an error? Or couldn't get something to work? For the example apps and tutorials, please create a GitHub issue in the repository for the example app. Creating a GitHub issue is the best way to make sure a problem is investigated and fixed.</p>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'railsapps'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div><!-- class="comments" -->
<div class="footer row">
<div class="span4">
<h3>Credits</h3>
<p><a href="http://danielkehoe.com/">Daniel Kehoe</a> initiated the <a href="http://railsapps.github.com/">RailsApps Project</a>. Thanks to all the users and contributors.</p>
</div>
<div class="span4">
<h3>Wiki</h3>
<p>Corrections? Additions? You can edit this page <a href="https://github.com/RailsApps/railsapps.github.com/wiki/_pages">on the wiki</a>.</p>
</div>
<div class="span4">
<h3>Last edit</h3>
<p>by <b>Daniel Kehoe</b>, 2012-07-20 23:08:42</p>
</div>
</div>
</div>
</body>
</html>