Skip to content

Commit 0a7c871

Browse files
jferrisharlow
authored andcommitted
Bootstrap example app
* Basic Rails 3.2 application * Configure basic testing dependencies (rspec, factory_girl, capybara) * Configure basic dev dependencies (clearance, simple_form) * Bootstrap simple_form config
1 parent fe7e355 commit 0a7c871

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+885
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ output
33
*.sw?
44
.bundle
55
liquid
6+
7+
example_app/.bundle
8+
example_app/bin/stubs
9+
example_app/db/*.sqlite3
10+
example_app/log/*.log
11+
example_app/tmp

example_app/.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--require spec_helper.rb

example_app/.rvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rvm use 1.9.3-p194

example_app/Gemfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'rails', '3.2.8'
4+
5+
gem 'capybara'
6+
gem 'clearance'
7+
gem 'factory_girl_rails'
8+
gem 'rspec-rails'
9+
gem 'shoulda-matchers'
10+
gem 'simple_form'
11+
gem 'sqlite3'
12+
gem 'strong_parameters'

example_app/Gemfile.lock

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
actionmailer (3.2.8)
5+
actionpack (= 3.2.8)
6+
mail (~> 2.4.4)
7+
actionpack (3.2.8)
8+
activemodel (= 3.2.8)
9+
activesupport (= 3.2.8)
10+
builder (~> 3.0.0)
11+
erubis (~> 2.7.0)
12+
journey (~> 1.0.4)
13+
rack (~> 1.4.0)
14+
rack-cache (~> 1.2)
15+
rack-test (~> 0.6.1)
16+
sprockets (~> 2.1.3)
17+
activemodel (3.2.8)
18+
activesupport (= 3.2.8)
19+
builder (~> 3.0.0)
20+
activerecord (3.2.8)
21+
activemodel (= 3.2.8)
22+
activesupport (= 3.2.8)
23+
arel (~> 3.0.2)
24+
tzinfo (~> 0.3.29)
25+
activeresource (3.2.8)
26+
activemodel (= 3.2.8)
27+
activesupport (= 3.2.8)
28+
activesupport (3.2.8)
29+
i18n (~> 0.6)
30+
multi_json (~> 1.0)
31+
addressable (2.3.2)
32+
arel (3.0.2)
33+
builder (3.0.4)
34+
capybara (2.0.0)
35+
mime-types (>= 1.16)
36+
nokogiri (>= 1.3.3)
37+
rack (>= 1.0.0)
38+
rack-test (>= 0.5.4)
39+
selenium-webdriver (~> 2.0)
40+
xpath (~> 1.0.0)
41+
childprocess (0.3.6)
42+
ffi (~> 1.0, >= 1.0.6)
43+
clearance (0.16.3)
44+
diesel (~> 0.1.5)
45+
rails (>= 3.0)
46+
diesel (0.1.5)
47+
railties
48+
diff-lcs (1.1.3)
49+
erubis (2.7.0)
50+
factory_girl (4.1.0)
51+
activesupport (>= 3.0.0)
52+
factory_girl_rails (4.1.0)
53+
factory_girl (~> 4.1.0)
54+
railties (>= 3.0.0)
55+
ffi (1.1.5)
56+
hike (1.2.1)
57+
i18n (0.6.1)
58+
journey (1.0.4)
59+
json (1.7.5)
60+
libwebsocket (0.1.5)
61+
addressable
62+
mail (2.4.4)
63+
i18n (>= 0.4.0)
64+
mime-types (~> 1.16)
65+
treetop (~> 1.4.8)
66+
mime-types (1.19)
67+
multi_json (1.3.7)
68+
nokogiri (1.5.5)
69+
polyglot (0.3.3)
70+
rack (1.4.1)
71+
rack-cache (1.2)
72+
rack (>= 0.4)
73+
rack-ssl (1.3.2)
74+
rack
75+
rack-test (0.6.2)
76+
rack (>= 1.0)
77+
rails (3.2.8)
78+
actionmailer (= 3.2.8)
79+
actionpack (= 3.2.8)
80+
activerecord (= 3.2.8)
81+
activeresource (= 3.2.8)
82+
activesupport (= 3.2.8)
83+
bundler (~> 1.0)
84+
railties (= 3.2.8)
85+
railties (3.2.8)
86+
actionpack (= 3.2.8)
87+
activesupport (= 3.2.8)
88+
rack-ssl (~> 1.3.2)
89+
rake (>= 0.8.7)
90+
rdoc (~> 3.4)
91+
thor (>= 0.14.6, < 2.0)
92+
rake (10.0.0)
93+
rdoc (3.12)
94+
json (~> 1.4)
95+
rspec (2.11.0)
96+
rspec-core (~> 2.11.0)
97+
rspec-expectations (~> 2.11.0)
98+
rspec-mocks (~> 2.11.0)
99+
rspec-core (2.11.1)
100+
rspec-expectations (2.11.3)
101+
diff-lcs (~> 1.1.3)
102+
rspec-mocks (2.11.3)
103+
rspec-rails (2.11.4)
104+
actionpack (>= 3.0)
105+
activesupport (>= 3.0)
106+
railties (>= 3.0)
107+
rspec (~> 2.11.0)
108+
rubyzip (0.9.9)
109+
selenium-webdriver (2.26.0)
110+
childprocess (>= 0.2.5)
111+
libwebsocket (~> 0.1.3)
112+
multi_json (~> 1.0)
113+
rubyzip
114+
shoulda-matchers (1.4.1)
115+
activesupport (>= 3.0.0)
116+
simple_form (2.0.4)
117+
actionpack (~> 3.0)
118+
activemodel (~> 3.0)
119+
sprockets (2.1.3)
120+
hike (~> 1.2)
121+
rack (~> 1.0)
122+
tilt (~> 1.1, != 1.3.0)
123+
sqlite3 (1.3.6)
124+
strong_parameters (0.1.3)
125+
actionpack (>= 3.2.0)
126+
activemodel (>= 3.2.0)
127+
thor (0.16.0)
128+
tilt (1.3.3)
129+
treetop (1.4.12)
130+
polyglot
131+
polyglot (>= 0.3.1)
132+
tzinfo (0.3.35)
133+
xpath (1.0.0)
134+
nokogiri (~> 1.3)
135+
136+
PLATFORMS
137+
ruby
138+
139+
DEPENDENCIES
140+
capybara
141+
clearance
142+
factory_girl_rails
143+
rails (= 3.2.8)
144+
rspec-rails
145+
shoulda-matchers
146+
simple_form
147+
sqlite3
148+
strong_parameters

example_app/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Ruby Science Rails Example app
2+
==============================
3+
4+
It's a Rails 3.2 app.
5+
6+
Running the app
7+
---------------
8+
9+
Make sure you're running Ruby 1.9 (there's an .rvmrc) and then:
10+
11+
bundle
12+
bundle exec rake db:create db:migrate
13+
bundle exec rails server
14+
15+
Open on http://localhost:3000

example_app/Rakefile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env rake
2+
# Add your own tasks in files placed in lib/tasks ending in .rake,
3+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4+
5+
require File.expand_path('../config/application', __FILE__)
6+
7+
ExampleApp::Application.load_tasks
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This is a manifest file that'll be compiled into application.js, which will include all the files
2+
// listed below.
3+
//
4+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6+
//
7+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8+
// the compiled file.
9+
//
10+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11+
// GO AFTER THE REQUIRES BELOW.
12+
//
13+
//= require jquery
14+
//= require jquery_ujs
15+
//= require_tree .
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* This is a manifest file that'll be compiled into application.css, which will include all the files
3+
* listed below.
4+
*
5+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7+
*
8+
* You're free to add application-wide styles to this file and they'll appear at the top of the
9+
* compiled file, but it's generally better to create a new file per style scope.
10+
*
11+
*= require_self
12+
*= require_tree .
13+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ApplicationController < ActionController::Base
2+
include Clearance::Authentication
3+
protect_from_forgery
4+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module ApplicationHelper
2+
end

example_app/app/mailers/.gitkeep

Whitespace-only changes.

example_app/app/models/.gitkeep

Whitespace-only changes.

example_app/app/models/user.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class User < ActiveRecord::Base
2+
include Clearance::User
3+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div id="flash">
2+
<% flash.each do |key, value| -%>
3+
<div id="flash_<%= key %>"><%= value %></div>
4+
<% end -%>
5+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>ExampleApp</title>
5+
<%= stylesheet_link_tag "application", :media => "all" %>
6+
<%= javascript_include_tag "application" %>
7+
<%= csrf_meta_tags %>
8+
</head>
9+
<body>
10+
11+
<%= render 'flashes' %>
12+
<%= yield %>
13+
14+
</body>
15+
</html>

example_app/config.ru

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This file is used by Rack-based servers to start the application.
2+
3+
require ::File.expand_path('../config/environment', __FILE__)
4+
run ExampleApp::Application

example_app/config/application.rb

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
require File.expand_path('../boot', __FILE__)
2+
3+
# Pick the frameworks you want:
4+
require "active_record/railtie"
5+
require "action_controller/railtie"
6+
require "action_mailer/railtie"
7+
require "active_resource/railtie"
8+
# require "sprockets/railtie"
9+
# require "rails/test_unit/railtie"
10+
11+
if defined?(Bundler)
12+
# If you precompile assets before deploying to production, use this line
13+
Bundler.require(*Rails.groups(:assets => %w(development test)))
14+
# If you want your assets lazily compiled in production, use this line
15+
# Bundler.require(:default, :assets, Rails.env)
16+
end
17+
18+
module ExampleApp
19+
class Application < Rails::Application
20+
# Settings in config/environments/* take precedence over those specified here.
21+
# Application configuration should go into files in config/initializers
22+
# -- all .rb files in that directory are automatically loaded.
23+
24+
# Custom directories with classes and modules you want to be autoloadable.
25+
# config.autoload_paths += %W(#{config.root}/extras)
26+
27+
# Only load the plugins named here, in the order given (default is alphabetical).
28+
# :all can be used as a placeholder for all plugins not explicitly named.
29+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
30+
31+
# Activate observers that should always be running.
32+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
33+
34+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
35+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
36+
# config.time_zone = 'Central Time (US & Canada)'
37+
38+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
40+
# config.i18n.default_locale = :de
41+
42+
# Configure the default encoding used in templates for Ruby 1.9.
43+
config.encoding = "utf-8"
44+
45+
# Configure sensitive parameters which will be filtered from the log file.
46+
config.filter_parameters += [:password]
47+
48+
# Enable escaping HTML in JSON.
49+
config.active_support.escape_html_entities_in_json = true
50+
51+
# Use SQL instead of Active Record's schema dumper when creating the database.
52+
# This is necessary if your schema can't be completely dumped by the schema dumper,
53+
# like if you have constraints or database-specific column types
54+
# config.active_record.schema_format = :sql
55+
56+
# Enforce whitelist mode for mass assignment.
57+
# This will create an empty whitelist of attributes available for mass-assignment for all models
58+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
59+
# parameters by using an attr_accessible or attr_protected declaration.
60+
config.active_record.whitelist_attributes = false
61+
62+
end
63+
end

example_app/config/boot.rb

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require 'rubygems'
2+
3+
# Set up gems listed in the Gemfile.
4+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5+
6+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])

example_app/config/database.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SQLite version 3.x
2+
# gem install sqlite3
3+
#
4+
# Ensure the SQLite 3 gem is defined in your Gemfile
5+
# gem 'sqlite3'
6+
development:
7+
adapter: sqlite3
8+
database: db/development.sqlite3
9+
pool: 5
10+
timeout: 5000
11+
12+
# Warning: The database defined as "test" will be erased and
13+
# re-generated from your development database when you run "rake".
14+
# Do not set this db to the same as development or production.
15+
test:
16+
adapter: sqlite3
17+
database: db/test.sqlite3
18+
pool: 5
19+
timeout: 5000
20+
21+
production:
22+
adapter: sqlite3
23+
database: db/production.sqlite3
24+
pool: 5
25+
timeout: 5000

example_app/config/environment.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Load the rails application
2+
require File.expand_path('../application', __FILE__)
3+
4+
# Initialize the rails application
5+
ExampleApp::Application.initialize!

0 commit comments

Comments
 (0)