coffee-rails-3.2.2/0000755000175000017500000000000011772726204014277 5ustar terceiroterceirocoffee-rails-3.2.2/coffee-rails.gemspec0000644000175000017500000000153511772726204020207 0ustar terceiroterceiro$:.push File.expand_path("../lib", __FILE__) require "coffee/rails/version" Gem::Specification.new do |s| s.name = "coffee-rails" s.version = Coffee::Rails::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Santiago Pastorino"] s.email = ["santiago@wyeworks.com"] s.homepage = "" s.summary = %q{Coffee Script adapter for the Rails asset pipeline.} s.description = %q{Coffee Script adapter for the Rails asset pipeline.} s.rubyforge_project = "coffee-rails" s.add_runtime_dependency 'coffee-script', '>= 2.2.0' s.add_runtime_dependency 'railties', '~> 3.2.0' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] end coffee-rails-3.2.2/README.markdown0000644000175000017500000000145611772726204017006 0ustar terceiroterceiro# Coffee-Rails Coffee Script adapter for the Rails asset pipeline. Also adds support to use CoffeeScript to respond to JavaScript requests (use .js.coffee views). ## Installation Since Rails 3.1 Coffee-Rails is included in the default Gemfile when you create a new application. If you are upgrading to Rails 3.1 you must add the coffee-rails to your Gemfile: gem 'coffee-rails' If you are precompiling your assets (with rake assets:precompile) before run your application in production, you might want add it to the assets group to prevent the gem being required in the production environment. group :assets do gem 'coffee-rails' end ## Running tests $ bundle install $ bundle exec rake test If you need to test against local gems, use Bundler's gem :path option in the Gemfile. coffee-rails-3.2.2/test/0000755000175000017500000000000011772726204015256 5ustar terceiroterceirocoffee-rails-3.2.2/test/scaffold_generator_test.rb0000644000175000017500000000106011772726204022466 0ustar terceiroterceirorequire 'test_helper' require 'rails/generators/rails/scaffold/scaffold_generator' require 'rails/generators/coffee/assets/assets_generator' class ScaffoldGeneratorTest < Rails::Generators::TestCase tests Rails::Generators::ScaffoldGenerator destination File.expand_path("../tmp", __FILE__) setup do prepare_destination copy_routes end def test_assets run_generator %w(posts --javascript-engine=coffee --orm=false) assert_no_file "app/assets/javascripts/posts.js" assert_file "app/assets/javascripts/posts.js.coffee" end end coffee-rails-3.2.2/test/assets_test.rb0000644000175000017500000000200411772726204020140 0ustar terceiroterceirorequire 'test_helper' require 'coffee-rails' class AssetsTest < ActiveSupport::TestCase def setup require "rails" require "action_controller/railtie" require "sprockets/railtie" @app = Class.new(Rails::Application) @app.config.active_support.deprecation = :stderr @app.config.assets.enabled = true @app.config.assets.cache_store = [ :file_store, "#{tmp_path}/cache" ] @app.paths["log"] = "#{tmp_path}/log/test.log" @app.initialize! end def teardown FileUtils.rm_rf "#{tmp_path}/cache" FileUtils.rm_rf "#{tmp_path}/log" File.delete "#{tmp_path}/coffee-script.js" end test "coffee-script.js is included in Sprockets environment" do @app.assets["coffee-script"].write_to("#{tmp_path}/coffee-script.js") assert_match "/lib/assets/javascripts/coffee-script.js.erb", @app.assets["coffee-script"].pathname.to_s assert_match "this.CoffeeScript", File.open("#{tmp_path}/coffee-script.js").read end def tmp_path "#{File.dirname(__FILE__)}/tmp" end end coffee-rails-3.2.2/test/support/0000755000175000017500000000000011772726204016772 5ustar terceiroterceirocoffee-rails-3.2.2/test/support/routes.rb0000644000175000017500000000002411772726204020634 0ustar terceiroterceiro# routes dummy file coffee-rails-3.2.2/test/support/site/0000755000175000017500000000000011772726204017736 5ustar terceiroterceirocoffee-rails-3.2.2/test/support/site/index.js.coffee0000644000175000017500000000002411772726204022625 0ustar terceiroterceiroalert 'hello world' coffee-rails-3.2.2/test/controller_generator_test.rb0000644000175000017500000000107011772726204023071 0ustar terceiroterceirorequire 'test_helper' require 'rails/generators/rails/controller/controller_generator' require 'rails/generators/coffee/assets/assets_generator' class ControllerGeneratorTest < Rails::Generators::TestCase tests Rails::Generators::ControllerGenerator destination File.expand_path("../tmp", __FILE__) setup do prepare_destination copy_routes end def test_assets run_generator %w(posts --javascript-engine=coffee --orm=false) assert_no_file "app/assets/javascripts/posts.js" assert_file "app/assets/javascripts/posts.js.coffee" end end coffee-rails-3.2.2/test/test_helper.rb0000644000175000017500000000055111772726204020122 0ustar terceiroterceiro# Configure Rails Envinronment ENV["RAILS_ENV"] = "test" require 'rails' require "rails/test_help" # For generators require 'rails/generators/test_case' def copy_routes routes = File.expand_path("../support/routes.rb", __FILE__) destination = File.join(destination_root, "config") FileUtils.mkdir_p(destination) FileUtils.cp routes, destination end coffee-rails-3.2.2/test/assets_generator_test.rb0000644000175000017500000000065411772726204022217 0ustar terceiroterceirorequire 'test_helper' require 'rails/generators/coffee/assets/assets_generator' class AssetGeneratorTest < Rails::Generators::TestCase tests Coffee::Generators::AssetsGenerator destination File.expand_path("../tmp", __FILE__) setup :prepare_destination def test_assets run_generator %w(posts) assert_no_file "app/assets/javascripts/posts.js" assert_file "app/assets/javascripts/posts.js.coffee" end end coffee-rails-3.2.2/test/template_handler_test.rb0000644000175000017500000000104311772726204022150 0ustar terceiroterceirorequire 'test_helper' require 'action_controller' require 'coffee-rails' class SiteController < ActionController::Base self.view_paths = File.expand_path("../support", __FILE__) end DummyApp = ActionDispatch::Routing::RouteSet.new DummyApp.draw do get "site/index" end class TemplateHandlerTest < ActiveSupport::TestCase include Rack::Test::Methods def app @app ||= DummyApp end test "coffee views are served as javascript" do get "/site/index.js" assert_match "alert('hello world');\n", last_response.body end end coffee-rails-3.2.2/Gemfile0000644000175000017500000000041311772726204015570 0ustar terceiroterceirosource "http://rubygems.org" # Specify your gem's dependencies in coffee-rails.gemspec gemspec gem "rails", :git => "git://github.com/rails/rails" # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) # gem 'ruby-debug' # gem 'ruby-debug19' coffee-rails-3.2.2/.travis.yml0000644000175000017500000000047611772726204016417 0ustar terceiroterceirorvm: - 1.8.7 - 1.9.2 - 1.9.3 - ree - jruby - rbx script: bundle exec rake test notifications: email: false campfire: secure: "CGWvthGkBKNnTnk9YSmf9AXKoiRI33fCl5D3jU4nx3cOPu6kv2R9nMjt9EAo\nOuS4Q85qNSf4VNQ2cUPNiNYSWQ+XiTfivKvDUw/QW9r1FejYyeWarMsSBWA+\n0fADjF1M2dkDIVLgYPfwoXEv7l+j654F1KLKB69F0F/netwP9CQ=" coffee-rails-3.2.2/MIT-LICENSE0000644000175000017500000000204711772726204015736 0ustar terceiroterceiroCopyright (c) 2011 Santiago Pastorino 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. coffee-rails-3.2.2/.gitignore0000644000175000017500000000002611772726204016265 0ustar terceiroterceirotest/tmp Gemfile.lock coffee-rails-3.2.2/Rakefile0000644000175000017500000000031611772726204015744 0ustar terceiroterceirorequire 'bundler' Bundler::GemHelper.install_tasks require 'rake/testtask' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.libs << 'test' t.pattern = 'test/**/*_test.rb' t.verbose = false end coffee-rails-3.2.2/metadata.yml0000644000175000017500000000525411772726204016610 0ustar terceiroterceiro--- !ruby/object:Gem::Specification name: coffee-rails version: !ruby/object:Gem::Version hash: 11 prerelease: false segments: - 3 - 2 - 2 version: 3.2.2 platform: ruby authors: - Santiago Pastorino autorequire: bindir: bin cert_chain: [] date: 2012-01-26 00:00:00 -08:00 default_executable: dependencies: - !ruby/object:Gem::Dependency name: coffee-script prerelease: false requirement: &id001 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 7 segments: - 2 - 2 - 0 version: 2.2.0 type: :runtime version_requirements: *id001 - !ruby/object:Gem::Dependency name: railties prerelease: false requirement: &id002 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version hash: 15 segments: - 3 - 2 - 0 version: 3.2.0 type: :runtime version_requirements: *id002 description: Coffee Script adapter for the Rails asset pipeline. email: - santiago@wyeworks.com executables: [] extensions: [] extra_rdoc_files: [] files: - .gitignore - .travis.yml - Gemfile - MIT-LICENSE - README.markdown - Rakefile - coffee-rails.gemspec - lib/assets/javascripts/coffee-script.js.erb - lib/coffee-rails.rb - lib/coffee/rails/engine.rb - lib/coffee/rails/template_handler.rb - lib/coffee/rails/version.rb - lib/rails/generators/coffee/assets/assets_generator.rb - lib/rails/generators/coffee/assets/templates/javascript.js.coffee - test/assets_generator_test.rb - test/assets_test.rb - test/controller_generator_test.rb - test/scaffold_generator_test.rb - test/support/routes.rb - test/support/site/index.js.coffee - test/template_handler_test.rb - test/test_helper.rb has_rdoc: true homepage: "" licenses: [] post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 3 segments: - 0 version: "0" required_rubygems_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 3 segments: - 0 version: "0" requirements: [] rubyforge_project: coffee-rails rubygems_version: 1.3.7 signing_key: specification_version: 3 summary: Coffee Script adapter for the Rails asset pipeline. test_files: - test/assets_generator_test.rb - test/assets_test.rb - test/controller_generator_test.rb - test/scaffold_generator_test.rb - test/support/routes.rb - test/support/site/index.js.coffee - test/template_handler_test.rb - test/test_helper.rb coffee-rails-3.2.2/lib/0000755000175000017500000000000011772726204015045 5ustar terceiroterceirocoffee-rails-3.2.2/lib/assets/0000755000175000017500000000000011772726204016347 5ustar terceiroterceirocoffee-rails-3.2.2/lib/assets/javascripts/0000755000175000017500000000000011772726204020700 5ustar terceiroterceirocoffee-rails-3.2.2/lib/assets/javascripts/coffee-script.js.erb0000644000175000017500000000004511772726204024535 0ustar terceiroterceiro<%= CoffeeScript::Source.contents %> coffee-rails-3.2.2/lib/rails/0000755000175000017500000000000011772726204016157 5ustar terceiroterceirocoffee-rails-3.2.2/lib/rails/generators/0000755000175000017500000000000011772726204020330 5ustar terceiroterceirocoffee-rails-3.2.2/lib/rails/generators/coffee/0000755000175000017500000000000011772726204021557 5ustar terceiroterceirocoffee-rails-3.2.2/lib/rails/generators/coffee/assets/0000755000175000017500000000000011772726204023061 5ustar terceiroterceirocoffee-rails-3.2.2/lib/rails/generators/coffee/assets/assets_generator.rb0000644000175000017500000000054711772726204026764 0ustar terceiroterceirorequire "rails/generators/named_base" module Coffee module Generators class AssetsGenerator < ::Rails::Generators::NamedBase source_root File.expand_path("../templates", __FILE__) def copy_coffee template "javascript.js.coffee", File.join('app/assets/javascripts', class_path, "#{file_name}.js.coffee") end end end end coffee-rails-3.2.2/lib/rails/generators/coffee/assets/templates/0000755000175000017500000000000011772726204025057 5ustar terceiroterceirocoffee-rails-3.2.2/lib/rails/generators/coffee/assets/templates/javascript.js.coffee0000644000175000017500000000034511772726204031013 0ustar terceiroterceiro# Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ coffee-rails-3.2.2/lib/coffee-rails.rb0000644000175000017500000000017511772726204017734 0ustar terceiroterceirorequire 'coffee-script' require 'coffee/rails/engine' require 'coffee/rails/template_handler' require 'coffee/rails/version' coffee-rails-3.2.2/lib/coffee/0000755000175000017500000000000011772726204016274 5ustar terceiroterceirocoffee-rails-3.2.2/lib/coffee/rails/0000755000175000017500000000000011772726204017406 5ustar terceiroterceirocoffee-rails-3.2.2/lib/coffee/rails/template_handler.rb0000644000175000017500000000073711772726204023252 0ustar terceiroterceiromodule Coffee module Rails class TemplateHandler 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 end ActiveSupport.on_load(:action_view) do ActionView::Template.register_template_handler :coffee, Coffee::Rails::TemplateHandler end coffee-rails-3.2.2/lib/coffee/rails/engine.rb0000644000175000017500000000024011772726204021174 0ustar terceiroterceirorequire 'rails/engine' module Coffee module Rails class Engine < ::Rails::Engine config.app_generators.javascript_engine :coffee end end end coffee-rails-3.2.2/lib/coffee/rails/version.rb0000644000175000017500000000007511772726204021422 0ustar terceiroterceiromodule Coffee module Rails VERSION = "3.2.2" end end