Sha256: bfb6cf25edc4f66b29a6ab5183f335fdcb2579b9a40790efae8cc3cca46cc7ac

Contents?: true

Size: 852 Bytes

Versions: 15

Compression:

Stored size: 852 Bytes

Contents

module Jax
  module Generators
    module CoffeeGenerator
      unless defined?(COFFEESCRIPT_AVAILABLE)
        begin
          require 'coffee-script'
          COFFEESCRIPT_AVAILABLE = true
        rescue LoadError
          COFFEESCRIPT_AVAILABLE = false
        end
      end

      def self.included(base)
        base.class_eval do
          class_option :without_coffeescript, :type => :boolean, :aliases => "-j", :default => false,
                       :desc => "Indicates whether to generate pure JavaScript instead of CoffeeScript"
        end
      end

      protected
      def coffee_template_with_fallback(src, dest)
        if COFFEESCRIPT_AVAILABLE && !options['without_coffeescript']
          template "#{src}.coffee.erb", "#{dest}.coffee"
        else
          template "#{src}.erb", dest
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jax-3.0.0.rc2 lib/generators/jax/base/coffee_generator.rb
jax-2.0.12 lib/generators/jax/base/coffee_generator.rb
jax-3.0.0.rc1 lib/generators/jax/base/coffee_generator.rb
jax-2.0.11 lib/generators/jax/base/coffee_generator.rb
jax-2.0.10 lib/generators/jax/base/coffee_generator.rb
jax-2.0.9 lib/generators/jax/base/coffee_generator.rb
jax-2.0.8 lib/generators/jax/base/coffee_generator.rb
jax-2.0.7 lib/generators/jax/base/coffee_generator.rb
jax-2.0.6 lib/generators/jax/base/coffee_generator.rb
jax-2.0.5 lib/generators/jax/base/coffee_generator.rb
jax-2.0.4 lib/generators/jax/base/coffee_generator.rb
jax-2.0.3 lib/generators/jax/base/coffee_generator.rb
jax-2.0.2 lib/generators/jax/base/coffee_generator.rb
jax-2.0.1 lib/generators/jax/base/coffee_generator.rb
jax-2.0.0 lib/generators/jax/base/coffee_generator.rb