francois-ad_gear_client 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -20,6 +20,7 @@ begin
20
20
 
21
21
  gem.add_dependency "activeresource", "> 2.0"
22
22
  gem.add_dependency "francois-rest-client", "~> 1"
23
+ gem.add_dependency "nokogiri"
23
24
  end
24
25
 
25
26
  Jeweler::RubyforgeTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ad_gear_client}
5
- s.version = "0.3.4"
5
+ s.version = "0.3.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Fran\303\247ois Beausoleil"]
@@ -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.load_file(ERB.new(obj).result)
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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: francois-ad_gear_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Fran\xC3\xA7ois Beausoleil"