bulldog 0.0.15 → 0.1.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.
- data/CHANGELOG +5 -0
- data/lib/bulldog.rb +5 -0
- data/lib/bulldog/interpolation.rb +4 -0
- data/lib/bulldog/reflection.rb +1 -1
- data/lib/bulldog/version.rb +9 -1
- data/rails/rails.rb +1 -1
- data/spec/unit/interpolation_spec.rb +5 -0
- data/spec/unit/rails_spec.rb +2 -2
- data/spec/unit/reflection_spec.rb +2 -2
- metadata +3 -3
data/CHANGELOG
CHANGED
data/lib/bulldog.rb
CHANGED
@@ -37,6 +37,11 @@ module Bulldog
|
|
37
37
|
#
|
38
38
|
attr_accessor :default_url_template
|
39
39
|
|
40
|
+
#
|
41
|
+
# The root directory to use for paths.
|
42
|
+
#
|
43
|
+
attr_accessor :path_root
|
44
|
+
|
40
45
|
#
|
41
46
|
# The path to `ffmpeg'. Only required if you use ffmpeg
|
42
47
|
# (processing videos, or retrieving video attributes).
|
@@ -65,6 +65,10 @@ module Bulldog
|
|
65
65
|
raise Error, ":extension interpolation used when file_name not set - if you need to interpolate the url, pass a :basename override"
|
66
66
|
File.extname(basename).sub(/\A\./, '')
|
67
67
|
end
|
68
|
+
|
69
|
+
to_interpolate(:root) do
|
70
|
+
Bulldog.path_root
|
71
|
+
end
|
68
72
|
end
|
69
73
|
|
70
74
|
#
|
data/lib/bulldog/reflection.rb
CHANGED
data/lib/bulldog/version.rb
CHANGED
data/rails/rails.rb
CHANGED
@@ -7,6 +7,7 @@ module Bulldog
|
|
7
7
|
def init(config_path, rails)
|
8
8
|
config = read_config(config_path, rails.env)
|
9
9
|
set_logger(config, rails.logger)
|
10
|
+
Bulldog.path_root = rails.public_path
|
10
11
|
set_attribute config, :default_path_template
|
11
12
|
set_attribute config, :default_url_template
|
12
13
|
set_attribute config, :convert_path
|
@@ -40,7 +41,6 @@ module Bulldog
|
|
40
41
|
def define_interpolations(rails)
|
41
42
|
Bulldog.to_interpolate(:rails_root){rails.root}
|
42
43
|
Bulldog.to_interpolate(:rails_env){rails.env}
|
43
|
-
Bulldog.to_interpolate(:public_path){rails.public_path}
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -104,6 +104,11 @@ describe Interpolation do
|
|
104
104
|
interpolate("a/:extension/b", :basename => 'BASENAME.EXT').should == 'a/FMT/b'
|
105
105
|
end
|
106
106
|
|
107
|
+
it "should interpolate :root as Bulldog.path_root" do
|
108
|
+
Bulldog.path_root = 'TEST'
|
109
|
+
interpolate("a/:root/b").should == 'a/TEST/b'
|
110
|
+
end
|
111
|
+
|
107
112
|
it "should not modify the hash of overrides, if given" do
|
108
113
|
overrides = {:basename => 'BASENAME.EXT'}
|
109
114
|
interpolate("a/:extension/b", overrides).should == 'a/EXT/b'
|
data/spec/unit/rails_spec.rb
CHANGED
@@ -75,9 +75,9 @@ describe Rails do
|
|
75
75
|
interpolate("a/:rails_env/b").should == "a/ENVIRONMENT/b"
|
76
76
|
end
|
77
77
|
|
78
|
-
it "should interpolate :
|
78
|
+
it "should interpolate :root as Rails.public_path" do
|
79
79
|
init
|
80
|
-
interpolate("a/:
|
80
|
+
interpolate("a/:root/b").should == "a/PUBLIC/b"
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -103,8 +103,8 @@ describe Reflection do
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
it "should return the URL prefixed with the
|
107
|
-
reflection.path_template.should == ":
|
106
|
+
it "should return the URL prefixed with the root" do
|
107
|
+
reflection.path_template.should == ":root/configured/url"
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.15
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- George Ogata
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-23 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|