cutting_edge 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9345fa39664217f3d25636af4855abfa9f4e684237c0038fbeb4fa57e83ec40d
4
- data.tar.gz: de6eaa52e75463fed82b1aae4723e6685a80522086ed28cc3a8ded7e6b3189cb
3
+ metadata.gz: 4457b31dd15da9184bb394f6d85b9197228e9cadbe6640b0c8b50bfd8ad08650
4
+ data.tar.gz: e74cbee369cb51b73c3a0ef2822580913774f6d5a6aa8440b01fe5a2aef83130
5
5
  SHA512:
6
- metadata.gz: c866cf8788242847e16b65f0b8a21481b5b57df936241d9bdf68044d62d55083d12dc827f6eeedd4978716ad131a2ac7993ea2ad0f6b6a23a150dc35f4ca6359
7
- data.tar.gz: afcee66340cc2f542d45ab6bb4f5a5427d57c69ec7d925f49f22909cf2c0de2f767b8ecf8ab4b295dba6f514177309607ad1a185455f257a35ff40884b802652
6
+ metadata.gz: 98f7e1eb93eec5ef97fb942b81b2ab982f3bea1f4b660dfa1356f3930ca68a3dfe35396c610bde83919a7877256e40d2d4a6df5661ac21936111d7f096be3491
7
+ data.tar.gz: 655323d084a16337cc5aeee7e271fdd3500eb119380540589b3d6a63027b075ab44651453a67ad2e671fdbcc0e320e8a727f7f12fe8c090f0c43ba0f3285cb50
data/Gemfile.lock CHANGED
@@ -1,25 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cutting_edge (0.2)
4
+ cutting_edge (0.2.1)
5
5
  gemnasium-parser (~> 0.1.9)
6
6
  hashdiff (~> 1.0)
7
- http (~> 4.3)
7
+ http (~> 5.0)
8
8
  mail (~> 2.7)
9
9
  moneta (~> 1.2)
10
10
  rufus-scheduler (~> 3.6)
11
11
  sinatra (~> 2.0)
12
12
  sinatra-logger (~> 0.3)
13
- sucker_punch (~> 2.1)
13
+ sucker_punch (~> 3.0)
14
14
  toml-rb (~> 2.0)
15
15
 
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- addressable (2.7.0)
19
+ addressable (2.8.0)
20
20
  public_suffix (>= 2.0.2, < 5.0)
21
21
  citrus (3.0.2)
22
- concurrent-ruby (1.1.7)
22
+ concurrent-ruby (1.1.9)
23
23
  coveralls (0.8.23)
24
24
  json (>= 1.8, < 3)
25
25
  simplecov (~> 0.16.1)
@@ -32,30 +32,31 @@ GEM
32
32
  unf (>= 0.0.5, < 1.0.0)
33
33
  et-orbi (1.2.4)
34
34
  tzinfo
35
- ffi (1.13.1)
35
+ ffi (1.15.3)
36
36
  ffi-compiler (1.0.1)
37
37
  ffi (>= 1.0.0)
38
38
  rake
39
- fugit (1.4.0)
39
+ fugit (1.5.1)
40
40
  et-orbi (~> 1.1, >= 1.1.8)
41
41
  raabro (~> 1.4)
42
42
  gemnasium-parser (0.1.9)
43
43
  hashdiff (1.0.1)
44
- http (4.4.1)
44
+ http (5.0.1)
45
45
  addressable (~> 2.3)
46
46
  http-cookie (~> 1.0)
47
47
  http-form_data (~> 2.2)
48
- http-parser (~> 1.2.0)
49
- http-cookie (1.0.3)
48
+ llhttp-ffi (~> 0.3.0)
49
+ http-cookie (1.0.4)
50
50
  domain_name (~> 0.5)
51
51
  http-form_data (2.3.0)
52
- http-parser (1.2.1)
53
- ffi-compiler (>= 1.0, < 2.0)
54
52
  json (2.3.1)
