rill 0.1.2 → 0.1.3
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.
- data/lib/rill.rb +8 -8
- metadata +3 -3
data/lib/rill.rb
CHANGED
|
@@ -37,7 +37,7 @@ class Rill
|
|
|
37
37
|
path = File.join(@base, "#{mod}.js")
|
|
38
38
|
code = File.open(path).read
|
|
39
39
|
|
|
40
|
-
unless code =~ /^define\((['"])[^'"]+\1/
|
|
40
|
+
unless code =~ /^s*define\(\s*(['"])[^'"]+\1/
|
|
41
41
|
code = polish(mod, code)
|
|
42
42
|
# fio = File.open(path, 'w')
|
|
43
43
|
# fio.write(code)
|
|
@@ -75,7 +75,7 @@ class Rill
|
|
|
75
75
|
path = File.join(@base, "#{mod}.js")
|
|
76
76
|
code = File.open(path).read
|
|
77
77
|
|
|
78
|
-
unless code =~
|
|
78
|
+
unless code =~ /^\s*define\(\s*(['"])[^'"]+\1/
|
|
79
79
|
code = polish_code(mod, code)
|
|
80
80
|
fio = File.open(path, 'w')
|
|
81
81
|
fio.write(code)
|
|
@@ -88,14 +88,14 @@ class Rill
|
|
|
88
88
|
def polish_code(mod, code)
|
|
89
89
|
mod = parse_module(mod)
|
|
90
90
|
|
|
91
|
-
if code =~
|
|
91
|
+
if code =~ /^\s*define\(\s*function/
|
|
92
92
|
deps = parse_deps(code)
|
|
93
93
|
deps -= @preloads
|
|
94
94
|
deps_str = deps.length > 0 ? "['#{deps.join("', '")}']" : '[]'
|
|
95
95
|
|
|
96
|
-
code.sub!(
|
|
97
|
-
elsif code =~ /^define\([\[\{]/
|
|
98
|
-
code.sub!(
|
|
96
|
+
code.sub!(/^\s*define\(\s*/, "define('#{mod}', #{deps_str}, ")
|
|
97
|
+
elsif code =~ /^s*define\(\s*[\[\{]/
|
|
98
|
+
code.sub!(/^\s*define\(\s*/, "define('#{mod}', ")
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
code
|
|
@@ -122,7 +122,7 @@ class Rill
|
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
def parse_deps_from_define(code)
|
|
125
|
-
pattern =
|
|
125
|
+
pattern = /^\s*define\(\s*(['"])[^'"]+\1,\s*(\[[^\]]+\])/
|
|
126
126
|
match = pattern.match(code)
|
|
127
127
|
deps = []
|
|
128
128
|
|
|
@@ -133,7 +133,7 @@ class Rill
|
|
|
133
133
|
d.nil? || d =~ /^\s*$/
|
|
134
134
|
end
|
|
135
135
|
else
|
|
136
|
-
pattern =
|
|
136
|
+
pattern = /^\s*define\(\s*(['"])[^'"]+\1,\s*(['"])([^\1]+)\1\.split/
|
|
137
137
|
match = pattern.match(code)
|
|
138
138
|
if match
|
|
139
139
|
deps = match[3].split(/,\s*/)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rill
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-08-20 00:00:00.
|
|
12
|
+
date: 2012-08-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: A simple CMD module bundler
|
|
15
15
|
email: jakeplus@gmail.com
|
|
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
40
40
|
version: '0'
|
|
41
41
|
requirements: []
|
|
42
42
|
rubyforge_project:
|
|
43
|
-
rubygems_version: 1.8.
|
|
43
|
+
rubygems_version: 1.8.24
|
|
44
44
|
signing_key:
|
|
45
45
|
specification_version: 3
|
|
46
46
|
summary: SeaJS Bundler in Ruby
|