xipio 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8379aa1e777634d2566586c30b2a7a02e5efcdc2
4
+ data.tar.gz: a36be7d0e61cc8144b16cd51dfd28f0f6448339e
5
+ SHA512:
6
+ metadata.gz: a81413d46aad0d81dc83d6853b83833a5ca96f1ddf05480e12619829ce4de074a063cd6ba4fa076f6692ab23ad7db49dd2c39c833e7c1a5e7fe4dc991702eac3
7
+ data.tar.gz: f5579a34e6b6c5c6f03013490807756068e4d5009e1d4a4c69526835fbc410ae14028a39b779ae43cacc96692ffde5703cf21c96734749413ad05ad628ccbc5d
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xipio.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Philipe Fatio
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # xipio
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/xipio.png)](http://badge.fury.io/rb/xipio)
4
+
5
+ Add xip.io support to your rails app in development mode.
6
+
7
+ ## Description
8
+
9
+ When reading the subdomain of an xip.io request, you will get a different value
10
+ compared to a local pow request. The reason for this is that the tld length is
11
+ 1 by default, but an xip.io request has a tld length of 6. This gem inserts a
12
+ middleware that corrects the tld length config of rails on the fly so that you
13
+ can use local and xip requests at the same time without restarting the server.
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ gem 'xipio', group: :development
20
+
21
+ That's it! There's nothing to configure. It just works out of the box.
22
+
23
+ ## Additional Information
24
+
25
+ ### Maintainers
26
+
27
+ - Philipe Fatio ([@fphilipe](https://github.com/fphilipe))
28
+
29
+ ### License
30
+
31
+ MIT License. Copyright 2013 Philipe Fatio
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ require 'xipio/version'
2
+ require 'xipio/middleware'
3
+ require 'xipio/railtie'
@@ -0,0 +1,13 @@
1
+ module Xipio
2
+ class Middleware
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+
7
+ def call(env)
8
+ tld_length = env['HTTP_HOST'].end_with?('.xip.io') ? 6 : 1
9
+ ActionDispatch::Http::URL.tld_length = tld_length
10
+ @app.call(env)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module Xipio
2
+ class Railtie < ::Rails::Railtie
3
+ initializer 'xipio' do |app|
4
+ app.config.middleware.insert(0, Middleware)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Xipio
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xipio/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'xipio'
8
+ spec.version = Xipio::VERSION
9
+ spec.authors = ['Philipe Fatio']
10
+ spec.email = ['me@phili.pe']
11
+ spec.summary = <<SUMMARY
12
+ Add xip.io support to your rails app in development mode.
13
+ SUMMARY
14
+ spec.description = <<DESC
15
+ When reading the subdomain of an xip.io request, you will get a different value
16
+ compared to a local pow request. The reason for this is that the tld length is
17
+ 1 by default, but an xip.io request has a tld length of 6. This gem inserts a
18
+ middleware that corrects the tld length config of rails on the fly so that you
19
+ can use local and xip requests at the same time without restarting the server.
20
+ DESC
21
+ spec.homepage = 'https://github.com/fphilipe/xipio'
22
+ spec.license = 'MIT'
23
+
24
+ spec.files = `git ls-files`.split($/)
25
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
26
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
27
+ spec.require_paths = ['lib']
28
+
29
+ spec.add_development_dependency 'bundler', '~> 1.3'
30
+ spec.add_development_dependency 'rake'
31
+
32
+ spec.add_dependency 'railties', '>= 3'
33
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xipio
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Philipe Fatio
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
55
+ description: |
56
+ When reading the subdomain of an xip.io request, you will get a different value
57
+ compared to a local pow request. The reason for this is that the tld length is
58
+ 1 by default, but an xip.io request has a tld length of 6. This gem inserts a
59
+ middleware that corrects the tld length config of rails on the fly so that you
60
+ can use local and xip requests at the same time without restarting the server.
61
+ email:
62
+ - me@phili.pe
63
+ executables: []
64
+ extensions: []
65
+ extra_rdoc_files: []
66
+ files:
67
+ - .gitignore
68
+ - Gemfile
69
+ - LICENSE.txt
70
+ - README.md
71
+ - Rakefile
72
+ - lib/xipio.rb
73
+ - lib/xipio/middleware.rb
74
+ - lib/xipio/railtie.rb
75
+ - lib/xipio/version.rb
76
+ - xipio.gemspec
77
+ homepage: https://github.com/fphilipe/xipio
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.0.2
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: Add xip.io support to your rails app in development mode.
101
+ test_files: []