padrino-contrib 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of padrino-contrib might be problematic. Click here for more details.

@@ -1,4 +1,5 @@
1
1
  require 'open-uri'
2
+ require 'fileutils'
2
3
 
3
4
  module Padrino
4
5
  module Contrib
@@ -96,10 +97,20 @@ module Padrino
96
97
  # Back if no changes happens
97
98
  return bundle if File.exist?(path)
98
99
 
100
+ # Clean old cached files
101
+ Dir[path.gsub(/\.\d{10}\.#{kind}/, "*")].each { |file| FileUtils.rm_f(file) }
102
+
99
103
  # Get source code
104
+ errors = []
100
105
  code = sources.map do |source|
101
106
  source = asset_path(kind, source).sub(/\?\d{10}$/, '') # Removes Timestamp
102
- source = source =~ /^http/ ? open(source) : File.read(Padrino.root("public", source))
107
+ begin
108
+ source = source =~ /^http/ ? open(source) : File.read(Padrino.root("public", source))
109
+ rescue Exception => e
110
+ logger.error e.message
111
+ errors << source
112
+ next
113
+ end
103
114
  # Removes extra comments
104
115
  if cs = source =~ /\/\*\!/
105
116
  cr = source.slice(cs, source.length)
@@ -116,7 +127,7 @@ module Padrino
116
127
  logger.debug "Compressed (%0.2fms) %s" % [Time.now-began_at, path] if defined?(logger)
117
128
 
118
129
  # Return the updated bundle
119
- bundle
130
+ errors.unshift bundle
120
131
  end
121
132
 
122
133
  def asset_path_with_compression(kind, source)
@@ -1,5 +1,5 @@
1
1
  module Padrino
2
2
  module Contrib
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-contrib
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Davide D'Agostino
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-07-26 00:00:00 +02:00
20
+ date: 2011-07-27 00:00:00 +02:00
21
21
  default_executable:
22
22
  dependencies: []
23
23