sourcer 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -3,4 +3,4 @@
3
3
  require 'rubygems'
4
4
  require 'sourcer'
5
5
 
6
- Sourcer.new(STDIN, ARGV).run
6
+ Sourcer.new(ARGV).run
@@ -1,20 +1,22 @@
1
1
  require 'optparse'
2
2
 
3
3
  class Sourcer
4
- attr_accessor :site, :user_agent
4
+ attr_accessor :url, :user_agent, :output
5
5
 
6
- def initialize(stdin, arguments = [])
6
+ def initialize(arguments)
7
7
  self.user_agent = iphone
8
8
 
9
9
  options = OptionParser.new
10
+ options.banner = "Usage: sourcer [options]"
10
11
  options.on('-A', '--user-agent') { self.user_agent = a }
11
12
  options.parse!(arguments)
12
13
 
13
- self.site = stdin.gets.chomp
14
+ self.url = arguments.last
14
15
  end
15
16
 
16
17
  def run
17
- `curl -A "#{user_agent}" "#{site}"`
18
+ self.output = `curl -A "#{user_agent}" "#{url}"`
19
+ puts output
18
20
  end
19
21
 
20
22
  protected
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sourcer}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Croak"]
@@ -4,11 +4,11 @@ require File.join(File.dirname(__FILE__), '..', 'lib', 'sourcer')
4
4
 
5
5
  describe Sourcer do
6
6
  before do
7
- stdin = StringIO.new("http://www.avc.com\n")
8
- @source = Sourcer.new(stdin).run
7
+ @sourcer = Sourcer.new(["http://www.avc.com\n"])
8
+ @sourcer.run
9
9
  end
10
10
 
11
11
  it "should output the iphone body" do
12
- @source.should =~ /Fred Wilson/
12
+ @sourcer.output.should =~ /Fred Wilson/
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sourcer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak