SasquatchJS 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/quatch/compiler.rb +2 -1
- data/lib/quatch/listener.rb +3 -3
- data/test/js/application.js +3 -3
- data/test/js/test-2.js +1 -1
- data/test/js/test.js +1 -1
- data/test/test_sasquatchjs.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf8049504cc42c0448cc8cfd0aeadfe46417ddbd
|
4
|
+
data.tar.gz: d0c3af66d13030439c7f9ab1698cac538bf6e2f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02878e3ec27bd841ae63e89735f4579db6a289d33505585711e70d2c6168d3a2afb7d9037a11141aea55e10ee4595ee26c2929421268a60234ccf94c2c762619
|
7
|
+
data.tar.gz: 87d1b30c279f1866d9e80ee6b8616b551d1baf64d926b9ba4d8d56b16feefcad0d4ba24118ffcce663cdf81650194fb2d519b8238925a5239df457d267760934
|
data/Rakefile
CHANGED
data/lib/quatch/compiler.rb
CHANGED
@@ -38,7 +38,8 @@ module Sasquatch
|
|
38
38
|
|
39
39
|
# search the output buffer for the key and replace it with the import_file
|
40
40
|
def import output_buffer, key, import_file
|
41
|
-
|
41
|
+
|
42
|
+
output_buffer.sub(/\/\* @import ["']#{key}["']; \*\//, "/* Imports #{key} */ \n\n" + File.read(import_file.path()) + "\n")
|
42
43
|
end
|
43
44
|
|
44
45
|
end
|
data/lib/quatch/listener.rb
CHANGED
@@ -5,12 +5,12 @@ module Sasquatch
|
|
5
5
|
include Logger
|
6
6
|
attr_reader :file, :files, :listener, :status, :base_path, :file_changed, :running
|
7
7
|
|
8
|
-
def initialize file, &block
|
8
|
+
def initialize file, running = true, &block
|
9
9
|
@file = file
|
10
10
|
|
11
11
|
@base_path = File.dirname(@file)
|
12
12
|
|
13
|
-
@running =
|
13
|
+
@running = running
|
14
14
|
|
15
15
|
validate_file @file
|
16
16
|
|
@@ -29,7 +29,7 @@ module Sasquatch
|
|
29
29
|
|
30
30
|
def find_imports file
|
31
31
|
@files = {}
|
32
|
-
File.read(file).scan(/\/\* @import (.*.js)/) do |filename|
|
32
|
+
File.read(file).scan(/\/\* @import .+?(.*.js)/) do |filename|
|
33
33
|
@import = "#{File.dirname(@file)}/#{filename.first}"
|
34
34
|
validate_file @import
|
35
35
|
@files[filename.first] = File.new(File.absolute_path(@import))
|
data/test/js/application.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
|
-
/* @import test.js */
|
2
|
+
/* @import "test.js"; */
|
3
3
|
|
4
4
|
function Application() {
|
5
5
|
console.log('test');
|
6
6
|
}
|
7
7
|
|
8
|
-
/* @import test-2.js */
|
8
|
+
/* @import 'test-2.js'; */
|
9
9
|
|
10
|
-
// 2013-12-10
|
10
|
+
// 2013-12-10 03:52:37 -0800 line added by rspec
|
data/test/js/test-2.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
// test-2.js file
|
1
|
+
// test-2.js file
|
data/test/js/test.js
CHANGED
data/test/test_sasquatchjs.rb
CHANGED
@@ -41,7 +41,7 @@ describe Sasquatch do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
context "#Listener" do
|
44
|
-
listener = Sasquatch::Listener.new('test/js/application.js')
|
44
|
+
listener = Sasquatch::Listener.new('test/js/application.js', false)
|
45
45
|
# it should have a list of all imported files
|
46
46
|
it "should have a list of all imported files" do
|
47
47
|
files = ["test.js", "test-2.js"]
|