right_scraper 1.0.26 → 3.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/Gemfile +16 -0
- data/README.rdoc +9 -28
- data/Rakefile +51 -39
- data/lib/right_scraper/builders/base.rb +64 -0
- data/lib/right_scraper/builders/filesystem.rb +96 -0
- data/lib/right_scraper/builders/union.rb +57 -0
- data/lib/right_scraper/logger.rb +102 -0
- data/lib/right_scraper/loggers/noisy.rb +85 -0
- data/lib/right_scraper/processes/ssh.rb +188 -0
- data/lib/right_scraper/repositories/base.rb +299 -0
- data/lib/right_scraper/repositories/download.rb +90 -0
- data/lib/right_scraper/repositories/git.rb +92 -0
- data/lib/right_scraper/repositories/mock.rb +70 -0
- data/lib/right_scraper/repositories/svn.rb +96 -0
- data/lib/right_scraper/resources/base.rb +70 -0
- data/{spec/scraper_base_spec.rb → lib/right_scraper/resources/cookbook.rb} +9 -23
- data/lib/right_scraper/resources/workflow.rb +55 -0
- data/lib/right_scraper/retrievers/base.rb +114 -0
- data/lib/right_scraper/retrievers/checkout.rb +79 -0
- data/lib/right_scraper/retrievers/download.rb +97 -0
- data/lib/right_scraper/retrievers/git.rb +140 -0
- data/lib/right_scraper/retrievers/svn.rb +87 -0
- data/lib/right_scraper/scanners/base.rb +111 -0
- data/lib/right_scraper/scanners/cookbook_manifest.rb +59 -0
- data/lib/right_scraper/scanners/cookbook_metadata.rb +69 -0
- data/lib/right_scraper/scanners/cookbook_s3_upload.rb +84 -0
- data/lib/right_scraper/scanners/union.rb +89 -0
- data/lib/right_scraper/scanners/workflow_manifest.rb +86 -0
- data/lib/right_scraper/scanners/workflow_metadata.rb +70 -0
- data/lib/right_scraper/scanners/workflow_s3_upload.rb +85 -0
- data/lib/right_scraper/scraper.rb +81 -57
- data/lib/right_scraper/scraper_logger.rb +61 -0
- data/lib/right_scraper/scrapers/base.rb +262 -0
- data/lib/right_scraper/scrapers/cookbook.rb +73 -0
- data/lib/right_scraper/scrapers/workflow.rb +88 -0
- data/lib/right_scraper/svn_client.rb +101 -0
- data/lib/right_scraper/version.rb +28 -0
- data/lib/right_scraper.rb +35 -11
- data/right_scraper.gemspec +26 -13
- data/right_scraper.rconf +13 -0
- data/spec/builder_spec.rb +50 -0
- data/spec/cookbook_helper.rb +73 -0
- data/spec/cookbook_manifest_spec.rb +55 -0
- data/spec/cookbook_s3_upload_spec.rb +152 -0
- data/spec/download/download_retriever_spec.rb +118 -0
- data/spec/download/download_retriever_spec_helper.rb +72 -0
- data/spec/download/download_spec.rb +130 -0
- data/spec/download/multi_dir_spec.rb +106 -0
- data/spec/download/multi_dir_spec_helper.rb +40 -0
- data/spec/git/cookbook_spec.rb +166 -0
- data/spec/git/demokey +27 -0
- data/spec/git/demokey.pub +1 -0
- data/spec/git/password_key +30 -0
- data/spec/git/password_key.pub +1 -0
- data/spec/git/repository_spec.rb +110 -0
- data/spec/git/retriever_spec.rb +505 -0
- data/spec/git/retriever_spec_helper.rb +112 -0
- data/spec/git/scraper_spec.rb +136 -0
- data/spec/git/ssh_spec.rb +170 -0
- data/spec/git/url_spec.rb +103 -0
- data/spec/logger_spec.rb +185 -0
- data/spec/repository_spec.rb +89 -23
- data/spec/{scraper_spec_helper_base.rb → retriever_spec_helper.rb} +41 -27
- data/spec/scanner_spec.rb +61 -0
- data/spec/scraper_helper.rb +96 -0
- data/spec/scraper_spec.rb +123 -45
- data/spec/spec_helper.rb +87 -14
- data/spec/svn/cookbook_spec.rb +97 -0
- data/spec/svn/multi_svn_spec.rb +64 -0
- data/spec/svn/multi_svn_spec_helper.rb +40 -0
- data/spec/svn/repository_spec.rb +72 -0
- data/spec/svn/retriever_spec.rb +261 -0
- data/spec/svn/scraper_spec.rb +90 -0
- data/spec/svn/{svn_scraper_spec_helper.rb → svn_retriever_spec_helper.rb} +46 -27
- data/spec/svn/url_spec.rb +47 -0
- data/spec/url_spec.rb +164 -0
- metadata +203 -31
- data/lib/right_scraper/linux/process_monitor.rb +0 -84
- data/lib/right_scraper/repository.rb +0 -78
- data/lib/right_scraper/scraper_base.rb +0 -175
- data/lib/right_scraper/scrapers/download_scraper.rb +0 -67
- data/lib/right_scraper/scrapers/git_scraper.rb +0 -283
- data/lib/right_scraper/scrapers/svn_scraper.rb +0 -119
- data/lib/right_scraper/watcher.rb +0 -158
- data/lib/right_scraper/win32/process_monitor.rb +0 -98
- data/spec/download/download_scraper_spec.rb +0 -94
- data/spec/git/git_scraper_spec.rb +0 -165
- data/spec/git/git_scraper_spec_helper.rb +0 -72
- data/spec/rcov.opts +0 -1
- data/spec/spec.opts +0 -2
- data/spec/svn/svn_scraper_spec.rb +0 -148
- data/spec/watcher_spec.rb +0 -74
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright: Copyright (c) 2010-2011 RightScale, Inc.
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# 'Software'), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
19
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
20
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
21
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
#++
|
|
23
|
+
|
|
24
|
+
require 'stringio'
|
|
25
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
26
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'svn_retriever_spec_helper'))
|
|
27
|
+
require 'tmpdir'
|
|
28
|
+
require 'flexmock'
|
|
29
|
+
|
|
30
|
+
describe RightScraper::Scraper do
|
|
31
|
+
include RightScraper::SpecHelpers::DevelopmentModeEnvironment
|
|
32
|
+
|
|
33
|
+
include RightScraper::SharedExamples
|
|
34
|
+
|
|
35
|
+
before(:each) do
|
|
36
|
+
@stream = StringIO.new()
|
|
37
|
+
@tmpdir = Dir.mktmpdir
|
|
38
|
+
@scraper = RightScraper::Scraper.new(:basedir => @tmpdir, :kind => :cookbook)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
after(:each) do
|
|
42
|
+
FileUtils.remove_entry_secure @tmpdir
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
context 'given a SVN repository' do
|
|
46
|
+
before(:each) do
|
|
47
|
+
@helper = RightScraper::SvnRetrieverSpecHelper.new
|
|
48
|
+
@repo = @helper.repo
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
after(:each) do
|
|
52
|
+
@helper.close
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it_should_behave_like "a normal repository"
|
|
56
|
+
|
|
57
|
+
it 'should log correctly as it scrapes' do
|
|
58
|
+
callback = flexmock("callback")
|
|
59
|
+
callback.should_receive(:call).with(:begin, :retrieving, "from #{@repo}", nil).once.ordered
|
|
60
|
+
callback.should_receive(:call).with(:begin, :initialize, String, nil).once.ordered
|
|
61
|
+
callback.should_receive(:call).with(:commit, :initialize, String, nil).once.ordered
|
|
62
|
+
callback.should_receive(:call).with(:begin, :checkout, "", nil).once.ordered
|
|
63
|
+
callback.should_receive(:call).with(:begin, :checkout_revision, "", nil).once.ordered
|
|
64
|
+
callback.should_receive(:call).with(:commit, :checkout_revision, "", nil).once.ordered
|
|
65
|
+
callback.should_receive(:call).with(:commit, :checkout, "", nil).once.ordered
|
|
66
|
+
callback.should_receive(:call).with(:commit, :retrieving, "from #{@repo}", nil).once.ordered
|
|
67
|
+
callback.should_receive(:call).with(:begin, :scraping, String, nil).once.ordered
|
|
68
|
+
callback.should_receive(:call).with(:begin, :finding_next_cookbook, String, nil).once.ordered
|
|
69
|
+
callback.should_receive(:call).with(:begin, :reading_cookbook, String, nil).once.ordered
|
|
70
|
+
callback.should_receive(:call).with(:begin, :scanning_filesystem, String, nil).once.ordered
|
|
71
|
+
callback.should_receive(:call).with(:begin, :metadata_parsing, "", nil).once.ordered
|
|
72
|
+
callback.should_receive(:call).with(:commit, :metadata_parsing, "", nil).once.ordered
|
|
73
|
+
callback.should_receive(:call).with(:commit, :scanning_filesystem, String, nil).once.ordered
|
|
74
|
+
callback.should_receive(:call).with(:commit, :reading_cookbook, String, nil).once.ordered
|
|
75
|
+
callback.should_receive(:call).with(:commit, :finding_next_cookbook, String, nil).once.ordered
|
|
76
|
+
callback.should_receive(:call).with(:begin, :next, "", nil).once.ordered
|
|
77
|
+
callback.should_receive(:call).with(:begin, :searching, "", nil).once.ordered
|
|
78
|
+
callback.should_receive(:call).with(:commit, :searching, "", nil).once.ordered
|
|
79
|
+
callback.should_receive(:call).with(:commit, :next, "", nil).once.ordered
|
|
80
|
+
callback.should_receive(:call).with(:begin, :next, "", nil).once.ordered
|
|
81
|
+
callback.should_receive(:call).with(:commit, :next, "", nil).once.ordered
|
|
82
|
+
callback.should_receive(:call).with(:commit, :scraping, String, nil).once.ordered
|
|
83
|
+
@scraper.scrape(@repo) do |phase, operation, explanation, exception|
|
|
84
|
+
callback.call(phase, operation, explanation, exception)
|
|
85
|
+
end
|
|
86
|
+
@scraper.errors.should == []
|
|
87
|
+
@scraper.succeeded?.should be_true
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Copyright: Copyright (c) 2010 RightScale, Inc.
|
|
2
|
+
# Copyright: Copyright (c) 2010-2011 RightScale, Inc.
|
|
3
3
|
#
|
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
5
|
# a copy of this software and associated documentation files (the
|
|
@@ -21,16 +21,25 @@
|
|
|
21
21
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
#++
|
|
23
23
|
|
|
24
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', '
|
|
24
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'retriever_spec_helper'))
|
|
25
|
+
require 'process_watcher'
|
|
25
26
|
|
|
26
|
-
module
|
|
27
|
+
module RightScraper
|
|
27
28
|
|
|
28
|
-
# SVN implementation of
|
|
29
|
+
# SVN implementation of retriever spec helper
|
|
29
30
|
# See parent class for methods headers comments
|
|
30
|
-
class
|
|
31
|
+
class SvnRetrieverSpecHelper < RetrieverSpecHelper
|
|
32
|
+
include RightScraper::SvnClient
|
|
31
33
|
|
|
32
34
|
def svn_repo_path
|
|
33
|
-
|
|
35
|
+
File.join(@tmpdir, "svn")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
attr_reader :repo
|
|
39
|
+
alias_method :repository, :repo
|
|
40
|
+
|
|
41
|
+
def scraper_path
|
|
42
|
+
File.join(@tmpdir, "scraper")
|
|
34
43
|
end
|
|
35
44
|
|
|
36
45
|
def repo_url
|
|
@@ -39,34 +48,44 @@ module RightScale
|
|
|
39
48
|
url = "#{file_prefix}#{svn_repo_path}"
|
|
40
49
|
end
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
alias_method :repo_dir, :repo_path
|
|
52
|
+
|
|
53
|
+
def initialize
|
|
54
|
+
super()
|
|
55
|
+
FileUtils.mkdir(svn_repo_path)
|
|
56
|
+
@repo = RightScraper::Repositories::Base.from_hash(
|
|
57
|
+
:display_name => 'test repo',
|
|
58
|
+
:repo_type => :svn,
|
|
59
|
+
:url => repo_url)
|
|
60
|
+
output, status = ProcessWatcher.run("svnadmin", "create", svn_repo_path)
|
|
61
|
+
raise "Can't create repo: #{output}" if status != 0
|
|
62
|
+
run_svn_no_chdir "checkout", repo_url, repo_path
|
|
63
|
+
make_cookbooks
|
|
51
64
|
commit_content
|
|
52
65
|
end
|
|
53
66
|
|
|
67
|
+
def make_cookbooks
|
|
68
|
+
create_cookbook(repo_path, repo_content)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def delete(location, log="")
|
|
72
|
+
run_svn "delete", location
|
|
73
|
+
end
|
|
74
|
+
|
|
54
75
|
def commit_content(commit_message='commit message')
|
|
55
|
-
Dir.
|
|
56
|
-
|
|
57
|
-
res, status = exec("svn commit --quiet -m \"#{commit_message}\"") if status.success?
|
|
58
|
-
raise "Failed to commit changes from #{branch}: #{res}" unless status.success?
|
|
59
|
-
end
|
|
76
|
+
run_svn "add", Dir.glob(File.join(repo_path, '**/*'))
|
|
77
|
+
run_svn "commit", "--message", commit_message
|
|
60
78
|
end
|
|
61
79
|
|
|
62
80
|
def commit_id(index_from_last=0)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
81
|
+
output = run_svn "log", "-l", (index_from_last + 1).to_s, "-r", "HEAD:0"
|
|
82
|
+
id = nil
|
|
83
|
+
output.split(/\n/).each do |line|
|
|
84
|
+
if line =~ /^r(\d+)/
|
|
85
|
+
id = $1
|
|
86
|
+
end
|
|
67
87
|
end
|
|
68
|
-
|
|
88
|
+
id
|
|
69
89
|
end
|
|
70
|
-
|
|
71
90
|
end
|
|
72
|
-
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright: Copyright (c) 2010-2011 RightScale, Inc.
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# 'Software'), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
19
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
20
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
21
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
#++
|
|
23
|
+
|
|
24
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
25
|
+
|
|
26
|
+
describe RightScraper::Repositories::Svn do
|
|
27
|
+
def make_repo(url)
|
|
28
|
+
@repo = RightScraper::Repositories::Svn.from_hash(:display_name => 'test repo',
|
|
29
|
+
:repo_type => :svn,
|
|
30
|
+
:url => url,
|
|
31
|
+
:first_credential => "foo:b/ar",
|
|
32
|
+
:second_credential => "blah")
|
|
33
|
+
end
|
|
34
|
+
include RightScraper::SpecHelpers::ProductionModeEnvironment
|
|
35
|
+
|
|
36
|
+
it 'should not throw an error when creating a repository for SVN URIs' do
|
|
37
|
+
lambda do
|
|
38
|
+
make_repo "http://rightscale.com/%20CBLAH"
|
|
39
|
+
end.should_not raise_exception
|
|
40
|
+
lambda do
|
|
41
|
+
make_repo "svn://rightscale.com/%20CBLAH"
|
|
42
|
+
end.should_not raise_exception
|
|
43
|
+
lambda do
|
|
44
|
+
make_repo "svn+ssh://rightscale.com/%20CBLAH"
|
|
45
|
+
end.should_not raise_exception
|
|
46
|
+
end
|
|
47
|
+
end
|
data/spec/url_spec.rb
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright: Copyright (c) 2010-2011 RightScale, Inc.
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# 'Software'), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
19
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
20
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
21
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
#++
|
|
23
|
+
|
|
24
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
|
25
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'right_scraper'))
|
|
26
|
+
|
|
27
|
+
describe RightScraper::Repositories::Svn do
|
|
28
|
+
def make_repo(url)
|
|
29
|
+
@repo = RightScraper::Repositories::Svn.from_hash(
|
|
30
|
+
:display_name => 'test repo',
|
|
31
|
+
:repo_type => :download,
|
|
32
|
+
:url => url,
|
|
33
|
+
:first_credential => "foo:b/ar",
|
|
34
|
+
:second_credential => "foo@bar")
|
|
35
|
+
end
|
|
36
|
+
before(:each) do
|
|
37
|
+
@oldtest = ENV['DEVELOPMENT']
|
|
38
|
+
end
|
|
39
|
+
after(:each) do
|
|
40
|
+
if @oldtest.nil?
|
|
41
|
+
ENV.delete('DEVELOPMENT')
|
|
42
|
+
else
|
|
43
|
+
ENV['DEVELOPMENT'] = @oldtest
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
context 'in production mode' do
|
|
48
|
+
before(:each) do
|
|
49
|
+
ENV.delete('DEVELOPMENT')
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'should not throw an error when creating a repository for a normal URI' do
|
|
53
|
+
lambda do
|
|
54
|
+
make_repo "http://rightscale.com/%20CBLAH"
|
|
55
|
+
end.should_not raise_exception
|
|
56
|
+
lambda do
|
|
57
|
+
make_repo "http://172.12.3.42/%20CBLAH"
|
|
58
|
+
end.should_not raise_exception
|
|
59
|
+
lambda do
|
|
60
|
+
make_repo "http://110.12.3.42/%20CBLAH"
|
|
61
|
+
end.should_not raise_exception
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'should refuse to create repositories for hosts that don\'t exist' do
|
|
65
|
+
lambda do
|
|
66
|
+
make_repo "http://nonexistent.invalid/%20CBLAH"
|
|
67
|
+
end.should raise_exception(RuntimeError, /Invalid URI/)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'should refuse to create repositories for private networks' do
|
|
71
|
+
["10.0.2.43", "172.18.3.42", "192.168.4.2"].each do |ip|
|
|
72
|
+
lambda do
|
|
73
|
+
make_repo "http://#{ip}/%20CBLAH"
|
|
74
|
+
end.should raise_exception(RuntimeError, /Invalid URI/)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'should refuse to create repositories for loopback addresses' do
|
|
79
|
+
lambda do
|
|
80
|
+
make_repo "http://localhost/%20CBLAH"
|
|
81
|
+
end.should raise_exception(RuntimeError, /Invalid URI/)
|
|
82
|
+
lambda do
|
|
83
|
+
make_repo "http://127.0.0.1/%20CBLAH"
|
|
84
|
+
end.should raise_exception(RuntimeError, /Invalid URI/)
|
|
85
|
+
lambda do
|
|
86
|
+
make_repo "http://127.3.2.1/%20CBLAH"
|
|
87
|
+
end.should raise_exception(RuntimeError, /Invalid URI/)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'should refuse to create repositories for file:/// URIs' do
|
|
91
|
+
lambda do
|
|
92
|
+
make_repo "file://var/run/something/%20CBLAH"
|
|
93
|
+
end.should raise_exception(RuntimeError, /Invalid URI/)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it 'should refuse to create repositories for our EC2 metadata server' do
|
|
97
|
+
lambda do
|
|
98
|
+
make_repo "http://169.254.169.254/%20CBLAH"
|
|
99
|
+
end.should raise_exception(RuntimeError, /Invalid URI/)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it 'should refuse to create repositories for even valid IPv6 addresses' do
|
|
103
|
+
lambda do
|
|
104
|
+
make_repo "http://[::ffff:128.111.1.1]/%20CBLAH"
|
|
105
|
+
end.should raise_exception(RuntimeError, /Invalid URI/)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
context 'in development mode' do
|
|
110
|
+
before(:each) do
|
|
111
|
+
ENV['DEVELOPMENT'] = "yes"
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it 'should not throw an error when creating a repository for a normal URI' do
|
|
115
|
+
lambda do
|
|
116
|
+
make_repo "http://rightscale.com/%20CBLAH"
|
|
117
|
+
end.should_not raise_exception
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it 'should create repositories for hosts that don\'t exist' do
|
|
121
|
+
lambda do
|
|
122
|
+
make_repo "http://nonexistent.invalid/%20CBLAH"
|
|
123
|
+
end.should_not raise_exception
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it 'should create repositories for private networks' do
|
|
127
|
+
["10.0.2.43", "172.18.3.42", "192.168.4.2"].each do |ip|
|
|
128
|
+
lambda do
|
|
129
|
+
make_repo "http://#{ip}/%20CBLAH"
|
|
130
|
+
end.should_not raise_exception
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it 'should create repositories for loopback addresses' do
|
|
135
|
+
lambda do
|
|
136
|
+
make_repo "http://localhost/%20CBLAH"
|
|
137
|
+
end.should_not raise_exception
|
|
138
|
+
lambda do
|
|
139
|
+
make_repo "http://127.0.0.1/%20CBLAH"
|
|
140
|
+
end.should_not raise_exception
|
|
141
|
+
lambda do
|
|
142
|
+
make_repo "http://127.3.2.1/%20CBLAH"
|
|
143
|
+
end.should_not raise_exception
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
it 'should create repositories for file:/// URIs' do
|
|
147
|
+
lambda do
|
|
148
|
+
make_repo "file://var/run/something/%20CBLAH"
|
|
149
|
+
end.should_not raise_exception
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
it 'should create repositories for our EC2 metadata server' do
|
|
153
|
+
lambda do
|
|
154
|
+
make_repo "http://169.254.169.254/%20CBLAH"
|
|
155
|
+
end.should_not raise_exception
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it 'should create repositories for even valid IPv6 addresses' do
|
|
159
|
+
lambda do
|
|
160
|
+
make_repo "http://[::ffff:128.111.1.1]/%20CBLAH"
|
|
161
|
+
end.should_not raise_exception
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
metadata
CHANGED
|
@@ -1,25 +1,145 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: right_scraper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 7
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
|
-
-
|
|
7
|
+
- 3
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version:
|
|
9
|
+
- 0
|
|
10
|
+
version: 3.0.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
|
+
- Graham Hughes
|
|
13
14
|
- Raphael Simon
|
|
14
15
|
autorequire:
|
|
15
16
|
bindir: bin
|
|
16
17
|
cert_chain: []
|
|
17
18
|
|
|
18
|
-
date:
|
|
19
|
+
date: 2011-09-26 00:00:00 -07:00
|
|
19
20
|
default_executable:
|
|
20
|
-
dependencies:
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
dependencies:
|
|
22
|
+
- !ruby/object:Gem::Dependency
|
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
|
24
|
+
none: false
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
hash: 13
|
|
29
|
+
segments:
|
|
30
|
+
- 1
|
|
31
|
+
- 4
|
|
32
|
+
- 5
|
|
33
|
+
version: 1.4.5
|
|
34
|
+
requirement: *id001
|
|
35
|
+
type: :runtime
|
|
36
|
+
name: json
|
|
37
|
+
prerelease: false
|
|
38
|
+
- !ruby/object:Gem::Dependency
|
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
|
40
|
+
none: false
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
hash: 21
|
|
45
|
+
segments:
|
|
46
|
+
- 1
|
|
47
|
+
- 2
|
|
48
|
+
- 5
|
|
49
|
+
version: 1.2.5
|
|
50
|
+
requirement: *id002
|
|
51
|
+
type: :runtime
|
|
52
|
+
name: git
|
|
53
|
+
prerelease: false
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
|
56
|
+
none: false
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
hash: 25
|
|
61
|
+
segments:
|
|
62
|
+
- 0
|
|
63
|
+
- 1
|
|
64
|
+
- 1
|
|
65
|
+
version: 0.1.1
|
|
66
|
+
requirement: *id003
|
|
67
|
+
type: :runtime
|
|
68
|
+
name: libarchive
|
|
69
|
+
prerelease: false
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
|
72
|
+
none: false
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
hash: 3
|
|
77
|
+
segments:
|
|
78
|
+
- 2
|
|
79
|
+
- 0
|
|
80
|
+
version: "2.0"
|
|
81
|
+
requirement: *id004
|
|
82
|
+
type: :runtime
|
|
83
|
+
name: right_aws
|
|
84
|
+
prerelease: false
|
|
85
|
+
- !ruby/object:Gem::Dependency
|
|
86
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
|
87
|
+
none: false
|
|
88
|
+
requirements:
|
|
89
|
+
- - ~>
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
hash: 13
|
|
92
|
+
segments:
|
|
93
|
+
- 0
|
|
94
|
+
- 3
|
|
95
|
+
version: "0.3"
|
|
96
|
+
requirement: *id005
|
|
97
|
+
type: :runtime
|
|
98
|
+
name: process_watcher
|
|
99
|
+
prerelease: false
|
|
100
|
+
- !ruby/object:Gem::Dependency
|
|
101
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
|
102
|
+
none: false
|
|
103
|
+
requirements:
|
|
104
|
+
- - ">="
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
hash: 3
|
|
107
|
+
segments:
|
|
108
|
+
- 0
|
|
109
|
+
version: "0"
|
|
110
|
+
requirement: *id006
|
|
111
|
+
type: :development
|
|
112
|
+
name: rspec
|
|
113
|
+
prerelease: false
|
|
114
|
+
- !ruby/object:Gem::Dependency
|
|
115
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
|
116
|
+
none: false
|
|
117
|
+
requirements:
|
|
118
|
+
- - ">="
|
|
119
|
+
- !ruby/object:Gem::Version
|
|
120
|
+
hash: 3
|
|
121
|
+
segments:
|
|
122
|
+
- 0
|
|
123
|
+
version: "0"
|
|
124
|
+
requirement: *id007
|
|
125
|
+
type: :development
|
|
126
|
+
name: flexmock
|
|
127
|
+
prerelease: false
|
|
128
|
+
- !ruby/object:Gem::Dependency
|
|
129
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
|
130
|
+
none: false
|
|
131
|
+
requirements:
|
|
132
|
+
- - ">="
|
|
133
|
+
- !ruby/object:Gem::Version
|
|
134
|
+
hash: 3
|
|
135
|
+
segments:
|
|
136
|
+
- 0
|
|
137
|
+
version: "0"
|
|
138
|
+
requirement: *id008
|
|
139
|
+
type: :development
|
|
140
|
+
name: rtags
|
|
141
|
+
prerelease: false
|
|
142
|
+
description: " RightScraper provides a simple interface to download and keep local copies of remote\n repositories up-to-date using the following protocols:\n * git: RightScraper will clone then pull repos from git\n * SVN: RightScraper will checkout then update SVN repositories\n * tarballs: RightScraper will download, optionally uncompress and expand a given tar file\n On top of retrieving remote repositories, right_scraper also include \"scrapers\" that\n will analyze the repository content and instantiate \"resources\" as a result. Currently\n supported resources are Chef cookbooks and RightScale workflow definitions.\n"
|
|
23
143
|
email: raphael@rightscale.com
|
|
24
144
|
executables: []
|
|
25
145
|
|
|
@@ -28,33 +148,83 @@ extensions: []
|
|
|
28
148
|
extra_rdoc_files:
|
|
29
149
|
- README.rdoc
|
|
30
150
|
files:
|
|
151
|
+
- Gemfile
|
|
31
152
|
- LICENSE
|
|
32
153
|
- README.rdoc
|
|
33
154
|
- Rakefile
|
|
34
155
|
- lib/right_scraper.rb
|
|
35
|
-
- lib/right_scraper/
|
|
36
|
-
- lib/right_scraper/
|
|
156
|
+
- lib/right_scraper/builders/base.rb
|
|
157
|
+
- lib/right_scraper/builders/filesystem.rb
|
|
158
|
+
- lib/right_scraper/builders/union.rb
|
|
159
|
+
- lib/right_scraper/logger.rb
|
|
160
|
+
- lib/right_scraper/loggers/noisy.rb
|
|
161
|
+
- lib/right_scraper/processes/ssh.rb
|
|
162
|
+
- lib/right_scraper/repositories/base.rb
|
|
163
|
+
- lib/right_scraper/repositories/download.rb
|
|
164
|
+
- lib/right_scraper/repositories/git.rb
|
|
165
|
+
- lib/right_scraper/repositories/mock.rb
|
|
166
|
+
- lib/right_scraper/repositories/svn.rb
|
|
167
|
+
- lib/right_scraper/resources/base.rb
|
|
168
|
+
- lib/right_scraper/resources/cookbook.rb
|
|
169
|
+
- lib/right_scraper/resources/workflow.rb
|
|
170
|
+
- lib/right_scraper/retrievers/base.rb
|
|
171
|
+
- lib/right_scraper/retrievers/checkout.rb
|
|
172
|
+
- lib/right_scraper/retrievers/download.rb
|
|
173
|
+
- lib/right_scraper/retrievers/git.rb
|
|
174
|
+
- lib/right_scraper/retrievers/svn.rb
|
|
175
|
+
- lib/right_scraper/scanners/base.rb
|
|
176
|
+
- lib/right_scraper/scanners/cookbook_manifest.rb
|
|
177
|
+
- lib/right_scraper/scanners/cookbook_metadata.rb
|
|
178
|
+
- lib/right_scraper/scanners/cookbook_s3_upload.rb
|
|
179
|
+
- lib/right_scraper/scanners/union.rb
|
|
180
|
+
- lib/right_scraper/scanners/workflow_manifest.rb
|
|
181
|
+
- lib/right_scraper/scanners/workflow_metadata.rb
|
|
182
|
+
- lib/right_scraper/scanners/workflow_s3_upload.rb
|
|
37
183
|
- lib/right_scraper/scraper.rb
|
|
38
|
-
- lib/right_scraper/
|
|
39
|
-
- lib/right_scraper/scrapers/
|
|
40
|
-
- lib/right_scraper/scrapers/
|
|
41
|
-
- lib/right_scraper/scrapers/
|
|
42
|
-
- lib/right_scraper/
|
|
43
|
-
- lib/right_scraper/
|
|
184
|
+
- lib/right_scraper/scraper_logger.rb
|
|
185
|
+
- lib/right_scraper/scrapers/base.rb
|
|
186
|
+
- lib/right_scraper/scrapers/cookbook.rb
|
|
187
|
+
- lib/right_scraper/scrapers/workflow.rb
|
|
188
|
+
- lib/right_scraper/svn_client.rb
|
|
189
|
+
- lib/right_scraper/version.rb
|
|
44
190
|
- right_scraper.gemspec
|
|
45
|
-
-
|
|
46
|
-
- spec/
|
|
47
|
-
- spec/
|
|
48
|
-
- spec/
|
|
191
|
+
- right_scraper.rconf
|
|
192
|
+
- spec/builder_spec.rb
|
|
193
|
+
- spec/cookbook_helper.rb
|
|
194
|
+
- spec/cookbook_manifest_spec.rb
|
|
195
|
+
- spec/cookbook_s3_upload_spec.rb
|
|
196
|
+
- spec/download/download_retriever_spec.rb
|
|
197
|
+
- spec/download/download_retriever_spec_helper.rb
|
|
198
|
+
- spec/download/download_spec.rb
|
|
199
|
+
- spec/download/multi_dir_spec.rb
|
|
200
|
+
- spec/download/multi_dir_spec_helper.rb
|
|
201
|
+
- spec/git/cookbook_spec.rb
|
|
202
|
+
- spec/git/demokey
|
|
203
|
+
- spec/git/demokey.pub
|
|
204
|
+
- spec/git/password_key
|
|
205
|
+
- spec/git/password_key.pub
|
|
206
|
+
- spec/git/repository_spec.rb
|
|
207
|
+
- spec/git/retriever_spec.rb
|
|
208
|
+
- spec/git/retriever_spec_helper.rb
|
|
209
|
+
- spec/git/scraper_spec.rb
|
|
210
|
+
- spec/git/ssh_spec.rb
|
|
211
|
+
- spec/git/url_spec.rb
|
|
212
|
+
- spec/logger_spec.rb
|
|
49
213
|
- spec/repository_spec.rb
|
|
50
|
-
- spec/
|
|
214
|
+
- spec/retriever_spec_helper.rb
|
|
215
|
+
- spec/scanner_spec.rb
|
|
216
|
+
- spec/scraper_helper.rb
|
|
51
217
|
- spec/scraper_spec.rb
|
|
52
|
-
- spec/scraper_spec_helper_base.rb
|
|
53
|
-
- spec/spec.opts
|
|
54
218
|
- spec/spec_helper.rb
|
|
55
|
-
- spec/svn/
|
|
56
|
-
- spec/svn/
|
|
57
|
-
- spec/
|
|
219
|
+
- spec/svn/cookbook_spec.rb
|
|
220
|
+
- spec/svn/multi_svn_spec.rb
|
|
221
|
+
- spec/svn/multi_svn_spec_helper.rb
|
|
222
|
+
- spec/svn/repository_spec.rb
|
|
223
|
+
- spec/svn/retriever_spec.rb
|
|
224
|
+
- spec/svn/scraper_spec.rb
|
|
225
|
+
- spec/svn/svn_retriever_spec_helper.rb
|
|
226
|
+
- spec/svn/url_spec.rb
|
|
227
|
+
- spec/url_spec.rb
|
|
58
228
|
has_rdoc: true
|
|
59
229
|
homepage: https://github.com/rightscale/right_scraper
|
|
60
230
|
licenses: []
|
|
@@ -72,12 +242,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
72
242
|
requirements:
|
|
73
243
|
- - ">="
|
|
74
244
|
- !ruby/object:Gem::Version
|
|
75
|
-
hash:
|
|
245
|
+
hash: 57
|
|
76
246
|
segments:
|
|
77
247
|
- 1
|
|
78
248
|
- 8
|
|
79
|
-
-
|
|
80
|
-
version: 1.8.
|
|
249
|
+
- 7
|
|
250
|
+
version: 1.8.7
|
|
81
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
252
|
none: false
|
|
83
253
|
requirements:
|
|
@@ -87,8 +257,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
87
257
|
segments:
|
|
88
258
|
- 0
|
|
89
259
|
version: "0"
|
|
90
|
-
requirements:
|
|
91
|
-
|
|
260
|
+
requirements:
|
|
261
|
+
- libarchive, 2.8.4
|
|
262
|
+
- curl command line client
|
|
263
|
+
- Subversion command line client
|
|
92
264
|
rubyforge_project: right_scraper
|
|
93
265
|
rubygems_version: 1.3.7
|
|
94
266
|
signing_key:
|