padrino-contrib 0.0.4 → 0.0.5

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.

Potentially problematic release.


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

data/Rakefile CHANGED
@@ -42,6 +42,8 @@ end
42
42
  desc "Release the gem"
43
43
  task :release => :package do
44
44
  sh "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem"
45
+ sh "rm -rf pkg"
46
+ sh "git add . && git commit -m 'Bump to version #{gemspec.version}' && git push"
45
47
  end
46
48
 
47
49
  # rake package
@@ -20,7 +20,8 @@ module Padrino
20
20
  module AssetsCompressor
21
21
  def self.registered(app)
22
22
  raise "You need to add in your Gemfile: gem 'yui-compressor', :require => 'yui/compressor'" unless defined?(YUI)
23
- app.helpers Padrino::Contrib::Helpers::AssetsCompressor::Helpers
23
+ app.helpers Padrino::Contrib::Helpers::AssetsCompressor::Helpers unless app.respond_to?(:compressor)
24
+ app.set :compressor, {}
24
25
  end
25
26
 
26
27
  module Helpers
@@ -38,16 +39,15 @@ module Padrino
38
39
  end
39
40
 
40
41
  def assets_compressor(kind, sources)
41
- began_at = Time.now
42
- asset_folder, compressor = *case kind
43
- # 8000 for line break is more browser and texmate friendly
44
- when :css then ['stylesheets', YUI::CssCompressor.new(:line_break => 8000)]
45
- when :js then ['javascripts', YUI::JavaScriptCompressor.new(:line_break => 8000)]
46
- else raise "YUI Compressor didn't support yet #{kind} compression"
47
- end
48
42
  options = sources.extract_options!.symbolize_keys
49
43
  bundle = options.delete(:cache)
50
44
  return sources if bundle.nil?
45
+ began_at = Time.now
46
+ asset_folder = case kind
47
+ when :css then 'stylesheets'
48
+ when :js then 'javascripts'
49
+ else raise "YUI Compressor didn't support yet #{kind} compression"
50
+ end
51
51
  bundle = settings.app_name if bundle.is_a?(TrueClass)
52
52
  path = Padrino.root("public", uri_root_path(asset_folder, bundle.to_s))
53
53
  path += ".#{kind}" unless path =~ /\.#{kind}/
@@ -64,8 +64,10 @@ module Padrino
64
64
  end
65
65
  source
66
66
  end
67
+ settings.compressor[:css] ||= YUI::CssCompressor.new(:line_break => 8000)
68
+ settings.compressor[:js] ||= YUI::JavaScriptCompressor.new(:line_break => 8000)
67
69
  Dir.mkdir(File.dirname(path)) unless File.exist?(File.dirname(path))
68
- File.open(path, "w") { |f| f.write(compressor.compress(sources.join("\n"))) }
70
+ File.open(path, "w") { |f| f.write(settings.compressor[kind].compress(sources.join("\n"))) }
69
71
  logger.debug "Compressed (%0.2fms) %s" % [Time.now-began_at, path] if defined?(logger)
70
72
  bundle
71
73
  end
@@ -6,7 +6,7 @@
6
6
  #
7
7
  module Padrino
8
8
  module Contrib
9
- VERSION = '0.0.4' unless defined?(Padrino::Contrib::VERSION)
9
+ VERSION = '0.0.5' unless defined?(Padrino::Contrib::VERSION)
10
10
  ##
11
11
  # Return the current Padrino version
12
12
  #
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Padrino Team
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-04-03 00:00:00 +02:00
21
+ date: 2011-04-04 00:00:00 +02:00
22
22
  default_executable:
23
23
  dependencies: []
24
24