francois-ad_gear_client 0.3.4 → 0.3.5
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/Rakefile +1 -0
- data/VERSION +1 -1
- data/ad_gear_client.gemspec +1 -1
- data/lib/ad_gear/config.rb +1 -1
- data/lib/ad_gear.rb +2 -0
- data/test/ad_gear/config_test.rb +14 -2
- metadata +1 -1
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5
|
data/ad_gear_client.gemspec
CHANGED
data/lib/ad_gear/config.rb
CHANGED
@@ -48,7 +48,7 @@ module AdGear
|
|
48
48
|
elsif obj.respond_to?(:read) then
|
49
49
|
YAML.load(ERB.new(obj.read).result)
|
50
50
|
else
|
51
|
-
YAML.
|
51
|
+
YAML.load(ERB.new(IO.read(obj)).result)
|
52
52
|
end
|
53
53
|
if environment then
|
54
54
|
raise MissingEnvironmentSpecification, "Could not find #{environment.to_s.inspect} in #{config.inspect} read from #{obj.inspect}. Add the missing environment declaration, or change the parameter to this method." unless config.respond_to?(:has_key?) && config.has_key?(environment.to_s)
|
data/lib/ad_gear.rb
CHANGED
@@ -33,6 +33,7 @@ module AdGear
|
|
33
33
|
autoload :Base, "ad_gear/base"
|
34
34
|
|
35
35
|
# AdGear models themselves
|
36
|
+
autoload :Advertiser, "ad_gear/advertiser"
|
36
37
|
autoload :Site, "ad_gear/site"
|
37
38
|
autoload :AdSpot, "ad_gear/ad_spot"
|
38
39
|
autoload :AdSpotMembership, "ad_gear/ad_spot_membership"
|
@@ -89,6 +90,7 @@ module AdGear
|
|
89
90
|
AdGear::Base.use_digest_authentication = config.use_digest_authentication
|
90
91
|
end
|
91
92
|
|
93
|
+
# TODO: Programatically determine if we can use Nokogiri
|
92
94
|
ActiveSupport::XmlMini.backend = "Nokogiri"
|
93
95
|
|
94
96
|
# Can't require before now, because our own method is overwritten
|
data/test/ad_gear/config_test.rb
CHANGED
@@ -14,6 +14,18 @@ class AdGear::ConfigTest < Test::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
should "pass a file's content through ERB before evaluating configuration" do
|
18
|
+
conf = {"user" => "<%= :whoami %>"}
|
19
|
+
econf = {"user" => "whoami"}
|
20
|
+
Tempfile.open("config") do |io|
|
21
|
+
io.write conf.to_yaml
|
22
|
+
io.close
|
23
|
+
|
24
|
+
aconf = AdGear::Config.new(io.path)
|
25
|
+
assert_equal econf, aconf.to_hash
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
17
29
|
should "read a stream" do
|
18
30
|
econf = {"site" => "http://whatever.com/", "user" => "francois", "password" => "many"}
|
19
31
|
Tempfile.open("config") do |io|
|
@@ -58,8 +70,8 @@ class AdGear::ConfigTest < Test::Unit::TestCase
|
|
58
70
|
end
|
59
71
|
|
60
72
|
should "instantiate a Logger for the file named 'log/adgear.log' when the key is 'log/adgear.log'" do
|
61
|
-
Logger.expects(:new).with("log/adgear.log").returns(mock("Logger"))
|
62
|
-
AdGear::Config.new(StringIO.new({"logger" => "log/adgear.log"}.to_yaml))
|
73
|
+
Logger.expects(:new).with(File.join(Dir.pwd, "log/adgear.log")).returns(mock("Logger"))
|
74
|
+
AdGear::Config.new(StringIO.new({"logger" => File.join(Dir.pwd, "log/adgear.log")}.to_yaml))
|
63
75
|
end
|
64
76
|
|
65
77
|
should "pass the config file through ERB before using the values" do
|