Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit d9b1790e6de393bc4120c2f1537238e265936bc9 0 parents
@spastorino authored
1  .gitignore
@@ -0,0 +1 @@
+test/tmp
11 Gemfile
@@ -0,0 +1,11 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in sass-rails.gemspec
+gemspec
+
+# gem "rails", :git => "git://github.com/rails/rails", :branch => "3-1-stable"
+gem "rails", :path => "/Users/santiago/WyeWorks/Projs/rails"
+
+# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
+# gem 'ruby-debug'
+# gem 'ruby-debug19'
108 Gemfile.lock
@@ -0,0 +1,108 @@
+PATH
+ remote: .
+ specs:
+ coffee-rails (3.1.0.rc.4)
+ actionpack (~> 3.1.0.rc1)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.1.0.rc1)
+ sprockets (>= 2.0.0.beta.9)
+
+PATH
+ remote: /Users/santiago/WyeWorks/Projs/rails
+ specs:
+ actionmailer (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ mail (~> 2.3.0)
+ actionpack (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.0)
+ rack-cache (~> 1.0.1)
+ rack-mount (~> 0.8.1)
+ rack-test (~> 0.6.0)
+ sprockets (= 2.0.0.beta.10)
+ tzinfo (~> 0.3.27)
+ activemodel (3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ bcrypt-ruby (~> 2.1.4)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ arel (~> 2.1.3)
+ tzinfo (~> 0.3.27)
+ activeresource (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ activesupport (3.1.0.rc1)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ rails (3.1.0.rc1)
+ actionmailer (= 3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activerecord (= 3.1.0.rc1)
+ activeresource (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ bundler (~> 1.0)
+ railties (= 3.1.0.rc1)
+ railties (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ arel (2.1.3)
+ bcrypt-ruby (2.1.4)
+ builder (3.0.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.1.1)
+ erubis (2.7.0)
+ execjs (1.2.0)
+ multi_json (~> 1.0)
+ hike (1.1.0)
+ i18n (0.6.0)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ multi_json (1.0.3)
+ polyglot (0.3.1)
+ rack (1.3.0)
+ rack-cache (1.0.2)
+ rack (>= 0.4)
+ rack-mount (0.8.1)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.0)
+ rack (>= 1.0)
+ rake (0.9.2)
+ rdoc (3.7)
+ sprockets (2.0.0.beta.10)
+ hike (~> 1.0)
+ rack (~> 1.0)
+ tilt (!= 1.3.0, ~> 1.1)
+ thor (0.14.6)
+ tilt (1.3.2)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.29)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails!
+ rails!
0  README.markdown
No changes.
12 Rakefile
@@ -0,0 +1,12 @@
+require '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
+
25 coffee-rails.gemspec
@@ -0,0 +1,25 @@
+$:.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.1.0.rc1'
+ s.add_runtime_dependency 'actionpack', '~> 3.1.0.rc1'
+ s.add_runtime_dependency 'sprockets', '>= 2.0.0.beta.9'
+
+ 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
3  lib/coffee-rails.rb
@@ -0,0 +1,3 @@
+require 'coffee-script'
+require 'coffee/rails/railtie'
+require 'coffee/rails/version'
7 lib/coffee/rails/railtie.rb
@@ -0,0 +1,7 @@
+module Coffee::Rails
+ class Railtie < ::Rails::Railtie
+ initializer :setup_coffee do
+ config.app_generators.javascript_engine 'coffee'
+ end
+ end
+end
5 lib/coffee/rails/version.rb
@@ -0,0 +1,5 @@
+module Coffee
+ module Rails
+ VERSION = "3.1.0.rc.4"
+ end
+end
13 lib/rails/generators/coffee/assets/assets_generator.rb
@@ -0,0 +1,13 @@
+require "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
3  lib/rails/generators/coffee/assets/templates/javascript.js.coffee
@@ -0,0 +1,3 @@
+# 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/
15 test/assets_generator_test.rb
@@ -0,0 +1,15 @@
+require '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
29 test/controller_generator_test.rb
@@ -0,0 +1,29 @@
+require '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
+
+ private
+
+ 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
+end
29 test/scaffold_generator_test.rb
@@ -0,0 +1,29 @@
+require '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
+
+ private
+
+ 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
+end
1  test/support/routes.rb
@@ -0,0 +1 @@
+# routes dummy file
9 test/test_helper.rb
@@ -0,0 +1,9 @@
+# Configure Rails Envinronment
+ENV["RAILS_ENV"] = "test"
+
+require 'rails'
+require "rails/test_help"
+# require 'sass/rails'
+
+# For generators
+require 'rails/generators/test_case'
Please sign in to comment.
Something went wrong with that request. Please try again.