yahoo_quote 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,4 +4,4 @@
4
4
  Gemfile.lock
5
5
  extras/
6
6
  pkg/*
7
- test/cache/
7
+ test/foo/
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Braulio Carreno
1
+ Copyright (C) 2012 Braulio Carreno
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -37,7 +37,3 @@ Specify a directory to keep a simple file-based cache:
37
37
  ```ruby
38
38
  YahooQuote::Configuration.cache_dir = "/tmp"
39
39
  ```
40
-
41
- ## Copyright
42
-
43
- Copyright (c) 2012 Braulio Carreno. See LICENSE for details.
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  module YahooQuote
2
4
  class Configuration
3
5
 
@@ -6,7 +8,7 @@ module YahooQuote
6
8
  @@cache_dir = nil
7
9
  else
8
10
  path = Pathname.new(path) if path.is_a? String
9
- path.mkdir unless path.directory?
11
+ FileUtils.mkdir_p(path) unless path.directory?
10
12
  @@cache_dir = path
11
13
  end
12
14
  end
@@ -1,3 +1,3 @@
1
1
  module YahooQuote
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -3,20 +3,19 @@ require 'minitest/autorun'
3
3
  require 'pathname'
4
4
  require 'fakeweb'
5
5
 
6
- # TODO test 2 things: make intermediate dirs for cache and permissions
7
-
8
6
  class TestYahooQuote < MiniTest::Unit::TestCase
9
7
  def setup
10
8
  @url_regexp = %r(http://download\.finance\.yahoo\.com/d/quotes\.csv\?)
11
9
  FakeWeb.allow_net_connect = false
12
10
  FakeWeb.register_uri(:get, @url_regexp, :response => File.read("test/fakeweb/aapl_good.csv"))
13
11
 
14
- @cache_dir = Pathname.new('test/cache')
12
+ @base_cache_dir = Pathname.new('test/foo')
13
+ @cache_dir = @base_cache_dir.join('cache')
15
14
  end
16
15
 
17
16
  def remove_dir(dir_path)
18
- return unless dir_path.exist?
19
- dir_path.each_child {|p| p.unlink}
17
+ dir_path.children.select {|p| p.directory?}.each {|f| remove_dir(f)}
18
+ dir_path.children.select {|p| p.file? }.each {|f| f.unlink}
20
19
  dir_path.unlink
21
20
  end
22
21
 
@@ -74,7 +73,7 @@ class TestYahooQuote < MiniTest::Unit::TestCase
74
73
  end
75
74
 
76
75
  def test_create_cache_dir
77
- remove_dir @cache_dir
76
+ remove_dir @base_cache_dir if @base_cache_dir.exist?
78
77
  assert !@cache_dir.exist?
79
78
  YahooQuote::Configuration.cache_dir = @cache_dir
80
79
  assert @cache_dir.exist?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahoo_quote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-22 00:00:00.000000000Z
12
+ date: 2012-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fakeweb
16
- requirement: &2157617700 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2157617700
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: ruby-debug19
27
- requirement: &2157617280 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *2157617280
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description: Easy interaction with Yahoo Finance API
37
47
  email:
38
48
  - bcarreno@yahoo.com
@@ -73,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
83
  version: '0'
74
84
  requirements: []
75
85
  rubyforge_project: yahoo_quote
76
- rubygems_version: 1.8.15
86
+ rubygems_version: 1.8.21
77
87
  signing_key:
78
88
  specification_version: 3
79
89
  summary: Query Yahoo Finance API