wagon 0.10.5 → 1.0.0
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/Rakefile +1 -0
- data/VERSION +1 -1
- data/bin/wagon +145 -145
- data/gui/Rakefile +5 -0
- data/gui/build.xml +74 -0
- data/gui/build/classes/.netbeans_automatic_build +0 -0
- data/gui/build/classes/org/rubyforge/rawr/Main.class +0 -0
- data/gui/build_configuration.rb +31 -0
- data/gui/icons/monkeybars.icns +0 -0
- data/gui/icons/monkeybars.ico +0 -0
- data/gui/lib/java/jruby-complete.jar +0 -0
- data/gui/lib/java/monkeybars-1.0.4.jar +0 -0
- data/gui/lib/ruby/README.txt +1 -0
- data/gui/manifest.mf +3 -0
- data/gui/nbproject/build-impl.xml +794 -0
- data/gui/nbproject/genfiles.properties +8 -0
- data/gui/nbproject/private/private.properties +3 -0
- data/gui/nbproject/project.properties +67 -0
- data/gui/nbproject/project.xml +13 -0
- data/gui/src/application_controller.rb +4 -0
- data/gui/src/application_view.rb +3 -0
- data/gui/src/main.rb +52 -0
- data/gui/src/manifest.rb +58 -0
- data/gui/src/org/rubyforge/rawr/Main.java +67 -0
- data/gui/src/resolver.rb +33 -0
- data/gui/tasks/monkeybars.rake +89 -0
- data/lib/wagon.rb +12 -10
- data/lib/wagon/address.rb +39 -39
- data/lib/wagon/connection.rb +73 -107
- data/lib/wagon/directory.rb +78 -78
- data/lib/wagon/household.rb +59 -74
- data/lib/wagon/member.rb +10 -10
- data/lib/wagon/page.rb +30 -31
- data/lib/wagon/phone_number.rb +22 -22
- data/lib/wagon/ward.rb +28 -28
- data/spec/wagon/directory_spec.rb +22 -22
- data/spec/wagon/ward_spec.rb +18 -18
- metadata +35 -2
data/lib/wagon/member.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
class Member
|
2
|
-
attr_reader :household, :name, :email
|
3
|
-
|
4
|
-
def initialize(household, name, email)
|
5
|
-
@household, @name, @email = household, name, email
|
6
|
-
end
|
7
|
-
|
8
|
-
def to_s
|
9
|
-
[name, household.name, email.to_s.empty? ? nil : "<#{email}>"].compact.join(" ")
|
10
|
-
end
|
1
|
+
class Member
|
2
|
+
attr_reader :household, :name, :email
|
3
|
+
|
4
|
+
def initialize(household, name, email)
|
5
|
+
@household, @name, @email = household, name, email
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_s
|
9
|
+
[name, household.name, email.to_s.empty? ? nil : "<#{email}>"].compact.join(" ")
|
10
|
+
end
|
11
11
|
end
|
data/lib/wagon/page.rb
CHANGED
@@ -1,31 +1,30 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
|
3
|
-
module Wagon
|
4
|
-
class Page
|
5
|
-
attr_reader :connection
|
6
|
-
|
7
|
-
def initialize(connection, url, parent = nil)
|
8
|
-
@connection, @url, @parent = connection, url, parent
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Wagon
|
4
|
+
class Page
|
5
|
+
attr_reader :connection, :source
|
6
|
+
|
7
|
+
def initialize(connection, url, parent = nil)
|
8
|
+
@connection, @url, @parent = connection, url, parent
|
9
|
+
@source = Future(@url) do |url|
|
10
|
+
Nokogiri::HTML(get(url))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(*args)
|
15
|
+
connection.get(*args)
|
16
|
+
end
|
17
|
+
|
18
|
+
def post(*args)
|
19
|
+
connection.post(*args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def method_missing(method, *args, &block)
|
23
|
+
unless source.respond_to?(method)
|
24
|
+
super(method, *args, &block)
|
25
|
+
else
|
26
|
+
source.send(method, *args, &block)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/wagon/phone_number.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
module Wagon
|
2
|
-
class PhoneNumber
|
3
|
-
attr_reader :type, :value
|
4
|
-
|
5
|
-
def self.extract_from_string(string)
|
6
|
-
string.strip =~ /([\)\(\+\s\-\d]+)(\((.*)\))?$/
|
7
|
-
self.new($3 || 'Home', $1.to_s.strip)
|
8
|
-
end
|
9
|
-
|
10
|
-
def initialize(type, value)
|
11
|
-
@type, @value = type, value
|
12
|
-
end
|
13
|
-
|
14
|
-
def ==(other)
|
15
|
-
type == other.type &&
|
16
|
-
value == other.value
|
17
|
-
end
|
18
|
-
|
19
|
-
def to_s
|
20
|
-
self.value
|
21
|
-
end
|
22
|
-
end
|
1
|
+
module Wagon
|
2
|
+
class PhoneNumber
|
3
|
+
attr_reader :type, :value
|
4
|
+
|
5
|
+
def self.extract_from_string(string)
|
6
|
+
string.strip =~ /([\)\(\+\s\-\d]+)(\((.*)\))?$/
|
7
|
+
self.new($3 || 'Home', $1.to_s.strip)
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(type, value)
|
11
|
+
@type, @value = type, value
|
12
|
+
end
|
13
|
+
|
14
|
+
def ==(other)
|
15
|
+
type == other.type &&
|
16
|
+
value == other.value
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
self.value
|
21
|
+
end
|
22
|
+
end
|
23
23
|
end
|
data/lib/wagon/ward.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
require 'wagon/directory'
|
2
|
-
|
3
|
-
module Wagon
|
4
|
-
class Ward < Page
|
5
|
-
def name
|
6
|
-
@name ||= self.at('a.channeltitle[href^="/units/home"]').inner_text.strip
|
7
|
-
end
|
8
|
-
|
9
|
-
def directory_path
|
10
|
-
@directory_path ||= '/units/a/directory/photoprint/1,10357,605-1-7-197742,00.html'
|
11
|
-
end
|
12
|
-
|
13
|
-
def directory
|
14
|
-
@directory ||= Directory.new(connection, directory_path, self)
|
15
|
-
end
|
16
|
-
|
17
|
-
def households
|
18
|
-
directory.households
|
19
|
-
end
|
20
|
-
|
21
|
-
def members
|
22
|
-
households.collect(&:members).flatten()
|
23
|
-
end
|
24
|
-
|
25
|
-
def to_pdf(options)
|
26
|
-
directory.to_pdf(options)
|
27
|
-
end
|
28
|
-
end
|
1
|
+
require 'wagon/directory'
|
2
|
+
|
3
|
+
module Wagon
|
4
|
+
class Ward < Page
|
5
|
+
def name
|
6
|
+
@name ||= self.at('a.channeltitle[href^="/units/home"]').inner_text.strip
|
7
|
+
end
|
8
|
+
|
9
|
+
def directory_path
|
10
|
+
@directory_path ||= '/units/a/directory/photoprint/1,10357,605-1-7-197742,00.html'
|
11
|
+
end
|
12
|
+
|
13
|
+
def directory
|
14
|
+
@directory ||= Directory.new(connection, directory_path, self)
|
15
|
+
end
|
16
|
+
|
17
|
+
def households
|
18
|
+
directory.households
|
19
|
+
end
|
20
|
+
|
21
|
+
def members
|
22
|
+
households.collect(&:members).flatten()
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_pdf(options)
|
26
|
+
directory.to_pdf(options)
|
27
|
+
end
|
28
|
+
end
|
29
29
|
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
|
2
|
-
|
3
|
-
describe "Wagon::Directory" do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@directory = Wagon::Directory.new($user, $user.ward.directory_path, $user.ward)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should find the photo directory link" do
|
10
|
-
@directory.instance_variable_get(:@url).should_not be_nil
|
11
|
-
@directory.instance_variable_get(:@url).should match(%r{^/units/a/directory/photoprint})
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should be able to generate a pdf" do
|
15
|
-
lambda { @directory.to_pdf.render_file("./photo_directory.pdf") }.should_not raise_error
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should parse out the households correctly" do
|
19
|
-
@directory.households.should have_at_least(10).items
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
|
2
|
+
|
3
|
+
describe "Wagon::Directory" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@directory = Wagon::Directory.new($user, $user.ward.directory_path, $user.ward)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should find the photo directory link" do
|
10
|
+
@directory.instance_variable_get(:@url).should_not be_nil
|
11
|
+
@directory.instance_variable_get(:@url).should match(%r{^/units/a/directory/photoprint})
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should be able to generate a pdf" do
|
15
|
+
lambda { @directory.to_pdf.render_file("./photo_directory.pdf") }.should_not raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should parse out the households correctly" do
|
19
|
+
@directory.households.should have_at_least(10).items
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/spec/wagon/ward_spec.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
|
2
|
-
|
3
|
-
describe "Wagon::Ward" do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@page = Wagon::Ward.new($user, $user.home_path)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should have a name" do
|
10
|
-
@page.name.to_s.should_not be_empty
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should find the directory link" do
|
14
|
-
@page.directory_path.should_not be_nil
|
15
|
-
@page.directory_path.should match(%r{^/units/a/directory})
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
|
2
|
+
|
3
|
+
describe "Wagon::Ward" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@page = Wagon::Ward.new($user, $user.home_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should have a name" do
|
10
|
+
@page.name.to_s.should_not be_empty
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should find the directory link" do
|
14
|
+
@page.directory_path.should_not be_nil
|
15
|
+
@page.directory_path.should match(%r{^/units/a/directory})
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wagon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Devin Christensen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-12 00:00:00 -07:00
|
13
13
|
default_executable: wagon
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,6 +42,16 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 0.5.1
|
44
44
|
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: queue_to_the_future
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.1.0
|
54
|
+
version:
|
45
55
|
- !ruby/object:Gem::Dependency
|
46
56
|
name: rspec
|
47
57
|
type: :development
|
@@ -80,6 +90,29 @@ files:
|
|
80
90
|
- VERSION
|
81
91
|
- bin/wagon
|
82
92
|
- extra/placeholder.jpg
|
93
|
+
- gui/Rakefile
|
94
|
+
- gui/build.xml
|
95
|
+
- gui/build/classes/.netbeans_automatic_build
|
96
|
+
- gui/build/classes/org/rubyforge/rawr/Main.class
|
97
|
+
- gui/build_configuration.rb
|
98
|
+
- gui/icons/monkeybars.icns
|
99
|
+
- gui/icons/monkeybars.ico
|
100
|
+
- gui/lib/java/jruby-complete.jar
|
101
|
+
- gui/lib/java/monkeybars-1.0.4.jar
|
102
|
+
- gui/lib/ruby/README.txt
|
103
|
+
- gui/manifest.mf
|
104
|
+
- gui/nbproject/build-impl.xml
|
105
|
+
- gui/nbproject/genfiles.properties
|
106
|
+
- gui/nbproject/private/private.properties
|
107
|
+
- gui/nbproject/project.properties
|
108
|
+
- gui/nbproject/project.xml
|
109
|
+
- gui/src/application_controller.rb
|
110
|
+
- gui/src/application_view.rb
|
111
|
+
- gui/src/main.rb
|
112
|
+
- gui/src/manifest.rb
|
113
|
+
- gui/src/org/rubyforge/rawr/Main.java
|
114
|
+
- gui/src/resolver.rb
|
115
|
+
- gui/tasks/monkeybars.rake
|
83
116
|
- lib/wagon.rb
|
84
117
|
- lib/wagon/address.rb
|
85
118
|
- lib/wagon/connection.rb
|