Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

resolving .gitignore conflict

  • Loading branch information...
commit 6dc753e96cd87b855b4d3ba8bf3737c5b0ae2479 2 parents 8da3aa4 + 7d54ff3
@akitaonrails authored
View
58 README.textile
@@ -0,0 +1,58 @@
+Read the "Gemfile":blob/master/files/Gemfile to understand everything this template installs and pre-configures for you.
+
+One of gems, "Johnson":http://rubygems.org/gems/johnson, still has some issues compiling under Ruby 1.9.2 so you will need to use Ruby 1.8.7 instead.
+
+This template is heavily dependent on wget so, if you're using a Mac, you will need to install it first. The recommended way is to install "Homebrew":https://github.com/mxcl/homebrew first and then:
+
+<pre><code>brew install wget</code></pre>
+
+Since Github started forcing SSL in all its URLs, we need to download the template file separately:
+
+<pre><code>wget --no-check-certificate https://github.com/akitaonrails/rails3_template/raw/master/main.rb -O /tmp/rails3_template.rb</pre></code>
+
+Then whenever you want to create a new project, just do:
+
+<pre><code>rails new app_name -JT -m /tmp/rails3_template.rb</code></pre>
+
+Change <tt>app_name</tt> for your project name. You can configure what you need and run <tt>rake db:migrate</tt> to get started.
+
+h2. CRITERIA
+
+This is intended to be an opinionated template. The options chosen have these reasons:
+
+* Standard ERB instead of HAML - even though HAML is great the pros and cons are too balanced to justify replacing ERB.
+* Simple Form instead of Formtastic - to me, "feels" simpler
+* SASS instead of pure CSS - this undeniably adds value on top of CSS making it easier to organize
+* JQuery instead of Prototype - no need to say more
+* Kaminari instead of Will Paginate - cleaner solution for pagination
+* Pure Javascript instead of CoffeeScript - as HAML, the syntax gets more elegant, but there is no inherent advantages
+* RSpec, Factory Girl Cucumber, Spork, Capybara, Celerity, Faker, Metric Fu - this is the universally accepted main test package, so be it
+* Evergreen - testing Javascript is great and this seems to be the best so far
+* Devise - the best authentication system so far
+* Inherited Resources - lighter controllers
+* Compass, Asset Packager, Lemonade - easier way to deal with images and other assets
+* Cells - this is experimental but does bring advantages in making controller less cluttered and isolating components
+
+So, opinionated to a point, trying to stick to the basics where advantages are not so obvious.
+
+h2. TESTING
+
+Read Peter Cooper's "excellent tutorial":http://www.rubyinside.com/how-to-rails-3-and-rspec-2-4336.html on how to setup a fast testing environment:
+
+This template tries to do so. Before starting just run:
+
+<pre><code>spork</code></pre>
+
+And in another terminal run:
+
+<pre><code>rake watchr</code></pre>
+
+Also do not forget to modify <tt>config/environments/test.rb</tt> to reload classes:
+
+<pre><code>config.cache_classes = false</code></pre>
+
+h2. CREDITS
+
+This Template is based on "Diego Carrion's template":https://github.com/dcrec1/rails3_template. The changes include removing HAML, Hoptoad, Coffeescript (Barista), Remarkable, adding yajl for json, thin, replacing will_paginate for kaminari, replacing autotest for watchr, enabling spork, replacing formtastic for simple_form, bundling gems within the app,
+
+Author: Fabio Akita (@AkitaOnRails)
View
57 files/Gemfile
@@ -0,0 +1,57 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.6'
+
+gem 'sqlite3-ruby', :require => 'sqlite3'
+
+gem "rails_admin", :git => 'https://github.com/sferik/rails_admin.git'
+gem "inherited_resources"
+gem "kaminari"
+gem "devise"
+gem "simple_form"
+gem "friendly_id"
+gem "compass"
+gem "lemonade"
+gem "cells"
+gem 'yajl-ruby', :require => 'yajl/json_gem'
+
+group :development do
+ gem "watchr"
+ gem "rails3-generators", :git => "https://github.com/indirect/rails3-generators.git"
+ gem "metric_fu"
+end
+
+group :development, :test do
+ gem "spork"
+ gem "thin"
+ gem "evergreen"
+ gem "factory_girl_rails"
+ gem "rspec-rails"
+ gem "rspec-cells"
+ gem "faker"
+ gem "evergreen", :require => "evergreen/rails"
+ platforms :mri_18 do
+ gem "ruby-debug"
+ end
+ platforms :mri_19 do
+ gem "ruby-debug19", :require => 'ruby-debug'
+ end
+end
+
+group :test do
+ gem "rspec"
+ gem "capybara-envjs"
+end
+
+group :cucumber do
+ gem "cucumber"
+ gem "cucumber-rails"
+ gem "capybara"
+ gem "database_cleaner"
+ gem "spork"
+ gem "pickle"
+end
+
+group :production do
+ gem "newrelic_rpm"
+end
View
1  files/application.html
@@ -0,0 +1 @@
+<!-- Add the rendered HTML from your application over which the javascript will act -->
View
29 files/application.html.erb
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en" xml:lang="en">
+ <head>
+ <title>TITLE</title>
+ <%= raw stylesheet_link_merged('screen', :media => 'screen, projection') %>
+ <%= raw stylesheet_link_merged('simple_form', :media => 'screen, projection') %>
+ <%= raw stylesheet_link_merged('print', :media => 'print') %>
+ <!--[if lt IE 9]>
+ <%= javascript_include_tag 'html5' %>
+ <%= raw stylesheet_link_merged('ie', :media => 'screen, projection') %>
+ <![endif]-->
+ <%= csrf_meta_tag %>
+ </head>
+ <body>
+ <div id="container">
+ <header>HEADER</header>
+ <sidebar>SIDEBAR</sidebar>
+ <section id="content">
+ <% content_for :notice do %><p class="notice"><%= notice %></p><% end %>
+ <% content_for :alert do %><p class="alert"><%= alert %></p><% end %>
+ <%= yield %>
+ </section>
+ <footer>FOOTER</footer>
+ </div>
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
+ <%= raw javascript_include_merged(:base) %>
+ </body>
+</html>
View
39 files/application_spec.js
@@ -0,0 +1,39 @@
+// Example of how to add javascript specs
+//
+// require("/jquery.js");
+// require("/jquery-ui.js");
+// require("/application.js");
+// $.ready();
+//
+// describe("with main template", function() {
+// template('application.html');
+//
+// describe("on load", function() {
+// beforeEach(function() {
+// });
+//
+// it("should set select as text inputs", function() {
+// expect($("#sign_in")).toBeATextInput();
+// });
+//
+// it("should not set all select as text inputs", function() {
+// expect($("#select")).not.toBeATextInput();
+// });
+//
+// it("should hide the anchor", function() {
+// $("#container a.next").show();
+// $("#container a.next").click();
+// expect($("#playboard a.next")).toBeHidden();
+// });
+//
+// it("should show .matches nav a.prev", function() {
+// $("#container a.prev").hide();
+// $("#container a.next").click();
+// expect($("#playboard a.prev")).toBeVisible();
+// });
+//
+// it("should prevent the event default", function() {
+// expect(eventForSelectorHandler("#container a.prev", "click")).toBeDefaultPrevented();
+// });
+// })
+// })
View
11 files/asset_packages.yml
@@ -0,0 +1,11 @@
+---
+javascripts:
+- base:
+ - rails
+stylesheets:
+- ie:
+ - ie
+- screen:
+ - screen
+- print:
+ - print
View
6 files/bootstrap.rake
@@ -0,0 +1,6 @@
+namespace :db do
+ desc "Bootstraps the database with demo data"
+ task :bootstrap => %w(db:setup) do
+
+ end
+end
View
5 files/build.rake
@@ -0,0 +1,5 @@
+task :clean do
+ system "rm rerun.txt"
+end
+
+task :build => [:clean, 'db:migrate', :spec, 'spec:javascripts', :cucumber, 'metrics:all']
View
2  files/build.sh
@@ -0,0 +1,2 @@
+bundle install --without=production
+rake build
View
22 files/devise_steps.rb
@@ -0,0 +1,22 @@
+Given /^I am not authenticated$/ do
+ visit('/users/sign_out') # ensure that at least
+end
+
+Given /^I have one\s+user "([^\"]*)" with password "([^\"]*)" and login "([^\"]*)"$/ do |email, password, login|
+ User.new(:email => email,
+ :login => login,
+ :password => password,
+ :password_confirmation => password).save!
+end
+
+Given /^I am a new, authenticated user$/ do
+ email = 'testing@man.net'
+ login = 'Testing man'
+ password = 'secretpass'
+
+ Given %{I have one user "#{email}" with password "#{password}" and login "#{login}"}
+ And %{I go to login}
+ And %{I fill in "user_email" with "#{email}"}
+ And %{I fill in "user_password" with "#{password}"}
+ And %{I press "Sign in"}
+end
View
6 files/evergreen.rb
@@ -0,0 +1,6 @@
+require 'capybara/envjs'
+
+Evergreen.configure do |config|
+ config.driver = :envjs
+ config.public_dir = '/public/javascripts'
+end
View
2  files/factory_girl.rb
@@ -0,0 +1,2 @@
+require 'factory_girl'
+Dir.glob("#{File.dirname(__FILE__)}/../../spec/support/factories/*").each { |file| require file }
View
25 files/gitignore
@@ -0,0 +1,25 @@
+.DS_Store
+log/*
+tmp/*
+db/*.sqlite3
+coverage
+solr
+public/cache
+public/system
+public/stylesheets
+public/javascripts/*_packaged.js
+doc/specs.html
+doc/features.html
+tags
+*.sw?
+*~
+rerun.txt
+.bundle
+db/schema.rb
+specifications
+cache
+gems
+spec/requests
+spec/routing
+spec/views
+capybara*
View
BIN  files/grid.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
19 files/htaccess
@@ -0,0 +1,19 @@
+<ifModule mod_rewrite.c>
+ RewriteEngine On
+
+ RewriteCond %{THE_REQUEST} ^(GET|HEAD)
+ RewriteCond %{REQUEST_URI} ^(.*)$
+ RewriteCond %{DOCUMENT_ROOT}/cache/$1.html -f
+ RewriteRule ^(.*)$ /cache/$1.html
+</ifModule>
+
+<ifModule mod_expires.c>
+ ExpiresActive On
+ ExpiresDefault "access plus 1 year"
+</ifModule>
+
+<IfModule mod_deflate.c>
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/x-javascript
+</IfModule>
+
+FileETag None
View
6 files/html5.js
@@ -0,0 +1,6 @@
+// html5shiv MIT @rem remysharp.com/html5-enabling-script
+// iepp v1.6.2 MIT @jon_neal iecss.com/print-protector
+/*@cc_on(function(m,c){var z="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video";function n(d){for(var a=-1;++a<o;)d.createElement(i[a])}function p(d,a){for(var e=-1,b=d.length,j,q=[];++e<b;){j=d[e];if((a=j.media||a)!="screen")q.push(p(j.imports,a),j.cssText)}return q.join("")}var g=c.createElement("div");g.innerHTML="<z>i</z>";if(g.childNodes.length!==1){var i=z.split("|"),o=i.length,s=RegExp("(^|\\s)("+z+")",
+"gi"),t=RegExp("<(/*)("+z+")","gi"),u=RegExp("(^|[^\\n]*?\\s)("+z+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),r=c.createDocumentFragment(),k=c.documentElement;g=k.firstChild;var h=c.createElement("body"),l=c.createElement("style"),f;n(c);n(r);g.insertBefore(l,
+g.firstChild);l.media="print";m.attachEvent("onbeforeprint",function(){var d=-1,a=p(c.styleSheets,"all"),e=[],b;for(f=f||c.body;(b=u.exec(a))!=null;)e.push((b[1]+b[2]+b[3]).replace(s,"$1.iepp_$2")+b[4]);for(l.styleSheet.cssText=e.join("\n");++d<o;){a=c.getElementsByTagName(i[d]);e=a.length;for(b=-1;++b<e;)if(a[b].className.indexOf("iepp_")<0)a[b].className+=" iepp_"+i[d]}r.appendChild(f);k.appendChild(h);h.className=f.className;h.innerHTML=f.innerHTML.replace(t,"<$1font")});m.attachEvent("onafterprint",
+function(){h.innerHTML="";k.removeChild(h);k.appendChild(f);l.styleSheet.cssText=""})}})(this,document);@*/
View
231 files/newrelic.yml
@@ -0,0 +1,231 @@
+#
+# This file configures the New Relic RPM Agent. New Relic RPM monitors
+# Rails and Java applications with deep visibility and low overhead. For more
+# information, visit www.newrelic.com.
+#
+# Generated July 28, 2010
+#
+# This configuration file is custom generated for Labs Gonow
+
+# Here are the settings that are common to all environments:
+common: &default_settings
+ # ============================== LICENSE KEY ===============================
+
+ # You must specify the license key associated with your New Relic
+ # account. This key binds your Agent's data to your account in the
+ # New Relic RPM service.
+ license_key: 'your-license-key-goes-here'
+
+ # Agent Enabled (Rails Only)
+ # Use this setting to force the agent to run or not run.
+ # Default is 'auto' which means the agent will install and run only
+ # if a valid dispatcher such as Mongrel is running. This prevents
+ # it from running with Rake or the console. Set to false to
+ # completely turn the agent off regardless of the other settings.
+ # Valid values are true, false and auto.
+ # agent_enabled: auto
+
+ # Application Name
+ # Set this to be the name of your application as you'd like it show
+ # up in RPM. RPM will then auto-map instances of your application
+ # into a RPM "application" on your home dashboard page. If you want
+ # to map this instance into multiple apps, like "AJAX Requests" and
+ # "All UI" then specify a semicolon separated list of up to three
+ # distinct names. If you comment this out, it defaults to the
+ # capitalized RAILS_ENV (i.e., Production, Staging, etc)
+ app_name: My Application
+
+ # When "true", the agent collects performance data about your
+ # application and reports this data to the NewRelic RPM service at
+ # newrelic.com. This global switch is normally overridden for each
+ # environment below. (formerly called 'enabled')
+ monitor_mode: true
+
+ # Developer mode should be off in every environment but
+ # development as it has very high overhead in memory.
+ developer_mode: false
+
+ # The newrelic agent generates its own log file to keep its logging
+ # information separate from that of your application. Specify its
+ # log level here.
+ log_level: info
+
+ # The newrelic agent communicates with the RPM service via http by
+ # default. If you want to communicate via https to increase
+ # security, then turn on SSL by setting this value to true. Note,
+ # this will result in increased CPU overhead to perform the
+ # encryption involved in SSL communication, but this work is done
+ # asynchronously to the threads that process your application code,
+ # so it should not impact response times.
+ ssl: false
+
+ # EXPERIMENTAL: enable verification of the SSL certificate sent by
+ # the server. This setting has no effect unless SSL is enabled
+ # above. This may block your application. Only enable it if the data
+ # you send us needs end-to-end verified certificates.
+ #
+ # This means we cannot cache the DNS lookup, so each request to the
+ # RPM service will perform a lookup. It also means that we cannot
+ # use a non-blocking lookup, so in a worst case, if you have DNS
+ # problems, your app may block indefinitely.
+ # verify_certificate: true
+
+ # Set your application's Apdex threshold value with the 'apdex_t'
+ # setting, in seconds. The apdex_t value determines the buckets used
+ # to compute your overall Apdex score.
+ # Requests that take less than apdex_t seconds to process will be
+ # classified as Satisfying transactions; more than apdex_t seconds
+ # as Tolerating transactions; and more than four times the apdex_t
+ # value as Frustrating transactions.
+ # For more about the Apdex standard, see
+ # http://support.newrelic.com/faqs/general/apdex
+
+ apdex_t: 0.5
+
+ # Proxy settings for connecting to the RPM server.
+ #
+ # If a proxy is used, the host setting is required. Other settings
+ # are optional. Default port is 8080.
+ #
+ # proxy_host: hostname
+ # proxy_port: 8080
+ # proxy_user:
+ # proxy_pass:
+
+
+ # Tells transaction tracer and error collector (when enabled)
+ # whether or not to capture HTTP params. When true, frameworks can
+ # exclude HTTP parameters from being captured.
+ # Rails: the RoR filter_parameter_logging excludes parameters
+ # Java: create a config setting called "ignored_params" and set it to
+ # a comma separated list of HTTP parameter names.
+ # ex: ignored_params: credit_card, ssn, password
+ capture_params: false
+
+
+ # Transaction tracer captures deep information about slow
+ # transactions and sends this to the RPM service once a
+ # minute. Included in the transaction is the exact call sequence of
+ # the transactions including any SQL statements issued.
+ transaction_tracer:
+
+ # Transaction tracer is enabled by default. Set this to false to
+ # turn it off. This feature is only available at the Silver and
+ # above product levels.
+ enabled: true
+
+ # Threshold in seconds for when to collect a transaction
+ # trace. When the response time of a controller action exceeds
+ # this threshold, a transaction trace will be recorded and sent to
+ # RPM. Valid values are any float value, or (default) "apdex_f",
+ # which will use the threshold for an dissatisfying Apdex
+ # controller action - four times the Apdex T value.
+ transaction_threshold: apdex_f
+
+ # When transaction tracer is on, SQL statements can optionally be
+ # recorded. The recorder has three modes, "off" which sends no
+ # SQL, "raw" which sends the SQL statement in its original form,
+ # and "obfuscated", which strips out numeric and string literals
+ record_sql: obfuscated
+
+ # Threshold in seconds for when to collect stack trace for a SQL
+ # call. In other words, when SQL statements exceed this threshold,
+ # then capture and send to RPM the current stack trace. This is
+ # helpful for pinpointing where long SQL calls originate from
+ stack_trace_threshold: 0.500
+
+ # Determines whether the agent will capture query plans for slow
+ # SQL queries. Only supported in mysql and postgres. Should be
+ # set to false when using other adapters.
+ # explain_enabled: true
+
+ # Threshold for query execution time below which query plans will not
+ # not be captured. Relevant only when `explain_enabled` is true.
+ # explain_threshold: 0.5
+
+ # Error collector captures information about uncaught exceptions and
+ # sends them to RPM for viewing
+ error_collector:
+
+ # Error collector is enabled by default. Set this to false to turn
+ # it off. This feature is only available at the Silver and above
+ # product levels
+ enabled: true
+
+ # Rails Only - tells error collector whether or not to capture a
+ # source snippet around the place of the error when errors are View
+ # related.
+ capture_source: true
+
+ # To stop specific errors from reporting to RPM, set this property
+ # to comma separated values. Default is to ignore routing errors
+ # which are how 404's get triggered.
+ #
+ ignore_errors: ActionController::RoutingError
+
+ # (Advanced) Uncomment this to ensure the cpu and memory samplers
+ # won't run. Useful when you are using the agent to monitor an
+ # external resource
+ # disable_samplers: true
+
+ # If you aren't interested in visibility in these areas, you can
+ # disable the instrumentation to reduce overhead.
+ #
+ # disable_view_instrumentation: true
+ # disable_activerecord_instrumentation: true
+ # disable_memcache_instrumentation: true
+ # disable_dj: true
+
+ # Certain types of instrumentation such as GC stats will not work if
+ # you are running multi-threaded. Please let us know.
+ # multi_threaded = false
+
+# Application Environments
+# ------------------------------------------
+# Environment specific settings are in this section.
+# For Rails applications, RAILS_ENV is used to determine the environment
+# For Java applications, pass -Dnewrelic.environment <environment> to set
+# the environment
+
+# NOTE if your application has other named environments, you should
+# provide newrelic configuration settings for these environments here.
+
+development:
+ <<: *default_settings
+ # Turn off communication to RPM service in development mode (also
+ # 'enabled').
+ # NOTE: for initial evaluation purposes, you may want to temporarily
+ # turn the agent on in development mode.
+ monitor_mode: false
+
+ # Rails Only - when running in Developer Mode, the New Relic Agent will
+ # present performance information on the last 100 transactions you have
+ # executed since starting the mongrel.
+ # NOTE: There is substantial overhead when running in developer mode.
+ # Do not use for production or load testing.
+ developer_mode: true
+
+ # Enable textmate links
+ # textmate: true
+
+test:
+ <<: *default_settings
+ # It almost never makes sense to turn on the agent when running
+ # unit, functional or integration tests or the like.
+ monitor_mode: false
+
+# Turn on the agent in production for 24x7 monitoring. NewRelic
+# testing shows an average performance impact of < 5 ms per
+# transaction, you you can leave this on all the time without
+# incurring any user-visible performance degradation.
+production:
+ <<: *default_settings
+ monitor_mode: true
+
+# Many applications have a staging environment which behaves
+# identically to production. Support for that environment is provided
+# here. By default, the staging environment has the agent turned on.
+staging:
+ <<: *default_settings
+ monitor_mode: true
+ app_name: My Application (Staging)
View
BIN  files/overlay.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 files/print.scss
@@ -0,0 +1,8 @@
+@import "blueprint";
+
+// To generate css equivalent to the blueprint css but with your configuration applied, uncomment:
+// @include blueprint-print
+
+//Recommended Blueprint configuration with scoping and semantic layout:
+body.bp {
+ @include blueprint-print(true); }
View
23 files/rails_admin.rb
@@ -0,0 +1,23 @@
+RailsAdmin.authenticate_with { authenticate_admin! }
+
+# Read https://github.com/sferik/rails_admin for more options
+# Examples:
+#
+# RailsAdmin.config do |config|
+# config.models do
+# list do
+# sort_by :updated_at
+# sort_reverse true
+# end
+# end
+#
+# config.model MyModel do
+# edit do
+# field :description, :text do
+# ckeditor do
+# true
+# end
+# end
+# end
+# end
+# end
View
83 files/screen.scss
@@ -0,0 +1,83 @@
+// This import applies a global reset to any page that imports this stylesheet.
+@import "blueprint/reset";
+
+// To configure blueprint, edit the partials/base.sass file.
+@import "partials/base";
+
+// Import all the default blueprint modules so that we can access their mixins.
+@import "blueprint";
+
+// Import the non-default scaffolding module.
+@import "blueprint/scaffolding";
+
+// To generate css equivalent to the blueprint css but with your configuration applied, uncomment:
+// +blueprint
+
+@import "compass/css3/border-radius";
+@import "compass/css3/box-shadow";
+
+// Page layout can be done using mixins applied to your semantic classes and IDs:
+body {
+ @include blueprint-typography(true);
+ @include blueprint-utilities;
+ @include blueprint-debug;
+ @include blueprint-interaction;
+ @include blueprint-scaffolding;
+
+ #container {
+ @include container;
+ }
+
+ header, footer {
+ @include column($blueprint-grid-columns, true);
+ }
+
+ sidebar {
+ // One third of the grid columns, rounding down. With 24 cols, this is 8.
+ $sidebar-columns: floor($blueprint-grid-columns / 3);
+ @include column($sidebar-columns);
+ }
+
+ #content {
+ $content-columns: ceil(2 * $blueprint-grid-columns / 3);
+ @include column($content-columns, true);
+ }
+
+ form {
+ @include blueprint-form;
+
+ fieldset {
+ border: 0;
+
+ label {
+ display: inline-block;
+ width: 120px;
+ }
+ }
+
+ input[type=submit] {
+ background: #222 url(../images/overlay.png) repeat-x;
+ display: inline-block;
+ padding: 5px 10px 6px;
+ color: #fff;
+ text-decoration: none;
+ @include border-radius(6px);
+ @include box-shadow;
+ border: 0px;
+ border-bottom: 1px solid rgba(0,0,0,0.25);
+ position: relative;
+ cursor: pointer
+ }
+
+ input[type=submit]:hover {
+ background-color: #111;
+ color: #fff;
+ }
+
+ ol {
+ padding: 0;
+ margin: 0;
+ list-style-type: none;
+ }
+ }
+}
View
43 files/simple_form.scss
@@ -0,0 +1,43 @@
+.simple_form {
+ label {
+ float: left;
+ width: 100px;
+ text-align: right;
+ margin: 2px 10px;
+ }
+
+ div.input {
+ margin-bottom: 10px;
+ }
+
+ div.boolean, .simple_form input[type='submit'] {
+ margin-left: 120px;
+ }
+
+ div.boolean label, .simple_form label.collection_radio {
+ float: none;
+ margin: 0;
+ }
+
+ label.collection_radio {
+ margin-right: 10px;
+ margin-left: 2px;
+ }
+
+ .error {
+ clear: left;
+ margin-left: 120px;
+ font-size: 12px;
+ color: #D00;
+ display: block;
+ }
+
+ .hint {
+ clear: left;
+ margin-left: 120px;
+ font-size: 12px;
+ color: #555;
+ display: block;
+ font-style: italic;
+ }
+}
View
36 files/spec_helper.js
@@ -0,0 +1,36 @@
+function eventForSelectorHandler(selector, eventType) {
+ var lives = jQuery.data(document, "events").live;
+ for (var i = 0; i < lives.length; i++) {
+ var live = lives[i];
+ if ($(selector).is(live.selector)) {
+ var event = $.Event(eventType);
+ live.handler.call($(selector)[0], event);
+ return event;
+ }
+ }
+}
+
+beforeEach(function() {
+ this.addMatchers({
+ toBeATextInput: function() {
+ return this.actual.is(":text");
+ },
+
+ toBeDefaultPrevented: function() {
+ return this.actual.isDefaultPrevented();
+ },
+
+ toBeHidden: function() {
+ return this.actual.is(":hidden");
+ },
+
+ toBeVisible: function() {
+ return this.actual.is(":visible");
+ },
+
+ toHaveClass: function(className) {
+ return this.actual.hasClass(className);
+ }
+ });
+});
+
View
48 files/spec_helper.rb
@@ -0,0 +1,48 @@
+require 'rubygems'
+require 'spork'
+
+Spork.prefork do
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
+ ENV["RAILS_ENV"] ||= 'test'
+ require File.expand_path("../../config/environment", __FILE__)
+ require 'rspec/rails'
+
+ # Requires supporting ruby files with custom matchers and macros, etc,
+ # in spec/support/ and its subdirectories.
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+
+ RSpec.configure do |config|
+ # == Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ config.mock_with :rspec
+
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+ end
+end
+
+Spork.each_run do
+ # This code will be run each time you run your specs.
+
+end
+
+# --- Instructions ---
+# - Sort through your spec_helper file. Place as much environment loading
+# code that you don't normally modify during development in the
+# Spork.prefork block.
+# - Place the rest under Spork.each_run block
+# - Any code that is left outside of the blocks will be ran during preforking
+# and during each_run!
+# - These instructions should self-destruct in 10 seconds. If they don't,
+# feel free to delete them.
+#
View
4 files/users.rb
@@ -0,0 +1,4 @@
+Factory.define :user do |f|
+ f.email "chuck@norris.com"
+ f.password "chuck123"
+end
View
5 files/watchr.rake
@@ -0,0 +1,5 @@
+desc "Run watchr"
+task :watchr do
+ sh %{bundle exec watchr .watchr}
+end
+
View
19 files/watchr.rb
@@ -0,0 +1,19 @@
+def run_spec(file)
+ unless File.exist?(file)
+ puts "#{file} does not exist"
+ return
+ end
+
+ puts "Running #{file}"
+ system "bundle exec rspec #{file}"
+ puts
+end
+
+watch("spec/.*/*_spec\.rb") do |match|
+ run_spec match[0]
+end
+
+watch("app/(.*/.*)\.rb") do |match|
+ run_spec %{spec/#{match[1]}_spec.rb}
+end
+
View
133 main.rb
@@ -0,0 +1,133 @@
+BASE_URI = "https://github.com/akitaonrails/rails3_template/raw/master/files"
+I18N_BASE_URI = "https://github.com/svenfuchs/rails-i18n/raw/master/rails/locale"
+
+run "rm -Rf .gitignore README public/index.html public/javascripts/* test app/views/layouts/* config/locales/*"
+
+run "wget --no-check-certificate '#{BASE_URI}/Gemfile' -O Gemfile"
+
+run "bundle install"
+
+plugin 'asset_packager', :git => 'git://github.com/sbecker/asset_packager.git'
+
+application <<-GENERATORS
+config.generators do |g|
+ g.test_framework :rspec, :fixture => true, :views => false
+ g.integration_tool :rspec, :fixture => true, :views => true
+ g.fixture_replacement :factory_girl, :dir => "spec/support/factories"
+end
+GENERATORS
+
+generate "rspec:install"
+generate "cucumber:install --capybara --rspec --spork"
+generate "pickle --path --email"
+generate "friendly_id"
+generate "simple_form:install"
+generate "devise:install"
+generate "devise User"
+generate "devise Admin"
+generate "rails_admin:install_admin"
+run "compass init --using blueprint --app rails --css-dir public/stylesheets --sass-dir app/stylesheets"
+
+append_file "config/compass.rb", "require 'lemonade'"
+
+remove_file ".rspec"
+create_file ".rspec", "--colour --drb"
+
+run "rm public/stylesheets/*"
+run "mkdir -p app/cells spec/javascripts spec/javascripts/templates"
+
+run "wget --no-check-certificate 'https://github.com/rails/jquery-ujs/raw/master/src/rails.js' -O public/javascripts/rails.js"
+run "wget --no-check-certificate '#{BASE_URI}/gitignore' -O .gitignore"
+run "wget --no-check-certificate '#{BASE_URI}/screen.scss' -O app/stylesheets/screen.scss"
+run "wget --no-check-certificate '#{BASE_URI}/print.scss' -O app/stylesheets/print.scss"
+run "wget --no-check-certificate '#{BASE_URI}/simple_form.scss' -O app/stylesheets/simple_form.scss"
+run "wget --no-check-certificate '#{BASE_URI}/application.html.erb' -O app/views/layouts/application.html.erb"
+run "wget --no-check-certificate '#{BASE_URI}/factory_girl.rb' -O features/support/factory_girl.rb"
+run "wget --no-check-certificate '#{BASE_URI}/devise_steps.rb' -O features/step_definitions/devise_steps.rb"
+run "wget --no-check-certificate '#{BASE_URI}/users.rb' -O spec/support/factories/users.rb"
+run "wget --no-check-certificate '#{BASE_URI}/build.rake' -O lib/tasks/build.rake"
+run "wget --no-check-certificate '#{BASE_URI}/build.sh' -O build.sh"
+run "wget --no-check-certificate '#{BASE_URI}/bootstrap.rake' -O lib/tasks/bootstrap.rake"
+run "wget --no-check-certificate '#{BASE_URI}/overlay.png' -O public/images/overlay.png"
+run "wget --no-check-certificate '#{BASE_URI}/newrelic.yml' -O config/newrelic.yml"
+run "wget --no-check-certificate '#{BASE_URI}/rails_admin.rb' -O config/initializers/rails_admin.rb"
+run "wget --no-check-certificate '#{BASE_URI}/htaccess' -O public/.htaccess"
+run "wget --no-check-certificate '#{BASE_URI}/asset_packages.yml' -O config/asset_packages.yml"
+run "wget --no-check-certificate '#{BASE_URI}/evergreen.rb' -O config/evergreen.rb"
+run "wget --no-check-certificate '#{BASE_URI}/grid.png' -O public/images/grid.png"
+run "wget --no-check-certificate '#{BASE_URI}/html5.js' -O public/javascripts/html5.js"
+run "wget --no-check-certificate '#{BASE_URI}/spec_helper.rb' -O spec/spec_helper.rb"
+run "wget --no-check-certificate '#{BASE_URI}/application.html' -O spec/javascripts/templates/application.html"
+run "wget --no-check-certificate '#{BASE_URI}/application_spec.js' -O spec/javascripts/application_spec.js"
+run "wget --no-check-certificate '#{BASE_URI}/spec_helper.js' -O spec/javascripts/spec_helper.js"
+run "wget --no-check-certificate '#{BASE_URI}/watchr.rb' -O .watchr"
+run "wget --no-check-certificate '#{BASE_URI}/watchr.rake' -O lib/tasks/watchr.rake"
+run "wget --no-check-certificate '#{I18N_BASE_URI}/en-US.yml' -O config/locales/en.yml"
+run "wget --no-check-certificate '#{I18N_BASE_URI}/pt-BR.yml' -O config/locales/pt-BR.yml"
+run "wget http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js -O public/javascripts/jquery.js"
+run "wget http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js -O public/javascripts/jquery-ui.js"
+
+run "chmod u+x build.sh"
+
+append_file 'Rakefile', <<-METRIC_FU
+
+MetricFu::Configuration.run do |config|
+ config.rcov[:rcov_opts] << "-Ispec"
+end rescue nil
+METRIC_FU
+
+append_file 'config/environment.rb', <<-ASSET_PACKAGER
+
+ Synthesis::AssetPackage.merge_environments = %w(staging production)
+ASSET_PACKAGER
+
+remove_file 'README'
+create_file 'README', <<-README
+== Rails 3 Application
+
+Install Ruby 1.8.7 or Ruby Enterprise Edition (http://www.rubyenterpriseedition.com).
+
+To run tests open a Terminal and run:
+
+ spork
+
+Now open a new Terminal and run:
+
+ rake watchr
+
+If you want to run the entire Test Suite run:
+
+ rspec spec
+
+With Thin, instead of 'rails server', you can start the server like this:
+
+ thin start
+
+README
+
+git :init
+git :add => '.'
+git :add => 'public/javascripts/rails.js --force'
+git :commit => '-am "Initial commit"'
+
+puts <<-MSG
+
+SUCCESS!
+
+Read the README file and do not forget to change a few things.
+
+== Spork:
+
+ Ensure you enable class reload within the test environment by changing the
+ config/environments/test.rb to have:
+
+ config.cache_classes = false
+
+== Devise:
+
+ Ensure you have defined root_url to *something* in your config/routes.rb.
+ For example:
+
+ root :to => "home#index"
+
+MSG
Please sign in to comment.
Something went wrong with that request. Please try again.