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 CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.1.0 2010-06-23
2
+
3
+ * Add Bulldog.path_root, for specifying per-environment roots.
4
+ * Add :root interpolation key. Replaces :public_path for Rails apps.
5
+
1
6
  == 0.0.15 2010-04-13
2
7
 
3
8
  * Fix image dimensions when exif:Orientation is 8.
@@ -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
  #
@@ -43,7 +43,7 @@ module Bulldog
43
43
  end
44
44
 
45
45
  def path_template
46
- @path_template || Bulldog.default_path_template || File.join(':public_path', url_template)
46
+ @path_template || Bulldog.default_path_template || File.join(':root', url_template)
47
47
  end
48
48
 
49
49
  def url_template
@@ -1,3 +1,11 @@
1
1
  module Bulldog
2
- VERSION = [0, 0, 15]
2
+ VERSION = [0, 1, 0]
3
+
4
+ class << VERSION
5
+ include Comparable
6
+
7
+ def to_s
8
+ join('.')
9
+ end
10
+ end
3
11
  end
@@ -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'
@@ -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 :public_path as Rails.public_path" do
78
+ it "should interpolate :root as Rails.public_path" do
79
79
  init
80
- interpolate("a/:public_path/b").should == "a/PUBLIC/b"
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 public path" do
107
- reflection.path_template.should == ":public_path/configured/url"
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
- - 15
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-04-14 00:00:00 -04:00
17
+ date: 2010-06-23 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency