ECS 0.1.3 → 0.1.4
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 +4 -0
- data/lib/ecs.rb +2 -1
- data/test/unit/ecs_test.rb +24 -2
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/ecs.rb
CHANGED
@@ -7,6 +7,7 @@ require 'xml/libxml'
|
|
7
7
|
require 'digest/md5'
|
8
8
|
require 'net/http'
|
9
9
|
require 'erb'
|
10
|
+
require 'fileutils'
|
10
11
|
|
11
12
|
module ECS
|
12
13
|
Dir[File.join( File.dirname( __FILE__ ), "*.rb" )].each { |f| require f }
|
@@ -105,7 +106,7 @@ module ECS
|
|
105
106
|
end
|
106
107
|
def self.cache_directory=( d='' )
|
107
108
|
directory = File.expand_path( d )
|
108
|
-
|
109
|
+
FileUtils.mkdir_p( directory ) unless File.exist?( directory )
|
109
110
|
raise( "#{directory} is not a suitable cache directory" ) unless File.writable?( directory ) && File.directory?( directory )
|
110
111
|
@@cache_directory = directory
|
111
112
|
end
|
data/test/unit/ecs_test.rb
CHANGED
@@ -142,10 +142,32 @@ class ECSTest < Test::Unit::TestCase
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def test_cache_directory
|
145
|
+
testdir = File.expand_path( File.join( File.dirname( __FILE__ ), 'test' ) )
|
146
|
+
|
147
|
+
assert !File.exist?( testdir )
|
145
148
|
assert_nothing_raised do
|
146
|
-
ECS.cache_directory =
|
149
|
+
ECS.cache_directory = testdir
|
150
|
+
end
|
151
|
+
assert File.exist?( testdir )
|
152
|
+
assert_equal testdir, ECS.cache_directory
|
153
|
+
|
154
|
+
|
155
|
+
additions = [ 'three', 'or', 'four', 'more' ]
|
156
|
+
second_testdir = File.join( testdir, additions.join( '/') )
|
157
|
+
|
158
|
+
assert !File.exist?( second_testdir )
|
159
|
+
assert_nothing_raised do
|
160
|
+
ECS.cache_directory = second_testdir
|
161
|
+
end
|
162
|
+
assert File.exist?( second_testdir )
|
163
|
+
assert_equal second_testdir, ECS.cache_directory
|
164
|
+
|
165
|
+
|
166
|
+
Dir.rmdir( second_testdir )
|
167
|
+
while additions.size > 0
|
168
|
+
additions.pop
|
169
|
+
Dir.rmdir( File.join( testdir, additions.join( '/' ) ) )
|
147
170
|
end
|
148
|
-
assert_equal File.join( Dir.getwd, 'test' ), ECS.cache_directory
|
149
171
|
|
150
172
|
assert_raises RuntimeError do
|
151
173
|
ECS.cache_directory = '/usr/bin'
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ECS
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-03-
|
6
|
+
version: 0.1.4
|
7
|
+
date: 2007-03-14 00:00:00 -07:00
|
8
8
|
summary: A Ruby interface to Amazon's E-Commerce Service.
|
9
9
|
require_paths:
|
10
10
|
- lib
|