kiosk 0.3.5 → 0.3.6

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/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012 Daniel Duvall
1
+ Copyright 2012 The Office of Letters and Light
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/lib/kiosk/cdn.rb CHANGED
@@ -4,10 +4,15 @@ module Kiosk
4
4
 
5
5
  def initialize(config = {})
6
6
  @host = config['host']
7
+
8
+ unless @host.nil? || @host.empty?
9
+ @uri = URI.parse(@host)
10
+ @host_only = @uri.scheme.nil? && @uri.host.nil?
11
+ end
7
12
  end
8
13
 
9
14
  def configured?
10
- @host
15
+ !@uri.nil?
11
16
  end
12
17
 
13
18
  def rewrite_node(node)
@@ -20,7 +25,13 @@ module Kiosk
20
25
 
21
26
  def rewrite_uri(uri)
22
27
  if configured?
23
- uri.host = host
28
+ if @host_only
29
+ uri.host = @host
30
+ else
31
+ uri.scheme = @uri.scheme
32
+ uri.host = @uri.host
33
+ uri.path = "#{@uri.path.sub(/\/$/, '')}#{uri.path}" unless @uri.path.empty? || @uri.path == '/'
34
+ end
24
35
  end
25
36
  uri
26
37
  end
data/lib/kiosk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kiosk
2
- VERSION = '0.3.5'
2
+ VERSION = '0.3.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiosk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-04 00:00:00.000000000 Z
12
+ date: 2013-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  requirements: []
172
172
  rubyforge_project:
173
- rubygems_version: 1.8.24
173
+ rubygems_version: 1.8.25
174
174
  signing_key:
175
175
  specification_version: 3
176
176
  summary: Simple WordPress integration for Ruby applications.