tobacco 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/.travis.yml +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +319 -0
- data/Rakefile +9 -0
- data/lib/tobacco/burnout.rb +28 -0
- data/lib/tobacco/error.rb +38 -0
- data/lib/tobacco/exhaler.rb +26 -0
- data/lib/tobacco/inhaler.rb +13 -0
- data/lib/tobacco/roller.rb +38 -0
- data/lib/tobacco/smoker.rb +141 -0
- data/lib/tobacco/version.rb +3 -0
- data/lib/tobacco.rb +46 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/vcr_cassettes/url_content.yml +72 -0
- data/spec/tobacco/burnout_spec.rb +51 -0
- data/spec/tobacco/error_spec.rb +86 -0
- data/spec/tobacco/exhaler_spec.rb +63 -0
- data/spec/tobacco/inhaler_spec.rb +38 -0
- data/spec/tobacco/roller_spec.rb +108 -0
- data/spec/tobacco/smoker_spec.rb +204 -0
- data/spec/tobacco_spec.rb +61 -0
- data/tobacco.gemspec +24 -0
- metadata +160 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples_for "it's configured" do
|
4
|
+
before do
|
5
|
+
Tobacco.configure do |config|
|
6
|
+
config.published_host = published_host
|
7
|
+
config.base_path = base_path
|
8
|
+
config.content_method = content_method
|
9
|
+
config.content_url_method = content_url_method
|
10
|
+
config.output_filepath_method = output_filepath_method
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'sets the publish host' do
|
15
|
+
Tobacco.published_host.should == published_host
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'sets the base path' do
|
19
|
+
Tobacco.base_path.should == base_path
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'sets the content method' do
|
23
|
+
Tobacco.content_method.should == content_method
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'sets the content url method' do
|
27
|
+
Tobacco.content_url_method.should == content_url_method
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'sets the output filepath method' do
|
31
|
+
Tobacco.output_filepath_method.should == output_filepath_method
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
describe Tobacco do
|
37
|
+
|
38
|
+
context 'configuration' do
|
39
|
+
|
40
|
+
context 'has default values when config option not set' do
|
41
|
+
let(:published_host) { 'http://localhost:3000' }
|
42
|
+
let(:base_path) { '/tmp/published_content' }
|
43
|
+
let(:content_method) { :content }
|
44
|
+
let(:content_url_method) { :content_url }
|
45
|
+
let(:output_filepath_method) { :output_filepath }
|
46
|
+
|
47
|
+
it_behaves_like "it's configured"
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'configuration options override defaults' do
|
51
|
+
let(:published_host) { 'http://localhost' }
|
52
|
+
let(:base_path) { 'pub_content' }
|
53
|
+
let(:content_method) { :data }
|
54
|
+
let(:content_url_method) { :url }
|
55
|
+
let(:output_filepath_method) { :out_filepath }
|
56
|
+
|
57
|
+
it_behaves_like "it's configured"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
data/tobacco.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tobacco/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "tobacco"
|
8
|
+
gem.version = Tobacco::VERSION
|
9
|
+
gem.authors = ["Craig Williams"]
|
10
|
+
gem.email = ["cwilliams.allancraig@gmail.com"]
|
11
|
+
gem.description = %q{Url content fetcher and file writer}
|
12
|
+
gem.summary = %q{File writer that can read from a url or take a string and write to file}
|
13
|
+
gem.homepage = "https://github.com/CraigWilliams/Tobacco"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.test_files = gem.files.grep(%r{^(spec)/})
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
gem.add_development_dependency 'rspec'
|
20
|
+
gem.add_development_dependency 'pry'
|
21
|
+
gem.add_development_dependency 'vcr'
|
22
|
+
gem.add_development_dependency 'fakeweb'
|
23
|
+
gem.add_development_dependency 'rake'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tobacco
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Craig Williams
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: pry
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: vcr
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: fakeweb
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Url content fetcher and file writer
|
95
|
+
email:
|
96
|
+
- cwilliams.allancraig@gmail.com
|
97
|
+
executables: []
|
98
|
+
extensions: []
|
99
|
+
extra_rdoc_files: []
|
100
|
+
files:
|
101
|
+
- .gitignore
|
102
|
+
- .rspec
|
103
|
+
- .rvmrc
|
104
|
+
- .travis.yml
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- lib/tobacco.rb
|
110
|
+
- lib/tobacco/burnout.rb
|
111
|
+
- lib/tobacco/error.rb
|
112
|
+
- lib/tobacco/exhaler.rb
|
113
|
+
- lib/tobacco/inhaler.rb
|
114
|
+
- lib/tobacco/roller.rb
|
115
|
+
- lib/tobacco/smoker.rb
|
116
|
+
- lib/tobacco/version.rb
|
117
|
+
- spec/spec_helper.rb
|
118
|
+
- spec/support/vcr_cassettes/url_content.yml
|
119
|
+
- spec/tobacco/burnout_spec.rb
|
120
|
+
- spec/tobacco/error_spec.rb
|
121
|
+
- spec/tobacco/exhaler_spec.rb
|
122
|
+
- spec/tobacco/inhaler_spec.rb
|
123
|
+
- spec/tobacco/roller_spec.rb
|
124
|
+
- spec/tobacco/smoker_spec.rb
|
125
|
+
- spec/tobacco_spec.rb
|
126
|
+
- tobacco.gemspec
|
127
|
+
homepage: https://github.com/CraigWilliams/Tobacco
|
128
|
+
licenses: []
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 1.8.24
|
148
|
+
signing_key:
|
149
|
+
specification_version: 3
|
150
|
+
summary: File writer that can read from a url or take a string and write to file
|
151
|
+
test_files:
|
152
|
+
- spec/spec_helper.rb
|
153
|
+
- spec/support/vcr_cassettes/url_content.yml
|
154
|
+
- spec/tobacco/burnout_spec.rb
|
155
|
+
- spec/tobacco/error_spec.rb
|
156
|
+
- spec/tobacco/exhaler_spec.rb
|
157
|
+
- spec/tobacco/inhaler_spec.rb
|
158
|
+
- spec/tobacco/roller_spec.rb
|
159
|
+
- spec/tobacco/smoker_spec.rb
|
160
|
+
- spec/tobacco_spec.rb
|