gemnasium 3.2.1

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.
@@ -0,0 +1,9 @@
1
+ require 'gemnasium'
2
+ require 'gemnasium/options'
3
+ require 'rspec'
4
+ require 'webmock/rspec'
5
+ # Load support files
6
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
7
+ FileUtils.mkdir_p 'tmp'
8
+
9
+ WebMock.disable_net_connect!
@@ -0,0 +1,86 @@
1
+ def api_url(path)
2
+ config = Gemnasium.config
3
+ protocol = config.use_ssl ? "https://" : "http://"
4
+
5
+ "#{protocol}X:#{config.api_key}@#{config.site}#{path}"
6
+ end
7
+
8
+ def stub_config(options = {})
9
+ stubbed_config = double("Gemnasium::Configuration")
10
+ allow(stubbed_config).to receive(:site).and_return('gemnasium.com')
11
+ allow(stubbed_config).to receive(:use_ssl).and_return(true)
12
+ allow(stubbed_config).to receive(:api_key).and_return('test_api_key')
13
+ allow(stubbed_config).to receive(:api_version).and_return('v3')
14
+ allow(stubbed_config).to receive(:project_name).and_return(options.fetch(:project_name, 'gemnasium-gem'))
15
+ allow(stubbed_config).to receive(:project_slug).and_return(options.fetch(:project_slug, 'existing-slug'))
16
+ allow(stubbed_config).to receive(:project_branch).and_return('master')
17
+ allow(stubbed_config).to receive(:writable?).and_return(options.fetch(:writable?, true))
18
+ allow(stubbed_config).to receive(:store_value!).and_return(true)
19
+ allow(stubbed_config).to receive(:needs_to_migrate?).and_return(options.fetch(:needs_to_migrate?, false))
20
+ allow(stubbed_config).to receive(:migrate!).and_return(nil)
21
+
22
+ allow(Gemnasium).to receive(:config).and_return(stubbed_config)
23
+ allow(Gemnasium).to receive(:load_config).and_return(stubbed_config)
24
+ end
25
+
26
+ def stub_requests
27
+ config = Gemnasium.config
28
+ request_headers = {'Accept'=>'application/json', 'Content-Type'=>'application/json'}
29
+ response_headers = {'Content-Type'=>'application/json'}
30
+
31
+ # Push requests
32
+ stub_request(:post, api_url("/api/#{config.api_version}/projects/up_to_date_project/dependency_files/compare"))
33
+ .with(:headers => request_headers)
34
+ .to_return(:status => 200,
35
+ :body => '{ "to_upload": [], "deleted": [] }',
36
+ :headers => response_headers)
37
+
38
+ stub_request(:post, api_url("/api/#{config.api_version}/projects/existing-slug/dependency_files/compare"))
39
+ .with(:body => '{"new_gemspec.gemspec":"gemspec_sha1_hash","modified_lockfile.lock":"lockfile_sha1_hash","Gemfile_unchanged.lock":"gemfile_sha1_hash"}',
40
+ :headers => request_headers)
41
+ .to_return(:status => 200,
42
+ :body => '{ "to_upload": ["new_gemspec.gemspec", "modified_lockfile.lock"], "deleted": ["old_dependency_file"] }',
43
+ :headers => response_headers)
44
+
45
+ stub_request(:post, api_url("/api/#{config.api_version}/projects/existing-slug/dependency_files/upload"))
46
+ .with(:body => '[{"filename":"new_gemspec.gemspec","sha":"gemspec_sha1_hash","content":"stubbed gemspec content"},{"filename":"modified_lockfile.lock","sha":"lockfile_sha1_hash","content":"stubbed lockfile content"}]',
47
+ :headers => request_headers)
48
+ .to_return(:status => 200,
49
+ :body => '{ "added": ["new_gemspec.gemspec"], "updated": ["modified_lockfile.lockfile"], "unchanged": [], "unsupported": [] }',
50
+ :headers => response_headers)
51
+
52
+ # Create requests
53
+ stub_request(:post, api_url("/api/#{config.api_version}/projects"))
54
+ .with(:body => '{"name":"gemnasium-gem","branch":"master"}',
55
+ :headers => request_headers)
56
+ .to_return(:status => 200,
57
+ # FIXME: make sure the response body is consistent with API v3
58
+ :body => '{ "name": "gemnasium-gem", "slug": "new-slug", "remaining_slot_count": 9001 }',
59
+ :headers => response_headers)
60
+
61
+ # Index requests
62
+ #
63
+ # search: offline project, master branch
64
+ # no-candidate: github project, no match
65
+ # one-candidate: one project for master branch, another for dev branch, one match
66
+ # many-candidates: 2 projects matching master branch, 2 matches
67
+ #
68
+ stub_request(:get, api_url("/api/#{config.api_version}/projects"))
69
+ .with(:headers => request_headers)
70
+ .to_return(:status => 200, :headers => response_headers,
71
+ :body => '[
72
+ {"slug":"no-candidate-slug","name":"no-candidate","origin":"github","branch":"master","private":false},
73
+ {"slug":"one-candidate-slug","name":"one-candidate","origin":"offline","branch":"master","private":true},
74
+ {"slug":"one-candidate-slug-dev","name":"one-candidate","origin":"offline","branch":"dev","private":true},
75
+ {"slug":"many-candidates-slug-1","name":"many-candidates","origin":"offline","branch":"master","private":false},
76
+ {"slug":"many-candidates-slug-2","name":"many-candidates","origin":"offline","branch":"master","private":false}
77
+ ]'
78
+ )
79
+
80
+ # Connection model's test requests
81
+ stub_request(:get, api_url('/test_path'))
82
+ .with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json'})
83
+
84
+ stub_request(:post, api_url('/test_path'))
85
+ .with(:body => {"foo"=>"bar"}, :headers => request_headers)
86
+ end
metadata ADDED
@@ -0,0 +1,177 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gemnasium
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 3.2.1
6
+ platform: ruby
7
+ authors:
8
+ - Tech-Angels
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-11-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ type: :development
16
+ name: rake
17
+ version_requirements: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 10.3.1
23
+ requirement: !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: 10.3.1
29
+ prerelease: false
30
+ - !ruby/object:Gem::Dependency
31
+ type: :development
32
+ name: rspec
33
+ version_requirements: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '3.0'
39
+ requirement: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: '3.0'
45
+ prerelease: false
46
+ - !ruby/object:Gem::Dependency
47
+ type: :development
48
+ name: cucumber
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirement: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ prerelease: false
62
+ - !ruby/object:Gem::Dependency
63
+ type: :development
64
+ name: aruba
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirement: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ prerelease: false
78
+ - !ruby/object:Gem::Dependency
79
+ type: :development
80
+ name: webmock
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirement: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ prerelease: false
94
+ description: Safely upload your dependency files on gemnasium.com to track dependencies
95
+ and get notified about updates and security advisories.WARNING! This gem has been
96
+ deprecated and support will be discontinued. Please use Gemnasium Toolbelt (https://github.com/gemnasium/toolbelt)
97
+ instead.
98
+ email:
99
+ - contact@tech-angels.com
100
+ executables:
101
+ - gemnasium
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - .gitignore
106
+ - .rvmrc
107
+ - .travis.yml
108
+ - CHANGELOG.md
109
+ - Gemfile
110
+ - LICENSE
111
+ - README.md
112
+ - Rakefile
113
+ - bin/gemnasium
114
+ - features/gemnasium.feature
115
+ - features/gemnasium_create.feature
116
+ - features/gemnasium_install.feature
117
+ - features/step_definitions/gemnasium_steps.rb
118
+ - features/support/env.rb
119
+ - gemnasium.gemspec
120
+ - lib/gemnasium.rb
121
+ - lib/gemnasium/configuration.rb
122
+ - lib/gemnasium/connection.rb
123
+ - lib/gemnasium/dependency_files.rb
124
+ - lib/gemnasium/errors.rb
125
+ - lib/gemnasium/options.rb
126
+ - lib/gemnasium/version.rb
127
+ - lib/templates/gemnasium.rake
128
+ - lib/templates/gemnasium.yml
129
+ - lib/templates/post-commit
130
+ - spec/gemnasium/configuration_spec.rb
131
+ - spec/gemnasium/connection_spec.rb
132
+ - spec/gemnasium/dependency_files_spec.rb
133
+ - spec/gemnasium/options_spec.rb
134
+ - spec/gemnasium_spec.rb
135
+ - spec/spec_helper.rb
136
+ - spec/support/gemnasium_helper.rb
137
+ homepage: https://gemnasium.com/
138
+ licenses:
139
+ - MIT
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ requirements: []
157
+ rubyforge_project:
158
+ rubygems_version: 1.8.28
159
+ signing_key:
160
+ specification_version: 3
161
+ summary: Safely upload your dependency files on gemnasium.com to track dependencies
162
+ and get notified about updates and security advisories.WARNING! This gem has been
163
+ deprecated and support will be discontinued. Please use Gemnasium Toolbelt (https://github.com/gemnasium/toolbelt)
164
+ instead.
165
+ test_files:
166
+ - features/gemnasium.feature
167
+ - features/gemnasium_create.feature
168
+ - features/gemnasium_install.feature
169
+ - features/step_definitions/gemnasium_steps.rb
170
+ - features/support/env.rb
171
+ - spec/gemnasium/configuration_spec.rb
172
+ - spec/gemnasium/connection_spec.rb
173
+ - spec/gemnasium/dependency_files_spec.rb
174
+ - spec/gemnasium/options_spec.rb
175
+ - spec/gemnasium_spec.rb
176
+ - spec/spec_helper.rb
177
+ - spec/support/gemnasium_helper.rb