sourcer 0.0.1 → 0.0.2
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/VERSION +1 -1
- data/bin/sourcer +1 -1
- data/lib/sourcer.rb +6 -4
- data/sourcer.gemspec +1 -1
- data/spec/sourcer_spec.rb +3 -3
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/bin/sourcer
CHANGED
data/lib/sourcer.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
require 'optparse'
|
2
2
|
|
3
3
|
class Sourcer
|
4
|
-
attr_accessor :
|
4
|
+
attr_accessor :url, :user_agent, :output
|
5
5
|
|
6
|
-
def initialize(
|
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.
|
14
|
+
self.url = arguments.last
|
14
15
|
end
|
15
16
|
|
16
17
|
def run
|
17
|
-
`curl -A "#{user_agent}" "#{
|
18
|
+
self.output = `curl -A "#{user_agent}" "#{url}"`
|
19
|
+
puts output
|
18
20
|
end
|
19
21
|
|
20
22
|
protected
|
data/sourcer.gemspec
CHANGED
data/spec/sourcer_spec.rb
CHANGED
@@ -4,11 +4,11 @@ require File.join(File.dirname(__FILE__), '..', 'lib', 'sourcer')
|
|
4
4
|
|
5
5
|
describe Sourcer do
|
6
6
|
before do
|
7
|
-
|
8
|
-
@
|
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
|
-
@
|
12
|
+
@sourcer.output.should =~ /Fred Wilson/
|
13
13
|
end
|
14
14
|
end
|