coffee-script-2.2.0/0000755000175000017500000000000011772722327014470 5ustar terceiroterceirocoffee-script-2.2.0/README.md0000644000175000017500000000264711772722327015760 0ustar terceiroterceiroRuby CoffeeScript ================= Ruby CoffeeScript is a bridge to the official CoffeeScript compiler. CoffeeScript.compile File.read("script.coffee") Installation ------------ gem install coffee-script *Note: This compiler library has replaced the original CoffeeScript compiler that was written in Ruby.* Dependencies ------------ This library depends on the `coffee-script-source` gem which is updated any time a new version of CoffeeScript is released. (The `coffee-script-source` gem's version number is synced with each official CoffeeScript release.) This way you can build against different versions of CoffeeScript by requiring the correct version of the `coffee-script-source` gem. In addition, you can use this library with unreleased versions of CoffeeScript by setting the `COFFEESCRIPT_SOURCE_PATH` environment variable: export COFFEESCRIPT_SOURCE_PATH=/path/to/coffee-script/extras/coffee-script.js ### JSON The `json` library is also required but is not explicitly stated as a gem dependency. If you're on Ruby 1.8 you'll need to install the `json` or `json_pure` gem. On Ruby 1.9, `json` is included in the standard library. ### ExecJS The [ExecJS](https://github.com/sstephenson/execjs) library is used to automatically choose the best JavaScript engine for your platform. Check out its [README](https://github.com/sstephenson/execjs/blob/master/README.md) for a complete list of supported engines. coffee-script-2.2.0/LICENSE0000644000175000017500000000203711772722327015477 0ustar terceiroterceiroCopyright (c) 2010 Joshua Peek 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-script-2.2.0/metadata.yml0000644000175000017500000000360211772722327016774 0ustar terceiroterceiro--- !ruby/object:Gem::Specification name: coffee-script version: !ruby/object:Gem::Version hash: 7 prerelease: segments: - 2 - 2 - 0 version: 2.2.0 platform: ruby authors: - Jeremy Ashkenas - Joshua Peek - Sam Stephenson autorequire: bindir: bin cert_chain: [] date: 2010-03-11 00:00:00 -06:00 default_executable: dependencies: - !ruby/object:Gem::Dependency name: coffee-script-source prerelease: false requirement: &id001 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 3 segments: - 0 version: "0" type: :runtime version_requirements: *id001 - !ruby/object:Gem::Dependency name: execjs prerelease: false requirement: &id002 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: 3 segments: - 0 version: "0" type: :runtime version_requirements: *id002 description: " Ruby CoffeeScript is a bridge to the JS CoffeeScript compiler.\n" email: josh@joshpeek.com executables: [] extensions: [] extra_rdoc_files: [] files: - lib/coffee-script.rb - lib/coffee_script.rb - LICENSE - README.md has_rdoc: true homepage: http://github.com/josh/ruby-coffee-script 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: rubygems_version: 1.5.3 signing_key: specification_version: 3 summary: Ruby CoffeeScript Compiler test_files: [] coffee-script-2.2.0/lib/0000755000175000017500000000000011772722327015236 5ustar terceiroterceirocoffee-script-2.2.0/lib/coffee_script.rb0000644000175000017500000000231611772722327020400 0ustar terceiroterceirorequire 'execjs' require 'coffee_script/source' module CoffeeScript EngineError = ExecJS::RuntimeError CompilationError = ExecJS::ProgramError module Source def self.path @path ||= ENV['COFFEESCRIPT_SOURCE_PATH'] || bundled_path end def self.path=(path) @contents = @version = @bare_option = @context = nil @path = path end def self.contents @contents ||= File.read(path) end def self.version @version ||= contents[/CoffeeScript Compiler v([\d.]+)/, 1] end def self.bare_option @bare_option ||= contents.match(/noWrap/) ? 'noWrap' : 'bare' end def self.context @context ||= ExecJS.compile(contents) end end class << self def engine end def engine=(engine) end def version Source.version end # Compile a script (String or IO) to JavaScript. def compile(script, options = {}) script = script.read if script.respond_to?(:read) if options.key?(:bare) elsif options.key?(:no_wrap) options[:bare] = options[:no_wrap] else options[:bare] = false end Source.context.call("CoffeeScript.compile", script, options) end end end coffee-script-2.2.0/lib/coffee-script.rb0000644000175000017500000000003011772722327020305 0ustar terceiroterceirorequire 'coffee_script'