juice 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/bin/juice +4 -2
- data/lib/JSquish.rb +7 -4
- data/lib/juice.rb +1 -1
- metadata +1 -1
data/bin/juice
CHANGED
@@ -27,8 +27,10 @@ module Juice
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.build
|
30
|
-
save_file = ARGV[1].nil? ? 'production.js' : ARGV[1]
|
31
|
-
if File.exists?(
|
30
|
+
save_file = ARGV[1].nil? ? 'production.js' : ARGV[1]
|
31
|
+
if !File.exists?("juice.app")
|
32
|
+
puts "This doesn't seem to be a Juice Application"
|
33
|
+
elsif File.exists?(save_file)
|
32
34
|
puts "#{save_file} already exists!"
|
33
35
|
else
|
34
36
|
app = ''
|
data/lib/JSquish.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
class JSquish
|
2
2
|
def self.parse(str)
|
3
|
+
# Strip one line comments
|
3
4
|
s_comment_reg = /[\/]{2}.*/
|
4
5
|
str = str.gsub(s_comment_reg,' ')
|
5
|
-
|
6
|
+
|
7
|
+
# String multiline comments
|
8
|
+
str = str.gsub(/\/\*[\s\S]*?\*\//m,' ')
|
9
|
+
|
6
10
|
#Remove all extra space
|
7
11
|
remove_regexes = [/\s+/]
|
8
12
|
remove_regexes.each do |reg|
|
9
13
|
str = str.gsub(reg,' ')
|
10
14
|
end
|
11
|
-
|
12
|
-
|
13
|
-
#str = str.gsub(comment_reg,' ')
|
15
|
+
|
16
|
+
|
14
17
|
# Return the string
|
15
18
|
str
|
16
19
|
end
|
data/lib/juice.rb
CHANGED