coffeefile 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/coffeefile.gemspec +2 -2
- data/lib/coffeefile.rb +1 -0
- data/test/test_coffeefile.rb +7 -0
- metadata +7 -7
data/coffeefile.gemspec
CHANGED
@@ -2,10 +2,10 @@
|
|
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.
|
5
|
+
s.version = '0.0.2'
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
s.authors = ["Robert R Evans"]
|
8
|
-
s.date = '2011-
|
8
|
+
s.date = '2011-08-13'
|
9
9
|
s.email = 'robert@codewranglers.org'
|
10
10
|
s.homepage = 'http://github.com/codewranglers/coffeefile'
|
11
11
|
s.summary = "Multiple coffee-script file compiler"
|
data/lib/coffeefile.rb
CHANGED
@@ -25,6 +25,7 @@ module Coffeefile
|
|
25
25
|
contents = Source.contents.collect { |source| File.read(source) }.join("\n")
|
26
26
|
data = CoffeeScript.compile(contents, options)
|
27
27
|
fileout = output =~ /(\.js)$/ ? output : "#{output}.js"
|
28
|
+
fileout = File.join(options[:output_directory], fileout) if options[:output_directory]
|
28
29
|
File.open(File.join(Dir.pwd, fileout), 'w+') { |f| f.puts data }
|
29
30
|
end
|
30
31
|
|
data/test/test_coffeefile.rb
CHANGED
@@ -12,6 +12,7 @@ class TestCoffeefile < Test::Unit::TestCase
|
|
12
12
|
file.puts "temp/api.coffee"
|
13
13
|
file.puts "temp/views/**/*.coffee"
|
14
14
|
end
|
15
|
+
FileUtils.mkdir_p("resources")
|
15
16
|
FileUtils.mkdir_p('temp/views/users')
|
16
17
|
FileUtils.mkdir_p('temp/views/bars')
|
17
18
|
FileUtils.touch('temp/app.coffee')
|
@@ -62,6 +63,11 @@ class TestCoffeefile < Test::Unit::TestCase
|
|
62
63
|
FileUtils.rm('app.js')
|
63
64
|
end
|
64
65
|
|
66
|
+
def test_compiling_of_coffeescripts_with_no_extension_with_directory
|
67
|
+
Coffeefile.compile('app', :output_directory => 'resources')
|
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
|
+
end
|
70
|
+
|
65
71
|
def test_compiling_of_coffeescripts_with_no_extension
|
66
72
|
Coffeefile.compile('program.js', :bare => true)
|
67
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'))
|
@@ -72,5 +78,6 @@ class TestCoffeefile < Test::Unit::TestCase
|
|
72
78
|
def teardown
|
73
79
|
FileUtils.rm(COFFEEFILE)
|
74
80
|
FileUtils.rm_rf('temp')
|
81
|
+
FileUtils.rm_rf('resources')
|
75
82
|
end
|
76
83
|
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.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
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: &2155921960 !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: *2155921960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rocco
|
27
|
-
requirement: &
|
27
|
+
requirement: &2155921040 !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: *2155921040
|
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
|
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.8.
|
76
|
+
rubygems_version: 1.8.6
|
77
77
|
signing_key:
|
78
78
|
specification_version: 3
|
79
79
|
summary: Multiple coffee-script file compiler
|