fetcher 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
File without changes
File without changes
@@ -1,6 +1,6 @@
1
- History.markdown
1
+ HISTORY.md
2
2
  Manifest.txt
3
- README.markdown
3
+ README.md
4
4
  Rakefile
5
5
  bin/fetch
6
6
  lib/fetcher.rb
@@ -8,3 +8,5 @@ lib/fetcher/cli/opts.rb
8
8
  lib/fetcher/cli/runner.rb
9
9
  lib/fetcher/version.rb
10
10
  lib/fetcher/worker.rb
11
+ test/helper.rb
12
+ test/test_get.rb
File without changes
data/Rakefile CHANGED
@@ -2,9 +2,9 @@ require 'hoe'
2
2
  require './lib/fetcher/version.rb'
3
3
 
4
4
  Hoe.spec 'fetcher' do
5
-
5
+
6
6
  self.version = Fetcher::VERSION
7
-
7
+
8
8
  self.summary = 'fetcher - Fetch Text Documents or Binary Blobs via HTTP, HTTPS'
9
9
  self.description = summary
10
10
 
@@ -14,8 +14,8 @@ Hoe.spec 'fetcher' do
14
14
  self.email = 'webslideshow@googlegroups.com'
15
15
 
16
16
  # switch extension to .markdown for gihub formatting
17
- self.readme_file = 'README.markdown'
18
- self.history_file = 'History.markdown'
17
+ self.readme_file = 'README.md'
18
+ self.history_file = 'HISTORY.md'
19
19
 
20
20
  self.extra_deps = [
21
21
  ['logutils', '>= 0.6']
@@ -33,9 +33,14 @@ module Fetcher
33
33
 
34
34
  # version string for generator meta tag (includes ruby version)
35
35
  def self.banner
36
- "fetcher #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
36
+ "fetcher/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
37
37
  end
38
38
 
39
+ def self.root
40
+ "#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
41
+ end
42
+
43
+
39
44
  def self.main
40
45
 
41
46
  ## NB: only load (require) cli code if called
@@ -53,6 +58,7 @@ module Fetcher
53
58
  Runner.new.run(args)
54
59
  end
55
60
 
61
+ #############################
56
62
  # convenience shortcuts
57
63
 
58
64
  def self.copy( src, dest )
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Fetcher
3
3
 
4
- VERSION = '0.4.2'
4
+ VERSION = '0.4.3'
5
5
 
6
6
  end # module Fetcher
7
7
 
@@ -0,0 +1,15 @@
1
+
2
+ ## $:.unshift(File.dirname(__FILE__))
3
+
4
+ ## minitest setup
5
+
6
+ # require 'minitest/unit'
7
+ require 'minitest/autorun'
8
+
9
+ # include MiniTest::Unit # lets us use TestCase instead of MiniTest::Unit::TestCase
10
+
11
+
12
+ ## our own code
13
+
14
+ require 'fetcher'
15
+
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+
3
+ require 'helper'
4
+
5
+ class TestGet < MiniTest::Unit::TestCase
6
+
7
+ def test_get
8
+ url = 'https://raw.github.com/rubylibs/fetcher/master/README.md'
9
+ worker = Fetcher::Worker.new
10
+ res = worker.get( url )
11
+ pp res
12
+
13
+ assert_equal '200', res.code # note: returned code is a string e.g. '200' not 200
14
+ assert_equal 'OK', res.message
15
+ assert_equal 'text/plain', res.content_type
16
+ assert_equal File.read( './README.md' ), res.body # local README.md should match remote README.md
17
+ end
18
+
19
+ def test_get_with_socket_error
20
+ url = 'http://pragdave.blogs.pragprog.com/pragdave/atom.xml'
21
+ worker = Fetcher::Worker.new
22
+
23
+ # note: will raise SocketError -- getaddrinfo: Name or service not known
24
+ assert_raises( SocketError ) do
25
+ res = worker.get( url )
26
+ pp res
27
+ end
28
+ end
29
+
30
+ def test_get_not_found
31
+ url = 'http://blog.engineyard.com/category/ruby/feed'
32
+ worker = Fetcher::Worker.new
33
+ res = worker.get( url )
34
+ pp res
35
+
36
+ # note: feed link/url no longer exists, thus, 404 -- not found
37
+ assert_equal '404', res.code
38
+ end
39
+
40
+
41
+ end # class TestCopy
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fetcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
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: 2013-11-01 00:00:00.000000000 Z
12
+ date: 2014-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: logutils
16
- requirement: &83360190 !ruby/object:Gem::Requirement
16
+ requirement: &81882710 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.6'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *83360190
24
+ version_requirements: *81882710
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &83359720 !ruby/object:Gem::Requirement
27
+ requirement: &81882450 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.10'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *83359720
35
+ version_requirements: *81882450
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe
38
- requirement: &83359460 !ruby/object:Gem::Requirement
38
+ requirement: &81882190 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '3.3'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *83359460
46
+ version_requirements: *81882190
47
47
  description: fetcher - Fetch Text Documents or Binary Blobs via HTTP, HTTPS
48
48
  email: webslideshow@googlegroups.com
49
49
  executables:
@@ -52,9 +52,9 @@ extensions: []
52
52
  extra_rdoc_files:
53
53
  - Manifest.txt
54
54
  files:
55
- - History.markdown
55
+ - HISTORY.md
56
56
  - Manifest.txt
57
- - README.markdown
57
+ - README.md
58
58
  - Rakefile
59
59
  - bin/fetch
60
60
  - lib/fetcher.rb
@@ -62,13 +62,16 @@ files:
62
62
  - lib/fetcher/cli/runner.rb
63
63
  - lib/fetcher/version.rb
64
64
  - lib/fetcher/worker.rb
65
+ - test/helper.rb
66
+ - test/test_get.rb
67
+ - .gemtest
65
68
  homepage: https://github.com/rubylibs/fetcher
66
69
  licenses:
67
70
  - Public Domain
68
71
  post_install_message:
69
72
  rdoc_options:
70
73
  - --main
71
- - README.markdown
74
+ - README.md
72
75
  require_paths:
73
76
  - lib
74
77
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -89,4 +92,5 @@ rubygems_version: 1.8.17
89
92
  signing_key:
90
93
  specification_version: 3
91
94
  summary: fetcher - Fetch Text Documents or Binary Blobs via HTTP, HTTPS
92
- test_files: []
95
+ test_files:
96
+ - test/test_get.rb