tendersync 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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 =~ /unable to login/i
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
- doc = Tendersync::Document.from_form(section,edit_page_for(doc_url).form_with(:action => /edit/))
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
- form = edit_page_for("#{@site}/faqs/#{document.section}/#{document.permalink}").form_with(:action => /edit/)
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
@@ -2,5 +2,5 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module Tendersync
5
- VERSION = '1.0.4'
5
+ VERSION = '1.0.5'
6
6
  end
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.4"
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-08-26}
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
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-08-26 00:00:00 -07:00
12
+ date: 2009-10-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency