snatch 1.0.2 → 1.0.3

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/README.rdoc CHANGED
@@ -1,19 +1,17 @@
1
1
  = snatch
2
2
 
3
- Ruby wrapper around wget to recursively download a site and copy it in to a public directory, typically within Rails.
3
+ *Snatch* a site.
4
4
 
5
- We use this gem to download the static files produced by a CMS used by our Marketing department and then serve them using Rack within our Rails app.
5
+ snatch = Snatch.new
6
+ snatch.run
6
7
 
7
- == Note on Patches/Pull Requests
8
-
9
- * Fork the project.
10
- * Make your feature addition or bug fix.
11
- * Add tests for it. This is important so I don't break it in a
12
- future version unintentionally.
13
- * Commit, do not mess with rakefile, version, or history.
14
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
15
- * Send me a pull request. Bonus points for topic branches.
8
+ Usage:
9
+ snatch.rb [OPTIONS] SITE_URI(s)
16
10
 
17
- == Copyright
11
+ Specific Options:
12
+ -w, --wget Specify the full path to the wget binary (Must be at least version 1.12.)
13
+ -g, --git Specify the full path to the git binary.
14
+ Common Options:
15
+ -h, --help Show this message.
18
16
 
19
- Copyright (c) 2010 AlphaSights. See LICENSE for details.
17
+ You can pass multiple URIs to snatch.rb. You need to have wget v1.12 and git installed within $PATH. snatch.rb will optionally search for wget and git if they can not be found.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
data/lib/snatch/clean.rb CHANGED
@@ -20,7 +20,7 @@ class Snatch
20
20
  CSS.update(@doc, @working_directory)
21
21
  HTML.update(@doc, @working_directory)
22
22
 
23
- File.open(@file_name, 'w') { |f| f.write @doc.to_html }
23
+ File.open(@file_name, 'w') { |f| f.write @doc.to_xhtml }
24
24
  end
25
25
  end
26
26
  end
@@ -2,9 +2,9 @@ class Snatch
2
2
  class Clean
3
3
  class HTML
4
4
  module HrefFixMethods
5
- def remove_index_html(a)
6
- a['href'] = a['href'].sub(%r{index\.html?$}, '')
7
- end
5
+ # def remove_index_html(a)
6
+ # a['href'] = a['href'].sub(%r{index\.html?$}, '')
7
+ # end
8
8
 
9
9
  def replace_absolute(a)
10
10
  a['href'] = a['href'].sub(%r{(https?)://#{MARKETING_SITE}/}, '/')
data/snatch.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{snatch}
8
- s.version = "1.0.2"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Conroy-Finn"]
12
- s.date = %q{2010-02-15}
12
+ s.date = %q{2010-02-18}
13
13
  s.description = %q{Simple site downloaded that wraps wget and converts PHP CSS files in to regular CSS files.}
14
14
  s.email = %q{james@logi.cl}
15
15
  s.extra_rdoc_files = [
@@ -33,10 +33,18 @@ describe Snatch::Clean::HTML do
33
33
  describe Snatch::Clean::HTML::HrefFixMethods do
34
34
  subject { mock.extend(Snatch::Clean::HTML::HrefFixMethods) }
35
35
 
36
- it 'should remove a trailing index.html' do
37
- fix_node(:remove_index_html, '<a href="/blah/index.html"></a>') do |node|
38
- node.should have_href('/blah/')
39
- end
36
+ # it 'should remove a trailing index.html' do
37
+ # fix_node(:remove_index_html, '<a href="/blah/index.html"></a>') do |node|
38
+ # node.should have_href('/blah/')
39
+ # end
40
+ # end
41
+
42
+ it 'should preserve parent directories within a URL' do
43
+ anchor = '<a href="/folder/child/file.extension"></a>'
44
+ doc = Nokogiri::XML(anchor)
45
+ @html.doc = doc
46
+ @html.send(:update)
47
+ @html.doc.to_xhtml.strip.should == '<a href="/folder/child/file.extension"></a>'
40
48
  end
41
49
 
42
50
  it 'should replace an absolute CMS URL with a domainless absolute URL' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Conroy-Finn
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-15 00:00:00 +00:00
12
+ date: 2010-02-18 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency