Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial commit

  • Loading branch information...
commit d9b1790e6de393bc4120c2f1537238e265936bc9 0 parents
Santiago Pastorino authored
1  .gitignore
... ... @@ -0,0 +1 @@
  1 +test/tmp
11 Gemfile
... ... @@ -0,0 +1,11 @@
  1 +source "http://rubygems.org"
  2 +
  3 +# Specify your gem's dependencies in sass-rails.gemspec
  4 +gemspec
  5 +
  6 +# gem "rails", :git => "git://github.com/rails/rails", :branch => "3-1-stable"
  7 +gem "rails", :path => "/Users/santiago/WyeWorks/Projs/rails"
  8 +
  9 +# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
  10 +# gem 'ruby-debug'
  11 +# gem 'ruby-debug19'
108 Gemfile.lock
... ... @@ -0,0 +1,108 @@
  1 +PATH
  2 + remote: .
  3 + specs:
  4 + coffee-rails (3.1.0.rc.4)
  5 + actionpack (~> 3.1.0.rc1)
  6 + coffee-script (>= 2.2.0)
  7 + railties (~> 3.1.0.rc1)
  8 + sprockets (>= 2.0.0.beta.9)
  9 +
  10 +PATH
  11 + remote: /Users/santiago/WyeWorks/Projs/rails
  12 + specs:
  13 + actionmailer (3.1.0.rc1)
  14 + actionpack (= 3.1.0.rc1)
  15 + mail (~> 2.3.0)
  16 + actionpack (3.1.0.rc1)
  17 + activemodel (= 3.1.0.rc1)
  18 + activesupport (= 3.1.0.rc1)
  19 + builder (~> 3.0.0)
  20 + erubis (~> 2.7.0)
  21 + i18n (~> 0.6)
  22 + rack (~> 1.3.0)
  23 + rack-cache (~> 1.0.1)
  24 + rack-mount (~> 0.8.1)
  25 + rack-test (~> 0.6.0)
  26 + sprockets (= 2.0.0.beta.10)
  27 + tzinfo (~> 0.3.27)
  28 + activemodel (3.1.0.rc1)
  29 + activesupport (= 3.1.0.rc1)
  30 + bcrypt-ruby (~> 2.1.4)
  31 + builder (~> 3.0.0)
  32 + i18n (~> 0.6)
  33 + activerecord (3.1.0.rc1)
  34 + activemodel (= 3.1.0.rc1)
  35 + activesupport (= 3.1.0.rc1)
  36 + arel (~> 2.1.3)
  37 + tzinfo (~> 0.3.27)
  38 + activeresource (3.1.0.rc1)
  39 + activemodel (= 3.1.0.rc1)
  40 + activesupport (= 3.1.0.rc1)
  41 + activesupport (3.1.0.rc1)
  42 + i18n (~> 0.6)
  43 + multi_json (~> 1.0)
  44 + rails (3.1.0.rc1)
  45 + actionmailer (= 3.1.0.rc1)
  46 + actionpack (= 3.1.0.rc1)
  47 + activerecord (= 3.1.0.rc1)
  48 + activeresource (= 3.1.0.rc1)
  49 + activesupport (= 3.1.0.rc1)
  50 + bundler (~> 1.0)
  51 + railties (= 3.1.0.rc1)
  52 + railties (3.1.0.rc1)
  53 + actionpack (= 3.1.0.rc1)
  54 + activesupport (= 3.1.0.rc1)
  55 + rack-ssl (~> 1.3.2)
  56 + rake (>= 0.8.7)
  57 + rdoc (~> 3.4)
  58 + thor (~> 0.14.6)
  59 +
  60 +GEM
  61 + remote: http://rubygems.org/
  62 + specs:
  63 + arel (2.1.3)
  64 + bcrypt-ruby (2.1.4)
  65 + builder (3.0.0)
  66 + coffee-script (2.2.0)
  67 + coffee-script-source
  68 + execjs
  69 + coffee-script-source (1.1.1)
  70 + erubis (2.7.0)
  71 + execjs (1.2.0)
  72 + multi_json (~> 1.0)
  73 + hike (1.1.0)
  74 + i18n (0.6.0)
  75 + mail (2.3.0)
  76 + i18n (>= 0.4.0)
  77 + mime-types (~> 1.16)
  78 + treetop (~> 1.4.8)
  79 + mime-types (1.16)
  80 + multi_json (1.0.3)
  81 + polyglot (0.3.1)
  82 + rack (1.3.0)
  83 + rack-cache (1.0.2)
  84 + rack (>= 0.4)
  85 + rack-mount (0.8.1)
  86 + rack (>= 1.0.0)
  87 + rack-ssl (1.3.2)
  88 + rack
  89 + rack-test (0.6.0)
  90 + rack (>= 1.0)
  91 + rake (0.9.2)
  92 + rdoc (3.7)
  93 + sprockets (2.0.0.beta.10)
  94 + hike (~> 1.0)
  95 + rack (~> 1.0)
  96 + tilt (!= 1.3.0, ~> 1.1)
  97 + thor (0.14.6)
  98 + tilt (1.3.2)
  99 + treetop (1.4.9)
  100 + polyglot (>= 0.3.1)
  101 + tzinfo (0.3.29)
  102 +
  103 +PLATFORMS
  104 + ruby
  105 +
  106 +DEPENDENCIES
  107 + coffee-rails!
  108 + rails!
0  README.markdown
Source Rendered
No changes.
12 Rakefile
... ... @@ -0,0 +1,12 @@
  1 +require 'bundler'
  2 +Bundler::GemHelper.install_tasks
  3 +
  4 +require 'rake/testtask'
  5 +
  6 +Rake::TestTask.new(:test) do |t|
  7 + t.libs << 'lib'
  8 + t.libs << 'test'
  9 + t.pattern = 'test/**/*_test.rb'
  10 + t.verbose = false
  11 +end
  12 +
25 coffee-rails.gemspec
... ... @@ -0,0 +1,25 @@
  1 +$:.push File.expand_path("../lib", __FILE__)
  2 +require "coffee/rails/version"
  3 +
  4 +Gem::Specification.new do |s|
  5 + s.name = "coffee-rails"
  6 + s.version = Coffee::Rails::VERSION
  7 + s.platform = Gem::Platform::RUBY
  8 + s.authors = ["Santiago Pastorino"]
  9 + s.email = ["santiago@wyeworks.com"]
  10 + s.homepage = ""
  11 + s.summary = %q{Coffee Script adapter for the Rails asset pipeline.}
  12 + s.description = %q{Coffee Script adapter for the Rails asset pipeline.}
  13 +
  14 + s.rubyforge_project = "coffee-rails"
  15 +
  16 + s.add_runtime_dependency 'coffee-script', '>= 2.2.0'
  17 + s.add_runtime_dependency 'railties', '~> 3.1.0.rc1'
  18 + s.add_runtime_dependency 'actionpack', '~> 3.1.0.rc1'
  19 + s.add_runtime_dependency 'sprockets', '>= 2.0.0.beta.9'
  20 +
  21 + s.files = `git ls-files`.split("\n")
  22 + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
  23 + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
  24 + s.require_paths = ["lib"]
  25 +end
3  lib/coffee-rails.rb
... ... @@ -0,0 +1,3 @@
  1 +require 'coffee-script'
  2 +require 'coffee/rails/railtie'
  3 +require 'coffee/rails/version'
7 lib/coffee/rails/railtie.rb
... ... @@ -0,0 +1,7 @@
  1 +module Coffee::Rails
  2 + class Railtie < ::Rails::Railtie
  3 + initializer :setup_coffee do
  4 + config.app_generators.javascript_engine 'coffee'
  5 + end
  6 + end
  7 +end
5 lib/coffee/rails/version.rb
... ... @@ -0,0 +1,5 @@
  1 +module Coffee
  2 + module Rails
  3 + VERSION = "3.1.0.rc.4"
  4 + end
  5 +end
13 lib/rails/generators/coffee/assets/assets_generator.rb
... ... @@ -0,0 +1,13 @@
  1 +require "rails/generators/named_base"
  2 +
  3 +module Coffee
  4 + module Generators
  5 + class AssetsGenerator < ::Rails::Generators::NamedBase
  6 + source_root File.expand_path("../templates", __FILE__)
  7 +
  8 + def copy_coffee
  9 + template "javascript.js.coffee", File.join('app/assets/javascripts', class_path, "#{file_name}.js.coffee")
  10 + end
  11 + end
  12 + end
  13 +end