53
+ llhttp-ffi (0.3.1)
54
+ ffi-compiler (~> 1.0)
55
+ rake (~> 13.0)
55
56
  mail (2.7.1)
56
57
  mini_mime (>= 0.1.1)
57
- mini_mime (1.0.2)
58
- moneta (1.4.1)
58
+ mini_mime (1.1.1)
59
+ moneta (1.4.2)
59
60
  mustermann (1.1.1)
60
61
  ruby2_keywords (~> 0.0.1)
61
62
  public_suffix (4.0.6)
@@ -65,7 +66,7 @@ GEM
65
66
  rack
66
67
  rack-test (1.1.0)
67
68
  rack (>= 1.0, < 3)
68
- rake (13.0.1)
69
+ rake (13.0.6)
69
70
  redis (4.2.2)
70
71
  rspec (3.10.0)
71
72
  rspec-core (~> 3.10.0)
@@ -80,10 +81,10 @@ GEM
80
81
  diff-lcs (>= 1.2.0, < 2.0)
81
82
  rspec-support (~> 3.10.0)
82
83
  rspec-support (3.10.0)
83
- ruby2_keywords (0.0.2)
84
- rufus-scheduler (3.6.0)
84
+ ruby2_keywords (0.0.5)
85
+ rufus-scheduler (3.8.0)
85
86
  fugit (~> 1.1, >= 1.1.6)
86
- semantic_logger (4.7.3)
87
+ semantic_logger (4.8.2)
87
88
  concurrent-ruby (~> 1.0)
88
89
  simplecov (0.16.1)
89
90
  docile (~> 1.1)
@@ -98,7 +99,7 @@ GEM
98
99
  sinatra-logger (0.3.2)
99
100
  semantic_logger
100
101
  sinatra
101
- sucker_punch (2.1.2)
102
+ sucker_punch (3.0.1)
102
103
  concurrent-ruby (~> 1.0)
103
104
  sync (0.5.0)
104
105
  term-ansicolor (1.7.1)
@@ -109,7 +110,7 @@ GEM
109
110
  sync
110
111
  toml-rb (2.0.1)
111
112
  citrus (~> 3.0, > 3.0)
112
- tzinfo (2.0.2)
113
+ tzinfo (2.0.4)
113
114
  concurrent-ruby (~> 1.0)
114
115
  unf (0.1.4)
115
116
  unf_ext
data/README.md CHANGED
@@ -207,13 +207,15 @@ If you don't want to expose information about a project in (**such as an [API to
207
207
  module CuttingEdge
208
208
  require './lib/cutting_edge/repo.rb'
209
209
  REPOSITORIES = {
210
- "gitlab/#{ENV['SECRET_REPO1_ORG']}/#{ENV['SECRET_REPO1_NAME']}" => GitlabRepository.new(org: ENV['SECRET_REPO1_ORG'], name: ENV['SECRET_REPO1_NAME'], auth_token: ENV['SECRET_REPO1_AUTH_TOKEN'], hide: ENV['SECRET_REPO1_HIDE_TOKEN'])
210
+ "gitlab/#{ENV['SECRET_REPO1_ORG']}/#{ENV['SECRET_REPO1_NAME']}" => GitlabRepository.new(org: ENV['SECRET_REPO1_ORG'], name: ENV['SECRET_REPO1_NAME'], auth_token: ENV['SECRET_REPO1_AUTH_TOKEN'], hide: ENV['SECRET_REPO1_HIDE_TOKEN'], email: 'myemail@mydomain.org')
211
211
  }
212
212
  end
