right_scraper 3.2.6 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/lib/right_scraper.rb +16 -34
  3. data/lib/right_scraper/builders.rb +32 -0
  4. data/lib/right_scraper/builders/base.rb +19 -20
  5. data/lib/right_scraper/builders/filesystem.rb +8 -6
  6. data/lib/right_scraper/builders/union.rb +4 -1
  7. data/lib/right_scraper/loggers.rb +31 -0
  8. data/lib/right_scraper/loggers/base.rb +113 -0
  9. data/lib/right_scraper/loggers/default.rb +98 -0
  10. data/lib/right_scraper/{scraper.rb → main.rb} +53 -9
  11. data/lib/right_scraper/processes.rb +33 -0
  12. data/lib/right_scraper/processes/shell.rb +227 -0
  13. data/lib/right_scraper/processes/{ssh.rb → ssh_agent.rb} +4 -0
  14. data/lib/right_scraper/processes/svn_client.rb +117 -0
  15. data/lib/right_scraper/processes/warden.rb +358 -0
  16. data/lib/right_scraper/registered_base.rb +154 -0
  17. data/lib/right_scraper/repositories.rb +33 -0
  18. data/lib/right_scraper/repositories/base.rb +271 -232
  19. data/lib/right_scraper/repositories/download.rb +8 -6
  20. data/lib/right_scraper/repositories/git.rb +8 -9
  21. data/lib/right_scraper/repositories/svn.rb +8 -8
  22. data/lib/right_scraper/resources.rb +32 -0
  23. data/lib/right_scraper/resources/base.rb +5 -1
  24. data/lib/right_scraper/resources/cookbook.rb +34 -27
  25. data/lib/right_scraper/resources/workflow.rb +27 -28
  26. data/lib/right_scraper/retrievers.rb +34 -0
  27. data/lib/right_scraper/retrievers/base.rb +80 -84
  28. data/lib/right_scraper/retrievers/checkout_base.rb +178 -0
  29. data/lib/right_scraper/retrievers/download.rb +125 -117
  30. data/lib/right_scraper/retrievers/git.rb +377 -223
  31. data/lib/right_scraper/retrievers/svn.rb +102 -62
  32. data/lib/right_scraper/scanners.rb +37 -0
  33. data/lib/right_scraper/scanners/base.rb +77 -80
  34. data/lib/right_scraper/scanners/cookbook_manifest.rb +31 -30
  35. data/lib/right_scraper/scanners/cookbook_metadata.rb +380 -35
  36. data/lib/right_scraper/scanners/cookbook_s3_upload.rb +56 -53
  37. data/lib/right_scraper/scanners/union.rb +61 -58
  38. data/lib/right_scraper/scanners/workflow_manifest.rb +55 -54
  39. data/lib/right_scraper/scanners/workflow_metadata.rb +41 -39
  40. data/lib/right_scraper/scanners/workflow_s3_upload.rb +59 -55
  41. data/lib/right_scraper/scrapers.rb +32 -0
  42. data/lib/right_scraper/scrapers/base.rb +217 -205
  43. data/lib/right_scraper/scrapers/cookbook.rb +42 -40
  44. data/lib/right_scraper/scrapers/workflow.rb +57 -58
  45. data/lib/right_scraper/version.rb +3 -0
  46. data/right_scraper.gemspec +12 -16
  47. metadata +57 -163
  48. data/Gemfile +0 -15
  49. data/Rakefile +0 -89
  50. data/lib/right_scraper/logger.rb +0 -107
  51. data/lib/right_scraper/loggers/noisy.rb +0 -85
  52. data/lib/right_scraper/repositories/mock.rb +0 -70
  53. data/lib/right_scraper/retrievers/checkout.rb +0 -79
  54. data/lib/right_scraper/scraper_logger.rb +0 -66
  55. data/lib/right_scraper/svn_client.rb +0 -164
  56. data/right_scraper.rconf +0 -13
  57. data/spec/builder_spec.rb +0 -50
  58. data/spec/cookbook_helper.rb +0 -73
  59. data/spec/cookbook_manifest_spec.rb +0 -93
  60. data/spec/cookbook_s3_upload_spec.rb +0 -159
  61. data/spec/download/download_retriever_spec.rb +0 -118
  62. data/spec/download/download_retriever_spec_helper.rb +0 -72
  63. data/spec/download/download_spec.rb +0 -128
  64. data/spec/download/multi_dir_spec.rb +0 -106
  65. data/spec/download/multi_dir_spec_helper.rb +0 -40
  66. data/spec/git/cookbook_spec.rb +0 -165
  67. data/spec/git/demokey +0 -27
  68. data/spec/git/demokey.pub +0 -1
  69. data/spec/git/password_key +0 -30
  70. data/spec/git/password_key.pub +0 -1
  71. data/spec/git/repository_spec.rb +0 -110
  72. data/spec/git/retriever_spec.rb +0 -553
  73. data/spec/git/retriever_spec_helper.rb +0 -112
  74. data/spec/git/scraper_spec.rb +0 -151
  75. data/spec/git/ssh_spec.rb +0 -174
  76. data/spec/git/url_spec.rb +0 -103
  77. data/spec/logger_spec.rb +0 -185
  78. data/spec/repository_spec.rb +0 -111
  79. data/spec/retriever_spec_helper.rb +0 -146
  80. data/spec/scanner_spec.rb +0 -61
  81. data/spec/scraper_helper.rb +0 -88
  82. data/spec/scraper_spec.rb +0 -147
  83. data/spec/spec_helper.rb +0 -185
  84. data/spec/svn/cookbook_spec.rb +0 -96
  85. data/spec/svn/multi_svn_spec.rb +0 -64
  86. data/spec/svn/multi_svn_spec_helper.rb +0 -40
  87. data/spec/svn/repository_spec.rb +0 -72
  88. data/spec/svn/retriever_spec.rb +0 -266
  89. data/spec/svn/scraper_spec.rb +0 -90
  90. data/spec/svn/svn_retriever_spec_helper.rb +0 -90
  91. data/spec/svn/url_spec.rb +0 -47
  92. data/spec/url_spec.rb +0 -164
