cjoiner 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -39,11 +39,30 @@ module Cjoiner
39
39
 
40
40
  # create a temporal file
41
41
  def temp_file(file, data)
42
- temp = Tempfile.new(file) << data
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
@@ -1,4 +1,4 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Cjoiner
3
- VERSION = "1.5.1" #:nodoc
3
+ VERSION = "1.5.2" #:nodoc
4
4
  end
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: 1
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 1
10
- version: 1.5.1
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-14 00:00:00 +01:00
18
+ date: 2013-01-15 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency