From e8af9b9847dd977cd2b90cadffec1b4ad3a1ef42 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Thu, 19 May 2011 13:28:54 -0400 Subject: [PATCH] Initial Commit. v1.0 --- .gitignore | 16 +++ .rvmrc | 1 + Gemfile | 9 ++ Gemfile.lock | 134 ++++++++++++++++++ LICENSE | 21 +++ README.textile | 3 + Rakefile | 30 ++++ coffeebeans.gemspec | 33 +++++ lib/coffeebeans.rb | 32 +++++ spec/dummy/.gitignore | 4 + spec/dummy/Gemfile | 32 +++++ spec/dummy/Gemfile.lock | 86 +++++++++++ .../app/controllers/application_controller.rb | 3 + .../app/controllers/drinks_controller.rb | 8 ++ spec/dummy/app/helpers/application_helper.rb | 2 + spec/dummy/app/views/drinks/index.html.erb | 9 ++ spec/dummy/app/views/drinks/index.js.coffee | 1 + .../app/views/layouts/application.html.erb | 1 + spec/dummy/config.ru | 4 + spec/dummy/config/application.rb | 47 ++++++ spec/dummy/config/boot.rb | 6 + spec/dummy/config/environment.rb | 5 + spec/dummy/config/environments/development.rb | 26 ++++ spec/dummy/config/environments/production.rb | 49 +++++++ spec/dummy/config/environments/test.rb | 35 +++++ .../initializers/backtrace_silencers.rb | 7 + spec/dummy/config/initializers/inflections.rb | 10 ++ spec/dummy/config/initializers/mime_types.rb | 5 + .../dummy/config/initializers/secret_token.rb | 7 + .../config/initializers/session_store.rb | 8 ++ spec/dummy/config/locales/en.yml | 5 + spec/dummy/config/routes.rb | 59 ++++++++ spec/dummy/db/seeds.rb | 7 + spec/dummy/lib/tasks/.gitkeep | 0 spec/dummy/script/rails | 6 + spec/dummy/vendor/plugins/.gitkeep | 0 spec/request/coffee_script_spec.rb | 18 +++ spec/spec_helper.rb | 38 +++++ 38 files changed, 767 insertions(+) create mode 100644 .gitignore create mode 100644 .rvmrc create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 LICENSE create mode 100644 README.textile create mode 100644 Rakefile create mode 100644 coffeebeans.gemspec create mode 100644 lib/coffeebeans.rb create mode 100644 spec/dummy/.gitignore create mode 100644 spec/dummy/Gemfile create mode 100644 spec/dummy/Gemfile.lock create mode 100644 spec/dummy/app/controllers/application_controller.rb create mode 100644 spec/dummy/app/controllers/drinks_controller.rb create mode 100644 spec/dummy/app/helpers/application_helper.rb create mode 100644 spec/dummy/app/views/drinks/index.html.erb create mode 100644 spec/dummy/app/views/drinks/index.js.coffee create mode 100644 spec/dummy/app/views/layouts/application.html.erb create mode 100644 spec/dummy/config.ru create mode 100644 spec/dummy/config/application.rb create mode 100644 spec/dummy/config/boot.rb create mode 100644 spec/dummy/config/environment.rb create mode 100644 spec/dummy/config/environments/development.rb create mode 100644 spec/dummy/config/environments/production.rb create mode 100644 spec/dummy/config/environments/test.rb create mode 100644 spec/dummy/config/initializers/backtrace_silencers.rb create mode 100644 spec/dummy/config/initializers/inflections.rb create mode 100644 spec/dummy/config/initializers/mime_types.rb create mode 100644 spec/dummy/config/initializers/secret_token.rb create mode 100644 spec/dummy/config/initializers/session_store.rb create mode 100644 spec/dummy/config/locales/en.yml create mode 100644 spec/dummy/config/routes.rb create mode 100644 spec/dummy/db/seeds.rb create mode 100644 spec/dummy/lib/tasks/.gitkeep create mode 100755 spec/dummy/script/rails create mode 100644 spec/dummy/vendor/plugins/.gitkeep create mode 100644 spec/request/coffee_script_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff3d947 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +*.log +.DS_Store +doc +tmp +pkg +*.gem +*.pid +coverage +coverage.data +build/* +*.pbxuser +*.mode1v3 +.svn +profile +.console_history +.sass-cache/* diff --git a/.rvmrc b/.rvmrc new file mode 100644 index 0000000..2c99cb2 --- /dev/null +++ b/.rvmrc @@ -0,0 +1 @@ +rvm use ruby-1.9.2@coffeescript_rails diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..417f97a --- /dev/null +++ b/Gemfile @@ -0,0 +1,9 @@ +source 'http://rubygems.org' + +gem 'rake' +gem 'rails' +gem "rspec-rails", "2.6.0" +gem 'gemstub', ">= 2.0.0" +gem 'coffee-script' +gem 'sqlite3' +gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..42fdb87 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,134 @@ +GIT + remote: git://github.com/jnicklas/capybara.git + revision: 4c3ce57430a1b07e534450dca8a2e551b5363539 + specs: + capybara (1.0.0.beta1) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + selenium-webdriver (~> 0.2.0) + xpath (~> 0.1.4) + +GEM + remote: http://rubygems.org/ + specs: + abstract (1.0.0) + actionmailer (3.0.7) + actionpack (= 3.0.7) + mail (~> 2.2.15) + actionpack (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + builder (~> 2.1.2) + erubis (~> 2.6.6) + i18n (~> 0.5.0) + rack (~> 1.2.1) + rack-mount (~> 0.6.14) + rack-test (~> 0.5.7) + tzinfo (~> 0.3.23) + activemodel (3.0.7) + activesupport (= 3.0.7) + builder (~> 2.1.2) + i18n (~> 0.5.0) + activerecord (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + arel (~> 2.0.2) + tzinfo (~> 0.3.23) + activeresource (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + activesupport (3.0.7) + arel (2.0.10) + builder (2.1.2) + childprocess (0.1.9) + ffi (~> 1.0.6) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.1.0) + diff-lcs (1.1.2) + erubis (2.6.6) + abstract (>= 1.0.0) + execjs (1.0.0) + multi_json (~> 1.0) + ffi (1.0.8) + gemstub (2.0.3) + activesupport (>= 3.0.0) + genosaurus + mark_facets + rspec (>= 2.0.0) + genosaurus (1.2.4) + erubis + hashie (1.0.0) + i18n (0.5.0) + json_pure (1.5.1) + mail (2.2.19) + activesupport (>= 2.3.6) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mark_facets (0.2.0) + hashie + mime-types (1.16) + multi_json (1.0.2) + nokogiri (1.4.4) + polyglot (0.3.1) + rack (1.2.2) + rack-mount (0.6.14) + rack (>= 1.0.0) + rack-test (0.5.7) + rack (>= 1.0) + rails (3.0.7) + actionmailer (= 3.0.7) + actionpack (= 3.0.7) + activerecord (= 3.0.7) + activeresource (= 3.0.7) + activesupport (= 3.0.7) + bundler (~> 1.0) + railties (= 3.0.7) + railties (3.0.7) + actionpack (= 3.0.7) + activesupport (= 3.0.7) + rake (>= 0.8.7) + thor (~> 0.14.4) + rake (0.8.7) + rspec (2.6.0) + rspec-core (~> 2.6.0) + rspec-expectations (~> 2.6.0) + rspec-mocks (~> 2.6.0) + rspec-core (2.6.0) + rspec-expectations (2.6.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.6.0) + rspec-rails (2.6.0) + actionpack (~> 3.0) + activesupport (~> 3.0) + railties (~> 3.0) + rspec (~> 2.6.0) + rubyzip (0.9.4) + selenium-webdriver (0.2.0) + childprocess (>= 0.1.7) + ffi (>= 1.0.7) + json_pure + rubyzip + sqlite3 (1.3.3) + thor (0.14.6) + treetop (1.4.9) + polyglot (>= 0.3.1) + tzinfo (0.3.27) + xpath (0.1.4) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + capybara! + coffee-script + gemstub (>= 2.0.0) + rails + rake + rspec-rails (= 2.6.0) + sqlite3 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f55b636 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2011 markbates + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.textile b/README.textile new file mode 100644 index 0000000..fee8fde --- /dev/null +++ b/README.textile @@ -0,0 +1,3 @@ +README +======================================================================== +coffeescript_rails was developed by: markbates diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..157aeea --- /dev/null +++ b/Rakefile @@ -0,0 +1,30 @@ +require 'rubygems' + +# Set up gems listed in the Gemfile. +gemfile = File.expand_path('../Gemfile', __FILE__) +begin + ENV['BUNDLE_GEMFILE'] = gemfile + require 'bundler' + Bundler.setup +rescue Bundler::GemNotFound => e + STDERR.puts e.message + STDERR.puts "Try running `bundle install`." + exit! +end if File.exist?(gemfile) + +Bundler.require + +Gemstub.test_framework = :rspec + +Gemstub.gem_spec do |s| + s.version = '1.0.0' + # s.rubyforge_project = 'coffeescript_rails' + s.add_dependency('coffee-script') + s.add_dependency('actionpack', '>= 3.0.0') + s.email = 'mark+github@markbates.com' + # s.homepage = '' +end + +Gemstub.rdoc do |rd| + rd.title = 'coffeebeans' +end diff --git a/coffeebeans.gemspec b/coffeebeans.gemspec new file mode 100644 index 0000000..1a14be5 --- /dev/null +++ b/coffeebeans.gemspec @@ -0,0 +1,33 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{coffeebeans} + s.version = "1.0.0.20110519132850" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = [%q{markbates}] + s.date = %q{2011-05-19} + s.description = %q{coffeebeans was developed by: markbates} + s.email = %q{mark+github@markbates.com} + s.extra_rdoc_files = [%q{LICENSE}] + s.files = [%q{lib/coffeebeans.rb}, %q{LICENSE}] + s.homepage = %q{} + s.require_paths = [%q{lib}] + s.rubygems_version = %q{1.8.2} + s.summary = %q{coffeebeans} + + if s.respond_to? :specification_version then + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, [">= 3.0.0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 3.0.0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 3.0.0"]) + end +end diff --git a/lib/coffeebeans.rb b/lib/coffeebeans.rb new file mode 100644 index 0000000..3e868c4 --- /dev/null +++ b/lib/coffeebeans.rb @@ -0,0 +1,32 @@ +require 'coffee-script' + +module CoffeeBeans + module Handlers + module CoffeeScript + def self.erb_handler + @@erb_handler ||= ActionView::Template.registered_template_handler(:erb) + end + + def self.call(template) + compiled_source = erb_handler.call(template) + "::CoffeeScript.compile(begin;#{compiled_source};end)" + end + end + end + + module ViewHelpers + + def coffee_script_tag(&block) + content_tag(:script, coffee_script(&block), :type => 'text/javascript') + end + + def coffee_script(&block) + ::CoffeeScript.compile(capture(&block)) + end + + end + +end + +ActionView::Template.register_template_handler :coffee, CoffeeBeans::Handlers::CoffeeScript +ActionView::Base.send :include, CoffeeBeans::ViewHelpers \ No newline at end of file diff --git a/spec/dummy/.gitignore b/spec/dummy/.gitignore new file mode 100644 index 0000000..f0fa30c --- /dev/null +++ b/spec/dummy/.gitignore @@ -0,0 +1,4 @@ +.bundle +db/*.sqlite3 +log/*.log +tmp/ diff --git a/spec/dummy/Gemfile b/spec/dummy/Gemfile new file mode 100644 index 0000000..9a03583 --- /dev/null +++ b/spec/dummy/Gemfile @@ -0,0 +1,32 @@ +source 'http://rubygems.org' + +gem 'rails', '3.0.7' + +gem 'coffeescript_rails', :path => '~/gemdev/coffeescript_rails' + +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + + +# Use unicorn as the web server +# gem 'unicorn' + +# Deploy with Capistrano +# gem 'capistrano' + +# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) +# gem 'ruby-debug' +# gem 'ruby-debug19', :require => 'ruby-debug' + +# Bundle the extra gems: +# gem 'bj' +# gem 'nokogiri' +# gem 'sqlite3-ruby', :require => 'sqlite3' +# gem 'aws-s3', :require => 'aws/s3' + +# Bundle gems for the local environment. Make sure to +# put test-only gems in this group so their generators +# and rake tasks are available in development mode: +# group :development, :test do +# gem 'webrat' +# end diff --git a/spec/dummy/Gemfile.lock b/spec/dummy/Gemfile.lock new file mode 100644 index 0000000..a449d97 --- /dev/null +++ b/spec/dummy/Gemfile.lock @@ -0,0 +1,86 @@ +PATH + remote: ~/gemdev/coffeescript_rails + specs: + coffeescript_rails (0.0.1.20110519120600) + actionpack (>= 3.0.0) + coffee-script + +GEM + remote: http://rubygems.org/ + specs: + abstract (1.0.0) + actionmailer (3.0.7) + actionpack (= 3.0.7) + mail (~> 2.2.15) + actionpack (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + builder (~> 2.1.2) + erubis (~> 2.6.6) + i18n (~> 0.5.0) + rack (~> 1.2.1) + rack-mount (~> 0.6.14) + rack-test (~> 0.5.7) + tzinfo (~> 0.3.23) + activemodel (3.0.7) + activesupport (= 3.0.7) + builder (~> 2.1.2) + i18n (~> 0.5.0) + activerecord (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + arel (~> 2.0.2) + tzinfo (~> 0.3.23) + activeresource (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + activesupport (3.0.7) + arel (2.0.10) + builder (2.1.2) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.1.0) + erubis (2.6.6) + abstract (>= 1.0.0) + execjs (1.0.0) + multi_json (~> 1.0) + i18n (0.5.0) + mail (2.2.19) + activesupport (>= 2.3.6) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.16) + multi_json (1.0.2) + polyglot (0.3.1) + rack (1.2.2) + rack-mount (0.6.14) + rack (>= 1.0.0) + rack-test (0.5.7) + rack (>= 1.0) + rails (3.0.7) + actionmailer (= 3.0.7) + actionpack (= 3.0.7) + activerecord (= 3.0.7) + activeresource (= 3.0.7) + activesupport (= 3.0.7) + bundler (~> 1.0) + railties (= 3.0.7) + railties (3.0.7) + actionpack (= 3.0.7) + activesupport (= 3.0.7) + rake (>= 0.8.7) + thor (~> 0.14.4) + rake (0.8.7) + thor (0.14.6) + treetop (1.4.9) + polyglot (>= 0.3.1) + tzinfo (0.3.27) + +PLATFORMS + ruby + +DEPENDENCIES + coffeescript_rails! + rails (= 3.0.7) diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb new file mode 100644 index 0000000..e8065d9 --- /dev/null +++ b/spec/dummy/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery +end diff --git a/spec/dummy/app/controllers/drinks_controller.rb b/spec/dummy/app/controllers/drinks_controller.rb new file mode 100644 index 0000000..bbc306f --- /dev/null +++ b/spec/dummy/app/controllers/drinks_controller.rb @@ -0,0 +1,8 @@ +class DrinksController < ApplicationController + respond_to :js, :html + + def index + render(:action => 'index', :layout => false) + end + +end \ No newline at end of file diff --git a/spec/dummy/app/helpers/application_helper.rb b/spec/dummy/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/spec/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/spec/dummy/app/views/drinks/index.html.erb b/spec/dummy/app/views/drinks/index.html.erb new file mode 100644 index 0000000..76f0d62 --- /dev/null +++ b/spec/dummy/app/views/drinks/index.html.erb @@ -0,0 +1,9 @@ +<%= coffee_script_tag do %> + alert 'coffee script is awesome!' +<% end %> + + \ No newline at end of file diff --git a/spec/dummy/app/views/drinks/index.js.coffee b/spec/dummy/app/views/drinks/index.js.coffee new file mode 100644 index 0000000..c50706c --- /dev/null +++ b/spec/dummy/app/views/drinks/index.js.coffee @@ -0,0 +1 @@ +alert 'i like coffee!' \ No newline at end of file diff --git a/spec/dummy/app/views/layouts/application.html.erb b/spec/dummy/app/views/layouts/application.html.erb new file mode 100644 index 0000000..cd9bb66 --- /dev/null +++ b/spec/dummy/app/views/layouts/application.html.erb @@ -0,0 +1 @@ +<%= yield %> \ No newline at end of file diff --git a/spec/dummy/config.ru b/spec/dummy/config.ru new file mode 100644 index 0000000..1989ed8 --- /dev/null +++ b/spec/dummy/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Dummy::Application diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb new file mode 100644 index 0000000..3296d6f --- /dev/null +++ b/spec/dummy/config/application.rb @@ -0,0 +1,47 @@ +require File.expand_path('../boot', __FILE__) + +# Pick the frameworks you want: +# require "active_record/railtie" +require "action_controller/railtie" +require "action_mailer/railtie" +require "active_resource/railtie" +require "rails/test_unit/railtie" + +# If you have a Gemfile, require the gems listed there, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(:default, Rails.env) if defined?(Bundler) + +module Dummy + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # JavaScript files you want as :defaults (application.js is always included). + config.action_view.javascript_expansions[:defaults] = %w() + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + end +end diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb new file mode 100644 index 0000000..4489e58 --- /dev/null +++ b/spec/dummy/config/boot.rb @@ -0,0 +1,6 @@ +require 'rubygems' + +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/spec/dummy/config/environment.rb b/spec/dummy/config/environment.rb new file mode 100644 index 0000000..3da5eb9 --- /dev/null +++ b/spec/dummy/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Dummy::Application.initialize! diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb new file mode 100644 index 0000000..d6a7998 --- /dev/null +++ b/spec/dummy/config/environments/development.rb @@ -0,0 +1,26 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the webserver when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_view.debug_rjs = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin +end + diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb new file mode 100644 index 0000000..659e583 --- /dev/null +++ b/spec/dummy/config/environments/production.rb @@ -0,0 +1,49 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The production environment is meant for finished, "live" apps. + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Specifies the header that your server uses for sending files + config.action_dispatch.x_sendfile_header = "X-Sendfile" + + # For nginx: + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' + + # If you have no front-end server that supports something like X-Sendfile, + # just comment this out and Rails will serve the files + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Use a different logger for distributed setups + # config.logger = SyslogLogger.new + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Disable Rails's static asset server + # In production, Apache or nginx will already do this + config.serve_static_assets = false + + # Enable serving of images, stylesheets, and javascripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify +end diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb new file mode 100644 index 0000000..768d8f0 --- /dev/null +++ b/spec/dummy/config/environments/test.rb @@ -0,0 +1,35 @@ +Dummy::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Use SQL instead of Active Record's schema dumper when creating the test database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end diff --git a/spec/dummy/config/initializers/backtrace_silencers.rb b/spec/dummy/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/spec/dummy/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/spec/dummy/config/initializers/inflections.rb b/spec/dummy/config/initializers/inflections.rb new file mode 100644 index 0000000..9e8b013 --- /dev/null +++ b/spec/dummy/config/initializers/inflections.rb @@ -0,0 +1,10 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end diff --git a/spec/dummy/config/initializers/mime_types.rb b/spec/dummy/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/spec/dummy/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/spec/dummy/config/initializers/secret_token.rb b/spec/dummy/config/initializers/secret_token.rb new file mode 100644 index 0000000..5bfeb02 --- /dev/null +++ b/spec/dummy/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +Dummy::Application.config.secret_token = '0d98c544fe5edc4a3e519ae3a1b44c4862db73da445e5993b4b6c7b4b6d63d7aff5dcee58c6adba4203565e7d4d52e1cc132ffd8791933d2354692bb25780ac5' diff --git a/spec/dummy/config/initializers/session_store.rb b/spec/dummy/config/initializers/session_store.rb new file mode 100644 index 0000000..aa2f512 --- /dev/null +++ b/spec/dummy/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session' + +# Use the database for sessions instead of the cookie-based default, +# which shouldn't be used to store highly confidential information +# (create the session table with "rails generate session_migration") +# Dummy::Application.config.session_store :active_record_store diff --git a/spec/dummy/config/locales/en.yml b/spec/dummy/config/locales/en.yml new file mode 100644 index 0000000..a747bfa --- /dev/null +++ b/spec/dummy/config/locales/en.yml @@ -0,0 +1,5 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Hello world" diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb new file mode 100644 index 0000000..7db2ab9 --- /dev/null +++ b/spec/dummy/config/routes.rb @@ -0,0 +1,59 @@ +Dummy::Application.routes.draw do + match '/drinks(.:format)', :to => 'drinks#index', :as => :drinks + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + root :to => "drinks#index" + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' +end diff --git a/spec/dummy/db/seeds.rb b/spec/dummy/db/seeds.rb new file mode 100644 index 0000000..664d8c7 --- /dev/null +++ b/spec/dummy/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) +# Mayor.create(:name => 'Daley', :city => cities.first) diff --git a/spec/dummy/lib/tasks/.gitkeep b/spec/dummy/lib/tasks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/script/rails b/spec/dummy/script/rails new file mode 100755 index 0000000..f8da2cf --- /dev/null +++ b/spec/dummy/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/spec/dummy/vendor/plugins/.gitkeep b/spec/dummy/vendor/plugins/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spec/request/coffee_script_spec.rb b/spec/request/coffee_script_spec.rb new file mode 100644 index 0000000..4f6a360 --- /dev/null +++ b/spec/request/coffee_script_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +feature "CoffeeScript" do + + scenario "should render a .js.coffee file." do + visit drinks_url(:format => 'js') + + page.should have_content("(function() { alert('i like coffee!'); }).call(this);") + end + + scenario "should render a block with helper tags" do + visit drinks_url + + page.body.to_s.should == "\n\n\n\n\n" + + end + +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..a363b30 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,38 @@ +ENV["RAILS_ENV"] = "test" + +require File.expand_path("../dummy/config/environment.rb", __FILE__) + +require 'rubygems' +require 'rspec/rails' + +ActionMailer::Base.delivery_method = :test +ActionMailer::Base.perform_deliveries = true +ActionMailer::Base.default_url_options[:host] = "test.com" + +Rails.backtrace_cleaner.remove_silencers! + +require File.join(File.dirname(__FILE__), '..', 'lib', 'coffeebeans') + +require "capybara/rails" +# Capybara.default_driver = :rack_test +# Capybara.default_selector = :css + +RSpec.configure do |config| + + config.before(:all) do + + end + + config.after(:all) do + + end + + config.before(:each) do + + end + + config.after(:each) do + + end + +end