kelredd-useful 0.2.10 → 0.3.0

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.
@@ -78,7 +78,7 @@ module Useful::ErbHelpers::Links
78
78
  # helper to emulate activesupport's 'stylesheet_link_tag'
79
79
  # EX : stylesheet_link_tag 'default'
80
80
  # => <link rel="stylesheet" type="text/css" media="all" href="/stylesheets/default.css">
81
- # EX : stylesheet_link_tag 'default', :environment => 'development'
81
+ # EX : stylesheet_link_tag 'default', :timestamp => true
82
82
  # => <link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/default.css?12345678">
83
83
  # EX : stylesheet_link_tag 'default', :media => 'screen'
84
84
  # => <link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/default.css">
@@ -97,10 +97,10 @@ module Useful::ErbHelpers::Links
97
97
  options[:rel] ||= "stylesheet"
98
98
  options[:type] ||= "text/css"
99
99
  options[:media] ||= "all"
100
- environment = options.delete(:environment)
100
+ timestamp = options.delete(:timestamp)
101
101
  Array(srcs).collect do |src|
102
102
  #TODO: write sinatra helper to auto set env with Sinatra::Application.environment.to_s
103
- options[:href] = build_src_href(src, :default_path => "stylesheets", :extension => ".css", :environment => environment)
103
+ options[:href] = build_src_href(src, :default_path => "stylesheets", :extension => ".css", :timestamp => timestamp)
104
104
  tag(:link, options)
105
105
  end.join("\n")
106
106
  end
@@ -120,10 +120,10 @@ module Useful::ErbHelpers::Links
120
120
  def javascript_include_tag(*args)
121
121
  srcs, options = handle_srcs_options(args)
122
122
  options[:type] ||= "text/javascript"
123
- environment = options.delete(:environment)
123
+ timestamp = options.delete(:timestamp)
124
124
  Array(srcs).collect do |src|
125
125
  #TODO: write sinatra helper to auto set env with Sinatra::Application.environment.to_s
126
- options[:src] = build_src_href(src, :default_path => "javascripts", :extension => ".js", :environment => environment)
126
+ options[:src] = build_src_href(src, :default_path => "javascripts", :extension => ".js", :timestamp => timestamp)
127
127
  tag(:script, options) { '' }
128
128
  end.join("\n")
129
129
  end
@@ -152,6 +152,7 @@ module Useful::ErbHelpers::Links
152
152
  end
153
153
 
154
154
  def build_src_href(src, options)
155
+ options[:timestamp] = Time.now.to_i if options[:timestamp] == true
155
156
  src = src.to_s
156
157
  if src =~ ABSOLUTE_LINK_PATH
157
158
  src
@@ -159,7 +160,7 @@ module Useful::ErbHelpers::Links
159
160
  href = ""
160
161
  href += ['/'].include?(src[0..0]) ? src : "/#{options[:default_path]}/#{src}"
161
162
  href += options[:extension] unless src.include?(options[:extension])
162
- href += "?#{Time.now.to_i}" if options[:environment].to_s == 'development'
163
+ href += "?#{options[:timestamp]}" if options[:timestamp]
163
164
  href
164
165
  end
165
166
  end
@@ -2,8 +2,8 @@ module Useful
2
2
  module Version
3
3
 
4
4
  MAJOR = 0
5
- MINOR = 2
6
- TINY = 10
5
+ MINOR = 3
6
+ TINY = 0
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 10
9
- version: 0.2.10
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kelly Redding
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-02-25 00:00:00 -06:00
17
+ date: 2010-03-07 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency