coffeefile 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'coffeefile'
5
- s.version = '0.0.2'
5
+ s.version = '0.0.3'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Robert R Evans"]
8
8
  s.date = '2011-08-13'
@@ -21,11 +21,11 @@ module Coffeefile
21
21
  VERSION
22
22
  end
23
23
 
24
- def compile(output, options={})
24
+ def compile_to(output, options={})
25
25
  contents = Source.contents.collect { |source| File.read(source) }.join("\n")
26
26
  data = CoffeeScript.compile(contents, options)
27
- fileout = output =~ /(\.js)$/ ? output : "#{output}.js"
28
- fileout = File.join(options[:output_directory], fileout) if options[:output_directory]
27
+ fileout = File.basename(output) =~ /(\.js)$/ ? output : "#{output}.js"
28
+
29
29
  File.open(File.join(Dir.pwd, fileout), 'w+') { |f| f.puts data }
30
30
  end
31
31
 
@@ -58,18 +58,18 @@ class TestCoffeefile < Test::Unit::TestCase
58
58
  end
59
59
 
60
60
  def test_compiling_of_coffeescripts_with_no_extension
61
- Coffeefile.compile('app')
61
+ Coffeefile.compile_to('app')
62
62
  assert_equal "(function() {\n ({\n app: function(options) {\n return true;\n },\n api: function(options) {\n return true;\n },\n main: function(options) {\n return true;\n }\n });\n}).call(this);\n", File.read(File.join(Dir.pwd, 'app.js'))
63
63
  FileUtils.rm('app.js')
64
64
  end
65
65
 
66
66
  def test_compiling_of_coffeescripts_with_no_extension_with_directory
67
- Coffeefile.compile('app', :output_directory => 'resources')
67
+ Coffeefile.compile_to('resources/app')
68
68
  assert_equal "(function() {\n ({\n app: function(options) {\n return true;\n },\n api: function(options) {\n return true;\n },\n main: function(options) {\n return true;\n }\n });\n}).call(this);\n", File.read(File.join(Dir.pwd, 'resources/app.js'))
69
69
  end
70
70
 
71
71
  def test_compiling_of_coffeescripts_with_no_extension
72
- Coffeefile.compile('program.js', :bare => true)
72
+ Coffeefile.compile_to('program.js', :bare => true)
73
73
  assert_equal "({\n app: function(options) {\n return true;\n },\n api: function(options) {\n return true;\n },\n main: function(options) {\n return true;\n }\n});\n", File.read(File.join(Dir.pwd, 'program.js'))
74
74
  FileUtils.rm('program.js')
75
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coffeefile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coffee-script
16
- requirement: &2155921960 !ruby/object:Gem::Requirement
16
+ requirement: &2156674800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2155921960
24
+ version_requirements: *2156674800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rocco
27
- requirement: &2155921040 !ruby/object:Gem::Requirement
27
+ requirement: &2156674300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0.6'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2155921040
35
+ version_requirements: *2156674300
36
36
  description: ! ' Use a Coffeefile to add all your coffee files that require compiling.
37
37
  Then use the coffefile command to compile.
38
38