@@ -1,106 +0,0 @@
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__), 'multi_dir_spec_helper'))
25
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'scraper_helper'))
26
-
27
- describe RightScraper::Retrievers::Download do
28
- context 'in a multiple directory situation with a resources_path set' do
29
- include RightScraper::SpecHelpers::DevelopmentModeEnvironment
30
-
31
- include RightScraper::ScraperHelper
32
- include RightScraper::SpecHelpers
33
-
34
- before(:each) do
35
- @helper = RightScraper::MultiDirectorySpecHelper.new
36
- @repo = @helper.repo
37
- end
38
-
39
- after(:each) do
40
- @helper.close unless @helper.nil?
41
- @helper = nil
42
- end
43
-
44
- context 'given a download repository' do
45
- before(:each) do
46
- @retriever = @repo.retriever(:max_bytes => 1024**2, :max_seconds => 20, :basedir => @helper.download_repo_path)
47
- @retriever.retrieve
48
- @scraper = RightScraper::Scrapers::Base.scraper(:kind => :cookbook,
49
- :ignorable_paths => @retriever.ignorable_paths,
50
- :repo_dir => @retriever.repo_dir,
51
- :repository => @retriever.repository)
52
-
53
- @download_file = @helper.download_file
54
- end
55
-
56
- it 'should return two cookbooks' do
57
- @scraper.next_resource.should_not == nil
58
- @scraper.next_resource.should_not == nil
59
- @scraper.next_resource.should == nil
60
- end
61
-
62
- it 'should scrape' do
63
- @helper.check_resource(@scraper.next_resource, @download_file, @repo, "subdir1")
64
- @helper.check_resource(@scraper.next_resource, @download_file, @repo, "subdir2")
65
- end
66
- end
67
-
68
- it 'should scrape a gzipped tarball' do
69
- @download_file = @helper.download_file
70
- res, status = exec("gzip -c #{@download_file} > #{@download_file}.gz")
71
- raise "Failed to gzip tarball: #{res}" unless status.success?
72
- begin
73
- @repo.url += ".gz"
74
- @retriever = @repo.retriever(:max_bytes => 1024**2, :max_seconds => 20, :basedir => @helper.download_repo_path)
75
- @retriever.retrieve
76
- @scraper = RightScraper::Scrapers::Base.scraper(:kind => :cookbook,
77
- :ignorable_paths => @retriever.ignorable_paths,
78
- :repo_dir => @retriever.repo_dir,
79
- :repository => @retriever.repository)
80
- @helper.check_resource(@scraper.next_resource, @download_file + ".gz", @repo, "subdir1")
81
- @helper.check_resource(@scraper.next_resource, @download_file + ".gz", @repo, "subdir2")
82
- ensure
83
- File.unlink(@download_file + ".gz")
84
- end
85
- end
86
-
87
- it 'should scrape a bzipped tarball' do
88
- @download_file = @helper.download_file
89
- res, status = exec("bzip2 -c #{@download_file} > #{@download_file}.bz2")
90
- raise "Failed to bzip tarball: #{res}" unless status.success?
91
- begin
92
- @repo.url += ".bz2"
93
- @retriever = @repo.retriever(:max_bytes => 1024**2, :max_seconds => 20, :basedir => @helper.download_repo_path)
94
- @retriever.retrieve
95
- @scraper = RightScraper::Scrapers::Base.scraper(:kind => :cookbook,
96
- :ignorable_paths => @retriever.ignorable_paths,
97
- :repo_dir => @retriever.repo_dir,
98
- :repository => @retriever.repository)
99
- @helper.check_resource(@scraper.next_resource, @download_file + ".bz2", @repo, "subdir1")
100
- @helper.check_resource(@scraper.next_resource, @download_file + ".bz2", @repo, "subdir2")
101
- ensure
102
- File.unlink(@download_file + ".bz2")
103
- end
104
- end
105
- end
106
- end
@@ -1,40 +0,0 @@
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__), 'download_retriever_spec_helper'))
25
-
26
- module RightScraper
27
- class MultiDirectorySpecHelper < DownloadRetrieverSpecHelper
28
- def make_cookbooks
29
- super
30
- create_cookbook(File.join(download_repo_path, 'subdir1'), repo_content)
31
- create_cookbook(File.join(download_repo_path, 'subdir2'), repo_content)
32
- end
33
-
34
- def repo
35
- r = super
36
- r.resources_path = ['subdir1', 'subdir2']
37
- r
38
- end
39
- end
40
- end
@@ -1,165 +0,0 @@
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
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
24
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'cookbook_helper'))
25
-
26
- describe RightScraper::Resources::Cookbook do
27
- include RightScraper::SpecHelpers::DevelopmentModeEnvironment
28
-
29
- include RightScraper::CookbookHelper
30
-
31
- shared_examples_for 'a git repository' do
32
- it_should_behave_like 'a generic repository'
33
- end
34
-
35
- context 'with an invalid git repository' do
36
- before(:each) do
37
- @repository = RightScraper::Repositories::Git.from_hash(:display_name => 'test repo',
38
- :repo_type => :git,
39
- :url => "http://a.site/foo/bar/baz")
40
- end
41
-
42
- it_should_behave_like 'a git repository'
43
-
44
- it 'should fail to scrape' do
45
- lambda {
46
- begin
47
- @tmpdir = Dir.mktmpdir
48
- retriever = @repository.retriever(:basedir => @tmpdir)
49
- retriever.retrieve
50
- ensure
51
- FileUtils.remove_entry_secure(@tmpdir)
52
- end
53
- }.should raise_exception(Git::GitExecuteError)
54
- end
55
- end
56
-
57
- context 'with a git repository with a credential that requires a password' do
58
- before(:each) do
59
- passwd_key = File.open(File.join(File.dirname(__FILE__), 'password_key')).read
60
- @repository = RightScraper::Repositories::Git.from_hash(
61
- :display_name => 'test repo',
62
- :repo_type => :git,
63
- :url => "http://a.site/foo/bar/baz",
64
- :first_credential => passwd_key)
65
- end
66
-
67
- it_should_behave_like 'a git repository'
68
-
69
- it 'should close the connection to the agent' do
70
- oldpid = ENV['SSH_AGENT_PID']
71
- lambda {
72
- begin
73
- @tmpdir = Dir.mktmpdir
74
- retriever = @repository.retriever(:basedir => @tmpdir)
75
- retriever.retrieve
76
- ensure
77
- FileUtils.remove_entry_secure(@tmpdir)
78
- end
79
- }.should raise_exception(::RightScraper::Processes::SSHAgent::SSHAgentError, /Attempted to use credentials that require passwords; bailing/)
80
- ENV['SSH_AGENT_PID'].should == oldpid
81
- end
82
- end
83
-
84
- context 'with an invalid git repository with a real credential' do
85
- before(:each) do
86
- passwd_key = File.open(File.join(File.dirname(__FILE__), 'demokey')).read
87
- @repository = RightScraper::Repositories::Git.from_hash(
88
- :display_name => 'test repo',
89
- :repo_type => :git,
90
- :url => "http://example.example/foo/bar/baz",
91
- :first_credential => passwd_key)
92
- end
93
-
94
- it_should_behave_like 'a git repository'
95
-
96
- it 'should close the connection to the agent' do
97
- oldpid = ENV['SSH_AGENT_PID']
98
- lambda {
99
- begin
100
- @tmpdir = Dir.mktmpdir
101
- retriever = @repository.retriever(:basedir => @tmpdir)
102
- retriever.retrieve
103
- ensure
104
- FileUtils.remove_entry_secure(@tmpdir)
105
- end
106
- }.should raise_exception(Git::GitExecuteError)
107
- ENV['SSH_AGENT_PID'].should == oldpid
108
- end
109
- end
110
-
111
- context 'with a git repository' do
112
- before(:each) do
113
- @repository = RightScraper::Repositories::Git.from_hash(
114
- :display_name => 'test repo',
115
- :repo_type => :git,
116
- :url => "http://a.site/foo/bar/baz",
117
- :first_credential => "a-key")
118
- end
119
-
120
- it_should_behave_like 'a git repository'
121
-
122
- it 'should have a tag' do
123
- @repository.tag.should == "master"
124
- end
125
-
126
- it 'should have a cookbook hash' do
127
- example_cookbook(@repository).resource_hash.should ==
128
- Digest::MD5.hexdigest(RightScraper::Resources::Cookbook::EMPTY_MANIFEST_JSON)
129
- end
130
-
131
- it 'should have a cookbook hash invariant under credential changes' do
132
- old_hash = example_cookbook(@repository).resource_hash
133
- @repository.first_credential = "b-key"
134
- example_cookbook(@repository).resource_hash.should == old_hash
135
- end
136
-
137
- it 'should have a cookbook hash invariant under tag changes' do
138
- old_hash = example_cookbook(@repository).resource_hash
139
- @repository.tag = "tag"
140
- example_cookbook(@repository).resource_hash.should == old_hash
141
- end
142
-
143
- it 'should have a cookbook hash invariant under position changes' do
144
- example_cookbook(@repository, "foo").resource_hash.should ==
145
- example_cookbook(@repository, "bar").resource_hash
146
- end
147
- end
148
- context 'with a git repository with a tag' do
149
- before(:each) do
150
- @repository = RightScraper::Repositories::Git.from_hash(
151
- :display_name => 'test repo',
152
- :repo_type => :git,
153
- :url => "http://a.site/foo/bar/baz",
154
- :tag => "DEADBEEF",
155
- :first_credential => "a-key")
156
- end
157
-
158
- it_should_behave_like 'a git repository'
159
-
160
- it 'should have a tag' do
161
- @repository.tag.should == "DEADBEEF"
162
- end
163
- end
164
-
165
- end
data/spec/git/demokey DELETED
@@ -1,27 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- MIIEpAIBAAKCAQEAtfIDc2jsICZB4VIDzzbQjadB9PMsMx9QKrsEnGtfWTnnRp0V
3
- muu97eLF1tAXgZ9cHfL9BLpR0TcCMp9MSS7BErTDqaOANKjfgdrDPYIwXGPJzDsl
4
- KsubN9qV53BnxMIkbogMas+OVSary9wg/F+VsRt9NLvwzVGy2TdCE9Wj5+dgaOoH
5
- BpXmZJcRdXHHK2zHpVn1xOymCow9/03y3SXjpT/TyTPIoxRwrMlnCreQB/GxZEP8
6
- REz36j81CMLyw1Ox6VQy2WeiQYtq8YQABvjYRNxjJmOYvrzAfoOwgn2NtNEhcc8o
7
- yHGoNOTBhpKPEb/Wx5xNwGI/XMQlC8gycmZv0wIDAQABAoIBAC5h4tVSAxfzCMpr
8
- AQObIrFp2RubvkHOEr7B7Fv/10/Evhu3QeG7hTCWpf6sD8IAoRgVcMD6yo6+KjZD
9
- e8wQOjINmO+u+ajy//93iFwuyytSWQhSb5goTYqAk8RrWFjFcUooLpowDUXR1Ovk
10
- UxhjOaLrshB2dN2ynRhYyOSLivw8BiNODtRNDqjjpxNmrxFN88NB6IhQmYxlj8p+
11
- +UKMBPcj8ptHrzZkNCMIhUYZeWnDZFlfvyuZGBRKnJpzsCsgrQPMJYjllz/xMjtH
12
- 5t/WUO3dcKOcAImLbzF6Nql8TGx4D9yGbJmb2aBvi9ELPUYYVB+pNT+Ex9PsSVp8
13
- iU6OzJECgYEA8B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GnRWa673t4sXW0BeBn1wd8v0EulHRNwIyn0xJLsEStMOpo4A0qN+B2sM9gjBcY8nMOyUqy5s32pXncGfEwiRuiAxqz45VJqvL3CD8X5WxG300u/DNUbLZN0IT1aPn52Bo6gcGleZklxF1cccrbMelWfXE7KYKjD3/TfLdJeOlP9PJM8ijFHCsyWcKt5AH8bFkQ/xETPfqPzUIwvLDU7HpVDLZZ6JBi2rxhAAG+NhE3GMmY5i+vMB+g7CCfY200SFxzyjIcag05MGGko8Rv9bHnE3AYj9cxCULyDJyZm/T nobody@localhost.localdomain
@@ -1,30 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- Proc-Type: 4,ENCRYPTED
3
- DEK-Info: AES-128-CBC,6DF3FE56B08906976427C247F02F8EF1
4
-
5
- oJ9Q/+e+kwFoRd0Heb7Q8M9h/qwWCYffwoVT94j+GuJd48Epo8BHma/69dQHWo5m
6
- 0dCkKoE07FrjVEuTl9yTPtWlmycW2qP+6nYDwBfr6Go3DRMzr39aqVK8xDdE6hGV
7
- pD5QyDoCNSrLyUVkAhcfIaCcmls7fwXnJGZoKZYcCY0DtUWNwTn9P/F8Vf30UxUu
8
- /MH/XZgxfuRNI/TH/QWd2BY3rMhpYk9fM0nFs1c/7pmsOQokWfXr6bN8m2DA0fTq
9
- W+7wVNmfAwYNGAa/ONImEdbCHB9By8icnbhseNzEi6yr5igUC7ltISyUCQVSQMiw
10
- xh5nTnfdZ2MfhDJ1rVaMRvmp7WLSsLTXW8/1YcFsx288LPFnoJVKhNge0wZsVKRa
11
- eFd+jKu08A5NBtbnTQ+YMLPknoRqDenhjwhwAqYrefna7SroHlpVYeUnzMdQ130t
12
- ujLieESwAjKTYtC8vLz4KevJe2KsKCmEuZi1q6Dl/Lk4GIzL9L+JOdWPrjUV1UrD
13
- 0bo9Ovwu9FmGMfEU8PE1R4W2U12kkMeEhTbZqmasXHt7C33k+03M0d5xJ24LCw23
14
- 2X7UK/0grEr48yStDw4xKvm18WhLdZnNsr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PRIVATE KEY-----
@@ -1 +0,0 @@
1
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChbg3Sbijezv1ycd8itx5pWjmsa6g0yhL6Q9OW2F7OFx+qILcsU7rgIQh7THhYMD8OpAdw8A3lyw0jFIfp0acmKMUorrO3oFK2cLauvVXCBaz6GpDq4wiAvJHdQlW7mSFOx86Niem7/LiuR48fMJ1RgNMDUIlpk19ZMCxhEd53ZJfzFWrrFKhtxhJnCbRMm1RtkVkGWNvJFRHm7JKpZJBne4CYBBYjTiG97CGb1D8mYuGxneMlt/ImYt+D3W+wa9j17+UdamFKJl+3lZC3k3WJXyfLHFYFkkW2NeJNqYefAXgULIyMdybcOvI++/hXxJmh5p6cML4yA08IFqYHQY/f nobody@localhost.localdomain
@@ -1,110 +0,0 @@
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', 'repositories', 'mock'))
26
-
27
- describe RightScraper::Repositories::Git do
28
- include RightScraper::SpecHelpers::DevelopmentModeEnvironment
29
-
30
- shared_examples_for 'git repository for hashing' do
31
- it 'should have the same repository hash with or without credentials' do
32
- initial_hash = @repo.repository_hash
33
- @repo.first_credential = nil
34
- @repo.repository_hash.should == initial_hash
35
- end
36
-
37
- it 'should have the same checkout hash with or without credentials' do
38
- initial_hash = @repo.checkout_hash
39
- @repo.first_credential = nil
40
- @repo.checkout_hash.should == initial_hash
41
- end
42
-
43
- it 'should have a different checkout hash from repository hash' do
44
- @repo.repository_hash.should_not == @repo.checkout_hash
45
- end
46
-
47
- it 'should have the same repository hash regardless of tag' do
48
- initial_hash = @repo.repository_hash
49
- @repo.tag = 'bar'
50
- @repo.repository_hash.should == initial_hash
51
- end
52
-
53
- it 'should have different checkout hashes as tags change' do
54
- initial_hash = @repo.checkout_hash
55
- @repo.tag = 'bar'
56
- @repo.checkout_hash.should_not == initial_hash
57
- end
58
- end
59
-
60
- context 'with an HTTP scheme' do
61
- before(:each) do
62
- @repo = RightScraper::Repositories::Base.from_hash(:display_name => 'test repo',
63
- :repo_type => :git,
64
- :url => "http://foo.bar.baz.quux/%20CBLAH",
65
- :tag => 'foo',
66
- :first_credential => "foo:b/ar")
67
- end
68
-
69
- it 'should have a checkout hash' do
70
- @repo.checkout_hash.should ==
71
- Digest::SHA1.hexdigest("1\000git\000http://foo.bar.baz.quux/%20CBLAH\000foo")
72
- end
73
-
74
- it_should_behave_like 'git repository for hashing'
75
- end
76
-
77
- context 'with a git scheme' do
78
- before(:each) do
79
- @repo = RightScraper::Repositories::Base.from_hash(:display_name => 'test repo',
80
- :repo_type => :git,
81
- :url => "git://foo.bar.baz.quux/%20CBLAH",
82
- :tag => 'foo',
83
- :first_credential => "foo:b/ar")
84
- end
85
-
86
- it 'should have a checkout hash' do
87
- @repo.checkout_hash.should ==
88
- Digest::SHA1.hexdigest("1\000git\000git://foo.bar.baz.quux/%20CBLAH\000foo")
89
- end
90
-
91
- it_should_behave_like 'git repository for hashing'
92
- end
93
-
94
- context 'with an ssh-type scheme' do
95
- before(:each) do
96
- @repo = RightScraper::Repositories::Base.from_hash(:display_name => 'test repo',
97
- :repo_type => :git,
98
- :url => "foo@bar.baz.quux:/%20CBLAH",
99
- :tag => 'foo',
100
- :first_credential => "foo:b/ar")
101
- end
102
-
103
- it 'should have a checkout hash' do
104
- @repo.checkout_hash.should ==
105
- Digest::SHA1.hexdigest("1\000git\000foo@bar.baz.quux:/%20CBLAH\000foo")
106
- end
107
-
108
- it_should_behave_like 'git repository for hashing'
109
- end
110
- end