coffeefile 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/coffeefile.gemspec +1 -1
- data/lib/coffeefile.rb +3 -3
- data/test/test_coffeefile.rb +3 -3
- metadata +5 -5
data/coffeefile.gemspec
CHANGED
data/lib/coffeefile.rb
CHANGED
@@ -21,11 +21,11 @@ module Coffeefile
|
|
21
21
|
VERSION
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
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
|
-
|
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
|
|
data/test/test_coffeefile.rb
CHANGED
@@ -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.
|
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.
|
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.
|
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.
|
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: &
|
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: *
|
24
|
+
version_requirements: *2156674800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rocco
|
27
|
-
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: *
|
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
|
|