3  lib/rails/generators/coffee/assets/templates/javascript.js.coffee
... ... @@ -0,0 +1,3 @@
  1 +# Place all the behaviors and hooks related to the matching controller here.
  2 +# All this logic will automatically be available in application.js.
  3 +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
15 test/assets_generator_test.rb
... ... @@ -0,0 +1,15 @@
  1 +require 'test_helper'
  2 +require 'rails/generators/coffee/assets/assets_generator'
  3 +
  4 +class AssetGeneratorTest < Rails::Generators::TestCase
  5 + tests Coffee::Generators::AssetsGenerator
  6 +
  7 + destination File.expand_path("../tmp", __FILE__)
  8 + setup :prepare_destination
  9 +
  10 + def test_assets
  11 + run_generator %w(posts)
  12 + assert_no_file "app/assets/javascripts/posts.js"
  13 + assert_file "app/assets/javascripts/posts.js.coffee"
  14 + end
  15 +end
29 test/controller_generator_test.rb
... ... @@ -0,0 +1,29 @@
  1 +require 'test_helper'
  2 +require 'rails/generators/rails/controller/controller_generator'
  3 +require 'rails/generators/coffee/assets/assets_generator'
  4 +
  5 +class ControllerGeneratorTest < Rails::Generators::TestCase
  6 + tests Rails::Generators::ControllerGenerator
  7 +
  8 + destination File.expand_path("../tmp", __FILE__)
  9 + setup do
  10 + prepare_destination
  11 + copy_routes
  12 + end
  13 +
  14 + def test_assets
  15 + run_generator %w(posts --javascript-engine=coffee --orm=false)
  16 + assert_no_file "app/assets/javascripts/posts.js"
  17 + assert_file "app/assets/javascripts/posts.js.coffee"
  18 + end
  19 +
  20 + private
  21 +
  22 + def copy_routes
  23 + routes = File.expand_path("../support/routes.rb", __FILE__)
  24 + destination = File.join(destination_root, "config")
  25 +
  26 + FileUtils.mkdir_p(destination)
  27 + FileUtils.cp routes, destination
  28 + end
  29 +end
29 test/scaffold_generator_test.rb
... ... @@ -0,0 +1,29 @@
  1 +require 'test_helper'
  2 +require 'rails/generators/rails/scaffold/scaffold_generator'
  3 +require 'rails/generators/coffee/assets/assets_generator'
  4 +
  5 +class ScaffoldGeneratorTest < Rails::Generators::TestCase
  6 + tests Rails::Generators::ScaffoldGenerator
  7 +
  8 + destination File.expand_path("../tmp", __FILE__)
  9 + setup do
  10 + prepare_destination
  11 + copy_routes
  12 + end
  13 +
  14 + def test_assets
  15 + run_generator %w(posts --javascript-engine=coffee --orm=false)
  16 + assert_no_file "app/assets/javascripts/posts.js"
  17 + assert_file "app/assets/javascripts/posts.js.coffee"
  18 + end
  19 +
  20 + private
  21 +
  22 + def copy_routes
  23 + routes = File.expand_path("../support/routes.rb", __FILE__)
  24 + destination = File.join(destination_root, "config")
  25 +
  26 + FileUtils.mkdir_p(destination)
  27 + FileUtils.cp routes, destination
  28 + end
  29 +end
1  test/support/routes.rb
... ... @@ -0,0 +1 @@
  1 +# routes dummy file
9 test/test_helper.rb
... ... @@ -0,0 +1,9 @@
  1 +# Configure Rails Envinronment
  2 +ENV["RAILS_ENV"] = "test"
  3 +
  4 +require 'rails'
  5 +require "rails/test_help"
  6 +# require 'sass/rails'
  7 +
  8 +# For generators
  9 +require 'rails/generators/test_case'

0 comments on commit d9b1790

Please sign in to comment.
Something went wrong with that request. Please try again.