cjoiner 1.5.1 → 1.5.2
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/cjoiner/engines/compressor.rb +1 -0
- data/lib/cjoiner/helpers.rb +20 -1
- data/lib/cjoiner/version.rb +1 -1
- metadata +4 -4
@@ -10,6 +10,7 @@ module Cjoiner
|
|
10
10
|
temp = temp_file "cjoiner.#{opts[:type]}", opts[:content]
|
11
11
|
munge = !opts[:munge] ? "--nomunge" : ""
|
12
12
|
@engine = `java -jar #{opts[:yui]} #{munge} --charset #{opts[:charset]} --type #{opts[:type]} #{temp.path}` if file_exists opts[:yui]
|
13
|
+
delete_file temp
|
13
14
|
else
|
14
15
|
case opts[:type]
|
15
16
|
when :css
|
data/lib/cjoiner/helpers.rb
CHANGED
@@ -39,11 +39,30 @@ module Cjoiner
|
|
39
39
|
|
40
40
|
# create a temporal file
|
41
41
|
def temp_file(file, data)
|
42
|
-
|
42
|
+
# due to some java+windows+cygwin limitation
|
43
|
+
# we need to create our custom tempfile
|
44
|
+
if on_windows
|
45
|
+
name = "_cjoiner_tmp_#{file}"
|
46
|
+
temp = File.new(name, "w")
|
47
|
+
temp.write(data)
|
48
|
+
else
|
49
|
+
temp = Tempfile.new(file) << data
|
50
|
+
end
|
43
51
|
temp.close
|
44
52
|
temp
|
45
53
|
end
|
46
54
|
|
55
|
+
# delete a file, can be File or String
|
56
|
+
def delete_file(file)
|
57
|
+
item = file.kind_of?(File) ? file.path : file
|
58
|
+
File.delete item
|
59
|
+
end
|
60
|
+
|
61
|
+
# RUBY_PLATFORM tells cygwin or mswin
|
62
|
+
def on_windows
|
63
|
+
(RUBY_PLATFORM =~ /cygwin|mswin/) != nil
|
64
|
+
end
|
65
|
+
|
47
66
|
# return Pathname.new.expand_path
|
48
67
|
def expand_path(file)
|
49
68
|
Pathname.new(file).expand_path
|
data/lib/cjoiner/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cjoiner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 2
|
10
|
+
version: 1.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Alejandro El Inform\xC3\xA1tico"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-01-
|
18
|
+
date: 2013-01-15 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|