rails_default_url_options 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +55 -0
- data/lib/rails_default_url_options.rb +16 -2
- data/rails_default_url_options.gemspec +5 -2
- metadata +21 -4
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# (Rails) Default URL Options
|
2
|
+
|
3
|
+
Provide consistent application URLs across your entire codebase.
|
4
|
+
Primarily useful for mailers.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
|
8
|
+
From the command line:
|
9
|
+
|
10
|
+
```bash
|
11
|
+
gem install rails_default_url_options
|
12
|
+
```
|
13
|
+
|
14
|
+
From your `Gemfile`:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'rails_default_url_options'
|
18
|
+
```
|
19
|
+
|
20
|
+
## Setup
|
21
|
+
|
22
|
+
This gem will automatically set up `DefaultUrlOptions` in a Rails
|
23
|
+
web process after the first request. If you'd like to configure it
|
24
|
+
manually, use an initializer.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
# File: config/initializers/default_url_options.rb
|
28
|
+
DefaultUrlOptions.configure (
|
29
|
+
case Rails.env
|
30
|
+
when 'production'
|
31
|
+
{
|
32
|
+
:host => 'app.com',
|
33
|
+
:port => false, # no ports allowed in this one!
|
34
|
+
:protocol => 'https'
|
35
|
+
}
|
36
|
+
when 'staging'
|
37
|
+
{
|
38
|
+
:host => 'staging.app.com',
|
39
|
+
:port => 8080,
|
40
|
+
:protocol => 'http'
|
41
|
+
}
|
42
|
+
else
|
43
|
+
{
|
44
|
+
:host => '0.0.0.0',
|
45
|
+
:port => 3000,
|
46
|
+
:protocol => 'http'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
)
|
50
|
+
```
|
51
|
+
|
52
|
+
## Tips
|
53
|
+
|
54
|
+
Want to call Rails URL helpers from the command line or anywhere in your
|
55
|
+
code? Use [rails_helper](https://github.com/ahoward/rails_helper)!
|
@@ -28,12 +28,26 @@
|
|
28
28
|
|
29
29
|
unless defined?(DefaultUrlOptions)
|
30
30
|
|
31
|
-
DefaultUrlOptions =
|
31
|
+
DefaultUrlOptions = (
|
32
|
+
begin
|
33
|
+
require 'map'
|
34
|
+
Map.new
|
35
|
+
rescue
|
36
|
+
Hash.new
|
37
|
+
end
|
38
|
+
)
|
32
39
|
|
33
40
|
def DefaultUrlOptions.version
|
34
|
-
'1.
|
41
|
+
'1.5.0'
|
42
|
+
end
|
43
|
+
|
44
|
+
def DefaultUrlOptions.dependencies
|
45
|
+
{
|
46
|
+
'map' => [ 'map' , ' >= 6.0.0' ] ,
|
47
|
+
}
|
35
48
|
end
|
36
49
|
|
50
|
+
|
37
51
|
def DefaultUrlOptions.configure(request = {})
|
38
52
|
default_url_options = DefaultUrlOptions
|
39
53
|
|
@@ -3,13 +3,14 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "rails_default_url_options"
|
6
|
-
spec.version = "1.
|
6
|
+
spec.version = "1.5.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "rails_default_url_options"
|
9
9
|
spec.description = "description: rails_default_url_options kicks the ass"
|
10
10
|
|
11
11
|
spec.files =
|
12
|
-
["
|
12
|
+
["README.md",
|
13
|
+
"Rakefile",
|
13
14
|
"lib",
|
14
15
|
"lib/rails_default_url_options.rb",
|
15
16
|
"rails_default_url_options.gemspec"]
|
@@ -21,6 +22,8 @@ Gem::Specification::new do |spec|
|
|
21
22
|
spec.test_files = nil
|
22
23
|
|
23
24
|
|
25
|
+
spec.add_dependency(*["map", " >= 6.0.0"])
|
26
|
+
|
24
27
|
|
25
28
|
spec.extensions.push(*[])
|
26
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_default_url_options
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,31 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: map
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 6.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 6.0.0
|
14
30
|
description: ! 'description: rails_default_url_options kicks the ass'
|
15
31
|
email: ara.t.howard@gmail.com
|
16
32
|
executables: []
|
17
33
|
extensions: []
|
18
34
|
extra_rdoc_files: []
|
19
35
|
files:
|
36
|
+
- README.md
|
20
37
|
- Rakefile
|
21
38
|
- lib/rails_default_url_options.rb
|
22
39
|
- rails_default_url_options.gemspec
|
@@ -40,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
57
|
version: '0'
|
41
58
|
requirements: []
|
42
59
|
rubyforge_project: codeforpeople
|
43
|
-
rubygems_version: 1.8.
|
60
|
+
rubygems_version: 1.8.23
|
44
61
|
signing_key:
|
45
62
|
specification_version: 3
|
46
63
|
summary: rails_default_url_options
|