tendersync 1.0.4 → 1.0.5
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/lib/tendersync/runner.rb +1 -0
- data/lib/tendersync/session.rb +8 -4
- data/lib/tendersync.rb +1 -1
- data/tendersync.gemspec +2 -2
- metadata +2 -2
data/lib/tendersync/runner.rb
CHANGED
@@ -179,6 +179,7 @@ class Tendersync::Runner
|
|
179
179
|
end
|
180
180
|
def index
|
181
181
|
groups = settings['groups'].map do |title,regex|
|
182
|
+
raise "No regex specified for #{title}" if !regex || regex.empty?
|
182
183
|
regex = eval(regex) if regex =~ %r{^/.*/[a-z]*$}
|
183
184
|
Tendersync::Document::Group.new title, Regexp.new(regex)
|
184
185
|
end
|
data/lib/tendersync/session.rb
CHANGED
@@ -4,7 +4,7 @@ class Tendersync::Session
|
|
4
4
|
def initialize(site, user, pass)
|
5
5
|
@username = user
|
6
6
|
@password = pass
|
7
|
-
@agent = WWW::Mechanize.new { |a| }
|
7
|
+
@agent = WWW::Mechanize.new { |a| a.auth(user, pass) }
|
8
8
|
@site = site
|
9
9
|
@login_site = "#{site}/login"
|
10
10
|
end
|
@@ -18,7 +18,7 @@ class Tendersync::Session
|
|
18
18
|
login_form['password'] = @password
|
19
19
|
end
|
20
20
|
result = f.submit
|
21
|
-
if result
|
21
|
+
if result.links.find { | l | l.href =~ /forgot_password/}
|
22
22
|
raise Tendersync::Runner::Error, "login failed--bad credentials"
|
23
23
|
end
|
24
24
|
# TODO Check the result for a valid login.
|
@@ -66,7 +66,9 @@ class Tendersync::Session
|
|
66
66
|
sections = all_sections.keys if sections.empty?
|
67
67
|
for section in sections do
|
68
68
|
documents(section).collect do |doc_url|
|
69
|
-
|
69
|
+
page =Tendersync::Document.from_form(section,edit_page_for(doc_url))
|
70
|
+
puts "Section: #{section}, page=#{page.inspect}"
|
71
|
+
doc = page.form_with(:action => /edit/)
|
70
72
|
puts " #{doc.permalink}"
|
71
73
|
doc.save unless $dry_run
|
72
74
|
end
|
@@ -84,7 +86,9 @@ class Tendersync::Session
|
|
84
86
|
end
|
85
87
|
def post(document)
|
86
88
|
login
|
87
|
-
|
89
|
+
page = "#{@site}/faqs/#{document.section}/#{document.permalink}"
|
90
|
+
form = edit_page_for(page).form_with(:action => /edit/)
|
91
|
+
raise "Unable to load form for page: #{page}" unless form
|
88
92
|
document.to_form(form)
|
89
93
|
form.submit unless $dry_run
|
90
94
|
end
|
data/lib/tendersync.rb
CHANGED
data/tendersync.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{tendersync}
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Bill Kayser"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-10-21}
|
10
10
|
s.default_executable = %q{tendersync}
|
11
11
|
s.description = %q{Tendersync is a utility for syncing files from ENTP's Tender site for managing customer facing documentation. It can be used to pull and push documents to a local repository as well as create indexes for each documentation section.
|
12
12
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tendersync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bill Kayser
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|