213
213
  ```
214
214
 
215
215
  This approach is especially useful on Heroku, where you can use [Heroku config variables](https://devcenter.heroku.com/articles/config-vars).
216
216
 
217
+ **NB: When adding repositories in config.rb, you must explicitly set the email attribute (or else email will be considered disabled for the repo).**
218
+
217
219
  ### Hide Repositories
218
220
 
219
221
  You may want the name and dependency monitoring information for private repositories (see above) not to be visible on the internet. To achieve this, you can use `hide: token` in `projects.yml`:
data/cutting_edge.gemspec CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
5
5
  s.required_ruby_version = '>= 2.4'
6
6
 
7
7
  s.name = 'cutting_edge'
8
- s.version = '0.2'
9
- s.date = '2020-12-05'
8
+ s.version = '0.2.1'
9
+ s.date = '2021-09-02'
10
10
  s.license = 'GPL-3.0-only'
11
11
 
12
12
  s.summary = 'Self-hosted dependency monitoring, including shiny badges.'
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.add_dependency 'gemnasium-parser', '~> 0.1.9'
24
24
  s.add_dependency 'hashdiff', '~> 1.0'
25
- s.add_dependency 'http', '~> 4.3'
26
- s.add_dependency 'sucker_punch', '~> 2.1'
25
+ s.add_dependency 'http', '~> 5.0'
26
+ s.add_dependency 'sucker_punch', '~> 3.0'
27
27
  s.add_dependency 'sinatra', '~> 2.0'
28
28
  s.add_dependency 'moneta', '~> 1.2'
29
29
  s.add_dependency 'rufus-scheduler', '~> 3.6'
@@ -4,7 +4,7 @@ require 'http'
4
4
  class PythonLang < Language
5
5
  # For Requirements.txt
6
6
  # See https://iscompatible.readthedocs.io/en/latest/
7
- COMPARATORS = />=|>|<=|<|==/
7
+ COMPARATORS = />=|>|<=|<|==|~=/
8
8
  VERSION_NUM = /\d[\.\w]*/
9
9
  SUFFIX_OPTION = /\s*(\[.*\])?/
10
10
  NAME = /[^,]+/
@@ -55,6 +55,7 @@ class PythonLang < Language
55
55
  name, first_comp, first_version, _ignore, second_comp, second_version = match.captures
56
56
  first_comp = '=' if first_comp == '=='
57
57
  second_comp = '=' if second_comp == '=='
58
+ first_comp = '~>' if first_comp == '~='
58
59
  dep = Gem::Dependency.new(name.strip, "#{first_comp} #{first_version}")
59
60
  dep.requirement.concat(["#{second_comp} #{second_version}"]) if second_comp && second_version
60
61
  else
@@ -124,6 +124,7 @@
124
124
  This is <a href="<%= url %>">CuttingEdge</a> informing you that the dependency status for <a href="<%= "#{url}/#{project}/info" %>"><%= project %></a> has changed.
125
125
  </p>
126
126
  <% specs[:locations].each do |filename, spec| %>
127
+ <% next if spec.values.flatten.empty? %>
127
128
  <p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">
128
129
  In <b><%= filename %></b>:
129
130
  <% spec.each do |type, dependencies|
data/lib/cutting_edge.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CuttingEdge
2
- VERSION = '0.2'
2
+ VERSION = '0.2.1'
3
3
  end
data/projects.yml CHANGED
@@ -16,6 +16,7 @@ github:
16
16
  flask-dance:
17
17
  language: python
18
18
  email: false
19
+ branch: main
19
20
  rust-lang:
20
21
  crates.io:
21
22
  language: rust
@@ -20,7 +20,19 @@ describe MailWorker do
20
20
  it 'returns nil' do
21
21
  expect(worker.perform(identifier, test_email)).to eq nil
22
22
  end
23
- end
23
+ end
24
+
25
+ it 'does not list empty locations' do
26
+ dependencies[:locations]['Gemfile'] = DependencyWorker::EMPTY_STATUS_HASH
27
+ params = {
28
+ project: identifier,
29
+ url: CuttingEdge::SERVER_URL,
30
+ diff: {},
31
+ specs: dependencies
32
+ }
33
+ result = ERB.new(CuttingEdge::MAIL_TEMPLATE).result_with_hash(params)
34
+ expect(result).to_not include('Gemfile')
35
+ end
24
36
 
25
37
  context 'with valid dependencies' do
26
38
  before(:each) {
@@ -74,6 +86,16 @@ describe MailWorker do
74
86
  expect(html_body).to include('<li>rake ~> 12.3, >= 12.3.3 (latest: 13.0.1)</li>')
75
87
  expect(html_body).to include('<li style="color:green;">foobar = 1.0 (latest: 1.0)</li>')
76
88
  end
89
+
90
+ context 'with multiple email' do
91
+ let(:test_email) { ['test1@test.org', 'test2@test.org'] }
92
+
93
+ it 'sends an update mail' do
94
+ worker.perform(identifier, test_email)
95
+ mail = Mail::TestMailer.deliveries.first
96
+ expect(mail.to).to eq test_email
97
+ end
98
+ end
77
99
  end
78
100
  end
79
101
  end
@@ -5,6 +5,7 @@ requests-oauthlib>=1.0.0 [PDF]
5
5
  -e svn+http://myrepo/svn/MyApp#egg=MyApp
6
6
  Flask>=0.7
7
7
  urlobject==1.0
8
+ email-validator ~= 1.1.2
8
9
  six
9
10
  EOF
10
11
 
@@ -44,6 +45,7 @@ describe PythonLang do
44
45
  'requests-oauthlib': Gem::Version.new('1.3.0'),
45
46
  'Flask': Gem::Version.new('1.1.2'),
46
47
  'urlobject': Gem::Version.new('2.4.3'),
48
+ 'email-validator': Gem::Version.new('1.1.2'),
47
49
  'six': Gem::Version.new('1.15.0'),
48
50
  }
49
51
  }
@@ -84,7 +86,7 @@ describe PythonLang do
84
86
  expect(PythonLang).to receive(:latest_version).and_return(*requirements_latest_versions.values)
85
87
  result = PythonLang.parse_file('requirements.txt', REQUIREMENT_TXT)
86
88
  expect(result).to be_a Array
87
- expect(result.length).to eq 6
89
+ expect(result.length).to eq 7
88
90
  result.each do |dep, version|
89
91
  expect(dep).to be_a Gem::Dependency
90
92
  expect(dep.type).to eq :runtime
data/spec/repo_spec.rb CHANGED
@@ -12,6 +12,11 @@ describe CuttingEdge::Repository do
12
12
  expect(CuttingEdge::Repository.headers(nil)).to eq ({})
13
13
  end
14
14
 
15
+ it 'can take an array of email addresses' do
16
+ repo = CuttingEdge::GithubRepository.new(org: 'org', name: 'name', email: ['test1@test.org', 'test2@test2.org'])
17
+ expect(repo.contact_email).to eq ['test1@test.org', 'test2@test2.org']
18
+ end
19
+
15
20
  context 'GitHub' do
16
21
  it 'has a headers method' do
17
22
  expect(CuttingEdge::GithubRepository.headers(nil)).to eq ({:accept => 'application/vnd.github.v3.raw'})
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cutting_edge
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dawa Ometto
8
8
  - Bart Kamphorst
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-12-05 00:00:00.000000000 Z
12
+ date: 2021-09-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gemnasium-parser
@@ -45,28 +45,28 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '4.3'
48
+ version: '5.0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '4.3'
55
+ version: '5.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: sucker_punch
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '2.1'
62
+ version: '3.0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '2.1'
69
+ version: '3.0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: sinatra
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -212,7 +212,7 @@ homepage: http://github.com/repotag/cutting_edge
212
212
  licenses:
213
213
  - GPL-3.0-only
214
214
  metadata: {}
215
- post_install_message:
215
+ post_install_message:
216
216
  rdoc_options: []
217
217
  require_paths:
218
218
  - lib
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  requirements: []
230
230
  rubygems_version: 3.0.3
231
- signing_key:
231
+ signing_key:
232
232
  specification_version: 2
233
233
  summary: Self-hosted dependency monitoring, including shiny badges.
234
234
  test_files: []