cutting_edge 0.0.1 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -2
- data/Gemfile.lock +130 -0
- data/LICENSE +68 -81
- data/Procfile +1 -0
- data/README.md +272 -74
- data/Rakefile +0 -5
- data/bin/cutting_edge +60 -45
- data/config.rb +55 -0
- data/cutting_edge.gemspec +33 -4
- data/heroku.config.rb +20 -0
- data/lib/cutting_edge.rb +1 -1
- data/lib/cutting_edge/app.rb +95 -19
- data/lib/cutting_edge/langs.rb +7 -1
- data/lib/cutting_edge/langs/python.rb +5 -1
- data/lib/cutting_edge/langs/ruby.rb +5 -1
- data/lib/cutting_edge/langs/rust.rb +5 -1
- data/lib/cutting_edge/public/images/error.svg +24 -0
- data/lib/cutting_edge/public/images/languages/python.svg +1 -0
- data/lib/cutting_edge/public/images/languages/ruby.svg +1 -0
- data/lib/cutting_edge/public/images/languages/rust.svg +1 -0
- data/lib/cutting_edge/public/images/ok.svg +24 -0
- data/lib/cutting_edge/public/javascript/clipboard.min.js +7 -0
- data/lib/cutting_edge/public/javascript/cuttingedge.js +53 -0
- data/lib/cutting_edge/public/stylesheets/primer.css +22 -0
- data/lib/cutting_edge/repo.rb +124 -18
- data/lib/cutting_edge/templates/_footer.html.erb +3 -0
- data/lib/cutting_edge/templates/_header.html.erb +8 -0
- data/lib/cutting_edge/templates/_overview.html.erb +9 -0
- data/lib/cutting_edge/templates/badge.svg.erb +39 -0
- data/lib/cutting_edge/templates/index.html.erb +62 -0
- data/lib/cutting_edge/templates/info.html.erb +101 -0
- data/lib/cutting_edge/templates/mail.html.erb +163 -0
- data/lib/cutting_edge/workers/badge.rb +33 -11
- data/lib/cutting_edge/workers/dependency.rb +36 -16
- data/lib/cutting_edge/workers/helpers.rb +8 -0
- data/lib/cutting_edge/workers/mail.rb +38 -0
- data/projects.yml +25 -0
- data/spec/app_spec.rb +115 -0
- data/spec/badge_worker_spec.rb +77 -0
- data/spec/dependency_worker_spec.rb +132 -0
- data/spec/email_worker_spec.rb +43 -0
- data/spec/fixtures.rb +180 -0
- data/spec/fixtures/projects.yml +27 -0
- data/spec/langs/python_spec.rb +47 -5
- data/spec/langs/ruby_spec.rb +105 -0
- data/spec/langs/rust_spec.rb +31 -0
- data/spec/repo_spec.rb +52 -0
- data/spec/spec_helper.rb +9 -1
- metadata +43 -15
- data/lib/cutting_edge/badge.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 374d8036819a980b91ba6a3ca1ed76afac1432c44533544d4f5f8d5ab8abb721
|
4
|
+
data.tar.gz: 38a4d5f3b19c65929e26477a9b093029e75ded17ef577dfcf5059d33ced8c197
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6961bd941782441ad05e4462ef3b20053800a2612490e8cadc2f2fcdafe06904fe64b03f00b36471b921ef62ef1b235c698c685a7bac71730776fd854102babe
|
7
|
+
data.tar.gz: efaeb201b0558e759abb93003ebadc4793622f6a327563f9517355d05bcdb9ea13cc7664a29eb2baebf085ceffae1ca5a6e65dccdf84800575996463923c8796
|
data/Gemfile
CHANGED
@@ -2,8 +2,13 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'redis', require: false
|
4
4
|
|
5
|
-
gem '
|
6
|
-
|
5
|
+
gem 'hashdiff'
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem 'rspec', '~> 3.9'
|
9
|
+
gem 'simplecov'
|
10
|
+
gem 'rack-test'
|
11
|
+
end
|
7
12
|
|
8
13
|
gem 'coveralls', '~>0.8.23', require: false
|
9
14
|
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cutting_edge (0.1)
|
5
|
+
gemnasium-parser (~> 0.1.9)
|
6
|
+
http (~> 4.3)
|
7
|
+
mail (~> 2.7)
|
8
|
+
moneta (~> 1.2)
|
9
|
+
rufus-scheduler (~> 3.6)
|
10
|
+
sinatra (~> 2.0)
|
11
|
+
sinatra-logger (~> 0.3)
|
12
|
+
sucker_punch (~> 2.1)
|
13
|
+
toml-rb (~> 2.0)
|
14
|
+
|
15
|
+
GEM
|
16
|
+
remote: https://rubygems.org/
|
17
|
+
specs:
|
18
|
+
addressable (2.7.0)
|
19
|
+
public_suffix (>= 2.0.2, < 5.0)
|
20
|
+
citrus (3.0.2)
|
21
|
+
concurrent-ruby (1.1.7)
|
22
|
+
coveralls (0.8.23)
|
23
|
+
json (>= 1.8, < 3)
|
24
|
+
simplecov (~> 0.16.1)
|
25
|
+
term-ansicolor (~> 1.3)
|
26
|
+
thor (>= 0.19.4, < 2.0)
|
27
|
+
tins (~> 1.6)
|
28
|
+
diff-lcs (1.4.4)
|
29
|
+
docile (1.3.2)
|
30
|
+
domain_name (0.5.20190701)
|
31
|
+
unf (>= 0.0.5, < 1.0.0)
|
32
|
+
et-orbi (1.2.4)
|
33
|
+
tzinfo
|
34
|
+
ffi (1.13.1)
|
35
|
+
ffi-compiler (1.0.1)
|
36
|
+
ffi (>= 1.0.0)
|
37
|
+
rake
|
38
|
+
fugit (1.4.0)
|
39
|
+
et-orbi (~> 1.1, >= 1.1.8)
|
40
|
+
raabro (~> 1.4)
|
41
|
+
gemnasium-parser (0.1.9)
|
42
|
+
hashdiff (1.0.1)
|
43
|
+
http (4.4.1)
|
44
|
+
addressable (~> 2.3)
|
45
|
+
http-cookie (~> 1.0)
|
46
|
+
http-form_data (~> 2.2)
|
47
|
+
http-parser (~> 1.2.0)
|
48
|
+
http-cookie (1.0.3)
|
49
|
+
domain_name (~> 0.5)
|
50
|
+
http-form_data (2.3.0)
|
51
|
+
http-parser (1.2.1)
|
52
|
+
ffi-compiler (>= 1.0, < 2.0)
|
53
|
+
json (2.3.1)
|
54
|
+
mail (2.7.1)
|
55
|
+
mini_mime (>= 0.1.1)
|
56
|
+
mini_mime (1.0.2)
|
57
|
+
moneta (1.4.1)
|
58
|
+
mustermann (1.1.1)
|
59
|
+
ruby2_keywords (~> 0.0.1)
|
60
|
+
public_suffix (4.0.6)
|
61
|
+
raabro (1.4.0)
|
62
|
+
rack (2.2.3)
|
63
|
+
rack-protection (2.1.0)
|
64
|
+
rack
|
65
|
+
rack-test (1.1.0)
|
66
|
+
rack (>= 1.0, < 3)
|
67
|
+
rake (13.0.1)
|
68
|
+
redis (4.2.2)
|
69
|
+
rspec (3.10.0)
|
70
|
+
rspec-core (~> 3.10.0)
|
71
|
+
rspec-expectations (~> 3.10.0)
|
72
|
+
rspec-mocks (~> 3.10.0)
|
73
|
+
rspec-core (3.10.0)
|
74
|
+
rspec-support (~> 3.10.0)
|
75
|
+
rspec-expectations (3.10.0)
|
76
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
+
rspec-support (~> 3.10.0)
|
78
|
+
rspec-mocks (3.10.0)
|
79
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
+
rspec-support (~> 3.10.0)
|
81
|
+
rspec-support (3.10.0)
|
82
|
+
ruby2_keywords (0.0.2)
|
83
|
+
rufus-scheduler (3.6.0)
|
84
|
+
fugit (~> 1.1, >= 1.1.6)
|
85
|
+
semantic_logger (4.7.3)
|
86
|
+
concurrent-ruby (~> 1.0)
|
87
|
+
simplecov (0.16.1)
|
88
|
+
docile (~> 1.1)
|
89
|
+
json (>= 1.8, < 3)
|
90
|
+
simplecov-html (~> 0.10.0)
|
91
|
+
simplecov-html (0.10.2)
|
92
|
+
sinatra (2.1.0)
|
93
|
+
mustermann (~> 1.0)
|
94
|
+
rack (~> 2.2)
|
95
|
+
rack-protection (= 2.1.0)
|
96
|
+
tilt (~> 2.0)
|
97
|
+
sinatra-logger (0.3.2)
|
98
|
+
semantic_logger
|
99
|
+
sinatra
|
100
|
+
sucker_punch (2.1.2)
|
101
|
+
concurrent-ruby (~> 1.0)
|
102
|
+
sync (0.5.0)
|
103
|
+
term-ansicolor (1.7.1)
|
104
|
+
tins (~> 1.0)
|
105
|
+
thor (1.0.1)
|
106
|
+
tilt (2.0.10)
|
107
|
+
tins (1.26.0)
|
108
|
+
sync
|
109
|
+
toml-rb (2.0.1)
|
110
|
+
citrus (~> 3.0, > 3.0)
|
111
|
+
tzinfo (2.0.2)
|
112
|
+
concurrent-ruby (~> 1.0)
|
113
|
+
unf (0.1.4)
|
114
|
+
unf_ext
|
115
|
+
unf_ext (0.0.7.7)
|
116
|
+
|
117
|
+
PLATFORMS
|
118
|
+
ruby
|
119
|
+
|
120
|
+
DEPENDENCIES
|
121
|
+
coveralls (~> 0.8.23)
|
122
|
+
cutting_edge!
|
123
|
+
hashdiff
|
124
|
+
rack-test
|
125
|
+
redis
|
126
|
+
rspec (~> 3.9)
|
127
|
+
simplecov
|
128
|
+
|
129
|
+
BUNDLED WITH
|
130
|
+
2.1.4
|
data/LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
GNU GENERAL PUBLIC LICENSE
|
2
|
-
Version 3,
|
1
|
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 19 November 2007
|
3
3
|
|
4
4
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5
5
|
Everyone is permitted to copy and distribute verbatim copies
|
@@ -7,17 +7,15 @@
|
|
7
7
|
|
8
8
|
Preamble
|
9
9
|
|
10
|
-
The GNU General Public License is a free, copyleft license for
|
11
|
-
software and other kinds of works
|
10
|
+
The GNU Affero General Public License is a free, copyleft license for
|
11
|
+
software and other kinds of works, specifically designed to ensure
|
12
|
+
cooperation with the community in the case of network server software.
|
12
13
|
|
13
14
|
The licenses for most software and other practical works are designed
|
14
15
|
to take away your freedom to share and change the works. By contrast,
|
15
|
-
|
16
|
+
our General Public Licenses are intended to guarantee your freedom to
|
16
17
|
share and change all versions of a program--to make sure it remains free
|
17
|
-
software for all its users.
|
18
|
-
GNU General Public License for most of our software; it applies also to
|
19
|
-
any other work released this way by its authors. You can apply it to
|
20
|
-
your programs, too.
|
18
|
+
software for all its users.
|
21
19
|
|
22
20
|
When we speak of free software, we are referring to freedom, not
|
23
21
|
price. Our General Public Licenses are designed to make sure that you
|
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
|
|
26
24
|
want it, that you can change the software or use pieces of it in new
|
27
25
|
free programs, and that you know you can do these things.
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
that
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
products. If such problems arise substantially in other domains, we
|
58
|
-
stand ready to extend this provision to those domains in future versions
|
59
|
-
of the GPL, as needed to protect the freedom of users.
|
60
|
-
|
61
|
-
Finally, every program is threatened constantly by software patents.
|
62
|
-
States should not allow patents to restrict development and use of
|
63
|
-
software on general-purpose computers, but in those that do, we wish to
|
64
|
-
avoid the special danger that patents applied to a free program could
|
65
|
-
make it effectively proprietary. To prevent this, the GPL assures that
|
66
|
-
patents cannot be used to render the program non-free.
|
27
|
+
Developers that use our General Public Licenses protect your rights
|
28
|
+
with two steps: (1) assert copyright on the software, and (2) offer
|
29
|
+
you this License which gives you legal permission to copy, distribute
|
30
|
+
and/or modify the software.
|
31
|
+
|
32
|
+
A secondary benefit of defending all users' freedom is that
|
33
|
+
improvements made in alternate versions of the program, if they
|
34
|
+
receive widespread use, become available for other developers to
|
35
|
+
incorporate. Many developers of free software are heartened and
|
36
|
+
encouraged by the resulting cooperation. However, in the case of
|
37
|
+
software used on network servers, this result may fail to come about.
|
38
|
+
The GNU General Public License permits making a modified version and
|
39
|
+
letting the public access it on a server without ever releasing its
|
40
|
+
source code to the public.
|
41
|
+
|
42
|
+
The GNU Affero General Public License is designed specifically to
|
43
|
+
ensure that, in such cases, the modified source code becomes available
|
44
|
+
to the community. It requires the operator of a network server to
|
45
|
+
provide the source code of the modified version running there to the
|
46
|
+
users of that server. Therefore, public use of a modified version, on
|
47
|
+
a publicly accessible server, gives the public access to the source
|
48
|
+
code of the modified version.
|
49
|
+
|
50
|
+
An older license, called the Affero General Public License and
|
51
|
+
published by Affero, was designed to accomplish similar goals. This is
|
52
|
+
a different license, not a version of the Affero GPL, but Affero has
|
53
|
+
released a new version of the Affero GPL which permits relicensing under
|
54
|
+
this license.
|
67
55
|
|
68
56
|
The precise terms and conditions for copying, distribution and
|
69
57
|
modification follow.
|
@@ -72,7 +60,7 @@ modification follow.
|
|
72
60
|
|
73
61
|
0. Definitions.
|
74
62
|
|
75
|
-
"This License" refers to version 3 of the GNU General Public License.
|
63
|
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
76
64
|
|
77
65
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
78
66
|
works, such as semiconductor masks.
|
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
|
|
549
537
|
the Program, the only way you could satisfy both those terms and this
|
550
538
|
License would be to refrain entirely from conveying the Program.
|
551
539
|
|
552
|
-
13. Use with the GNU
|
540
|
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
541
|
+
|
542
|
+
Notwithstanding any other provision of this License, if you modify the
|
543
|
+
Program, your modified version must prominently offer all users
|
544
|
+
interacting with it remotely through a computer network (if your version
|
545
|
+
supports such interaction) an opportunity to receive the Corresponding
|
546
|
+
Source of your version by providing access to the Corresponding Source
|
547
|
+
from a network server at no charge, through some standard or customary
|
548
|
+
means of facilitating copying of software. This Corresponding Source
|
549
|
+
shall include the Corresponding Source for any work covered by version 3
|
550
|
+
of the GNU General Public License that is incorporated pursuant to the
|
551
|
+
following paragraph.
|
553
552
|
|
554
553
|
Notwithstanding any other provision of this License, you have
|
555
554
|
permission to link or combine any covered work with a work licensed
|
556
|
-
under version 3 of the GNU
|
555
|
+
under version 3 of the GNU General Public License into a single
|
557
556
|
combined work, and to convey the resulting work. The terms of this
|
558
557
|
License will continue to apply to the part which is the covered work,
|
559
|
-
but the
|
560
|
-
|
561
|
-
combination as such.
|
558
|
+
but the work with which it is combined will remain governed by version
|
559
|
+
3 of the GNU General Public License.
|
562
560
|
|
563
561
|
14. Revised Versions of this License.
|
564
562
|
|
565
563
|
The Free Software Foundation may publish revised and/or new versions of
|
566
|
-
the GNU General Public License from time to time. Such new versions
|
567
|
-
be similar in spirit to the present version, but may differ in detail to
|
564
|
+
the GNU Affero General Public License from time to time. Such new versions
|
565
|
+
will be similar in spirit to the present version, but may differ in detail to
|
568
566
|
address new problems or concerns.
|
569
567
|
|
570
568
|
Each version is given a distinguishing version number. If the
|
571
|
-
Program specifies that a certain numbered version of the GNU General
|
569
|
+
Program specifies that a certain numbered version of the GNU Affero General
|
572
570
|
Public License "or any later version" applies to it, you have the
|
573
571
|
option of following the terms and conditions either of that numbered
|
574
572
|
version or of any later version published by the Free Software
|
575
573
|
Foundation. If the Program does not specify a version number of the
|
576
|
-
GNU General Public License, you may choose any version ever published
|
574
|
+
GNU Affero General Public License, you may choose any version ever published
|
577
575
|
by the Free Software Foundation.
|
578
576
|
|
579
577
|
If the Program specifies that a proxy can decide which future
|
580
|
-
versions of the GNU General Public License can be used, that proxy's
|
578
|
+
versions of the GNU Affero General Public License can be used, that proxy's
|
581
579
|
public statement of acceptance of a version permanently authorizes you
|
582
580
|
to choose that version for the Program.
|
583
581
|
|
@@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
|
|
635
633
|
Copyright (C) <year> <name of author>
|
636
634
|
|
637
635
|
This program is free software: you can redistribute it and/or modify
|
638
|
-
it under the terms of the GNU General Public License as published
|
639
|
-
the Free Software Foundation, either version 3 of the License, or
|
636
|
+
it under the terms of the GNU Affero General Public License as published
|
637
|
+
by the Free Software Foundation, either version 3 of the License, or
|
640
638
|
(at your option) any later version.
|
641
639
|
|
642
640
|
This program is distributed in the hope that it will be useful,
|
643
641
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644
642
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645
|
-
GNU General Public License for more details.
|
643
|
+
GNU Affero General Public License for more details.
|
646
644
|
|
647
|
-
You should have received a copy of the GNU General Public License
|
645
|
+
You should have received a copy of the GNU Affero General Public License
|
648
646
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
649
647
|
|
650
648
|
Also add information on how to contact you by electronic and paper mail.
|
651
649
|
|
652
|
-
If
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
661
|
-
parts of the General Public License. Of course, your program's commands
|
662
|
-
might be different; for a GUI interface, you would use an "about box".
|
650
|
+
If your software can interact with users remotely through a computer
|
651
|
+
network, you should also make sure that it provides a way for users to
|
652
|
+
get its source. For example, if your program is a web application, its
|
653
|
+
interface could display a "Source" link that leads users to an archive
|
654
|
+
of the code. There are many ways you could offer source, and different
|
655
|
+
solutions will be better for different programs; see section 13 for the
|
656
|
+
specific requirements.
|
663
657
|
|
664
658
|
You should also get your employer (if you work as a programmer) or school,
|
665
659
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666
|
-
For more information on this, and how to apply and follow the GNU
|
660
|
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
667
661
|
<https://www.gnu.org/licenses/>.
|
668
|
-
|
669
|
-
The GNU General Public License does not permit incorporating your program
|
670
|
-
into proprietary programs. If your program is a subroutine library, you
|
671
|
-
may consider it more useful to permit linking proprietary applications with
|
672
|
-
the library. If this is what you want to do, use the GNU Lesser General
|
673
|
-
Public License instead of this License. But first, please read
|
674
|
-
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
data/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec cutting_edge -p $PORT --config heroku.config.rb
|
data/README.md
CHANGED
@@ -1,95 +1,293 @@
|
|
1
|
+
# CuttingEdge -- Simple, self-hosted dependency monitoring
|
2
|
+
|
1
3
|
[![Build Status](https://travis-ci.org/repotag/cutting_edge.svg?branch=master)](https://travis-ci.org/repotag/cutting_edge)
|
2
4
|
[![Coverage Status](https://coveralls.io/repos/github/repotag/cutting_edge/badge.svg?branch=master)](https://coveralls.io/github/repotag/cutting_edge?branch=master)
|
5
|
+
[![Cutting Edge Dependency Status](https://dometto-cuttingedge.herokuapp.com/github/repotag/cutting_edge/svg 'Cutting Edge Dependency Status')](https://dometto-cuttingedge.herokuapp.com/github/repotag/cutting_edge/info)
|
6
|
+
|
7
|
+
CuttingEdge monitors the status of the dependencies of your projects and lets you know when any of them go out of date.
|
8
|
+
|
9
|
+
## Features
|
10
|
+
|
11
|
+
* Generates badge images that you can include in your projects' Readme, like the one above!
|
12
|
+
* Can send you email when the status of a project's dependencies changes
|
13
|
+
* Serves a simple [info page](https://dometto-cuttingedge.herokuapp.com/github/repotag/cutting_edge/info) detailing the status of each project
|
14
|
+
* Supports the following languages:
|
15
|
+
* Ruby
|
16
|
+
* Python
|
17
|
+
* Rust
|
18
|
+
* [...add more!](https://github.com/repotag/cutting_edge/wiki/Languages)
|
19
|
+
* Supports the following platforms:
|
20
|
+
* GitHub
|
21
|
+
* Gitlab (both gitlab.com and [self-hosted instances](#Adding-self-hosted-repository-servers))
|
22
|
+
* Gitea ([self-hosted](#Adding-self-hosted-repository-servers))
|
23
|
+
* Both public and [private repositories](#Authorization-and-private-repositories)
|
24
|
+
|
25
|
+
**View the web front end of a [live instance](https://dometto-cuttingedge.herokuapp.com/)**.
|
26
|
+
|
27
|
+
## Requirements
|
28
|
+
|
29
|
+
CuttingEdge is lightweight and easy to deploy:
|
30
|
+
|
31
|
+
* No database required
|
32
|
+
* you can optionally use [data stores like Redis](#Using-Redis-and-other-data-stores)
|
33
|
+
* Simple configuration through a `projects.yml` file
|
34
|
+
* Requires relatively few resources (~120MB RAM), so...
|
35
|
+
* It can even run on [Heroku](#Deploying-on-Heroku)'s free plan!
|
36
|
+
|
37
|
+
## Installation
|
38
|
+
|
39
|
+
Simply:
|
40
|
+
|
41
|
+
```
|
42
|
+
$ gem install cutting_edge
|
43
|
+
$ cutting_edge
|
44
|
+
```
|
45
|
+
|
46
|
+
Or run from source:
|
47
|
+
|
48
|
+
```
|
49
|
+
$ git clone https://github.com/repotag/cutting_edge.git
|
50
|
+
$ cd cutting_edge
|
51
|
+
$ bundle install
|
52
|
+
$ bundle exec cutting_edge
|
53
|
+
```
|
54
|
+
|
55
|
+
Before running, define your repositories in [projects.yml](#projects-yml). You may also want to change some settings in [config.rb](#config-rb).
|
56
|
+
|
57
|
+
### Deploying on Heroku
|
58
|
+
|
59
|
+
CuttingEdge runs out of the box on Heroku, and is lightweight enough to function on the Heroku free plan. This repository already contains the `Procfile` needed for deployment.
|
60
|
+
|
61
|
+
**Note: on Heroku, CuttingEdge uses `heroku.config.rb` instead of `config.rb`**.
|
62
|
+
|
63
|
+
Steps:
|
64
|
+
|
65
|
+
1. Clone/fork this repository, as it already contains some settings (in `heroku.config.rb`) relevant to Heroku
|
66
|
+
1. Edit `projects.yml` and commit it to the repo
|
67
|
+
1. `heroku create my-cuttingedge`
|
68
|
+
1. `heroku config:add HEROKU_APP_NAME=my-cuttingedge`
|
69
|
+
1. `git push heroku master`
|
70
|
+
1. *Optional, if you want to receive [email notifications](#Email-Notifications)*:
|
71
|
+
* `heroku addons:create mailgun:starter`
|
72
|
+
* `heroku config:add CUTTING_EDGE_MAIL_TO=mydependencies@mydependencymonitoring.com`
|
73
|
+
* If you are on the free plan: [add your email addresses as Authorized Recipients](https://help.mailgun.com/hc/en-us/articles/217531258-Authorized-Recipients) in [Mailgun](https://app.mailgun.com/) (login via Heroku)
|
74
|
+
|
75
|
+
You may also want to set some [Heroku config variables](https://devcenter.heroku.com/articles/config-vars), for instance to [use authentication tokens](#Authorization-and-private-repositories) in `heroku.config.rb`.
|
76
|
+
|
77
|
+
Note that Heroku switches off apps running on their free plan when they idle, so you may want to look at [this](https://medium.com/better-programming/keeping-my-heroku-app-alive-b19f3a8c3a82).
|
78
|
+
|
79
|
+
## Usage
|
80
|
+
|
81
|
+
When your instance of CuttingEdge is running, you can visit the landing page by pointing your browser to the root URL of the app. Locally, it is by default accessible at:
|
82
|
+
|
83
|
+
`http://localhost:4567/`
|
84
|
+
|
85
|
+
(Of course, you can also bind it to port 80 or 443 and make it accessible from the internet using the `--port` and `--host` arguments. Or you could place Apache or nginx in front of CuttingEdge.)
|
86
|
+
|
87
|
+
An instance on Heroku will be accessible through:
|
88
|
+
|
89
|
+
`https://your-app-name.herokuapp.com/`
|
90
|
+
|
91
|
+
### projects.yml
|
92
|
+
|
93
|
+
`projects.yml` is the file in which you define which repositories you want CuttingEdge to monitor. Here's an example:
|
94
|
+
|
95
|
+
```yaml
|
96
|
+
github:
|
97
|
+
my_org:
|
98
|
+
my_project:
|
99
|
+
language: ruby
|
100
|
+
```
|
101
|
+
|
102
|
+
This will make CuttingEdge monitor the GitHub project `my_org/my_project`. You can add multiple repositories under the `github:` key, and also use the `gitlab:` key for repositories on gitlab.com out of the box. If you [add self-hosted providers](#Adding-self-hosted-repository-servers), you'll be able to define repositories using, for instance, `my_gitea:`.
|
103
|
+
|
104
|
+
The `language:` key can currently be set to `ruby` (default), `rust`, or `python`. Further supported keys:
|
105
|
+
|
106
|
+
* `auth_token`: see [here](#Authorization-and-private-repositories)
|
107
|
+
* `hide`: see [here](#Hide-repositories)
|
108
|
+
* `locations`: use to change the default path to dependency definition files. For instance, for a Ruby project, CuttingEdge will by default try to monitor `Gemfile` and `my_project.gemspec`. You can override this with `language: [Gemfile, alternative/file.gemspec]`
|
109
|
+
* `branch`: use a different branch than the default `master`
|
110
|
+
* `email`:
|
111
|
+
* disable email notifications for a single project by setting this to `false`
|
112
|
+
* use a non-default address delivery address for this project by setting this to e.g. `myproject@mydependencymonitoring.com`
|
113
|
+
|
114
|
+
Note: by default CuttingEdge will use `projects.yml` in the working directory. You may optionally specify a different path by running `cutting_edge path/to/my_projects.yml`.
|
115
|
+
|
116
|
+
Instead of `projects.yml`, you can also [define projects in `config.rb`](#Defining-repositories-in-configrb).
|
117
|
+
|
118
|
+
### config.rb
|
119
|
+
|
120
|
+
To configure CuttingEdge specific settings in `config.rb`, you can run `cutting_edge` with the `--config` switch (you can optionally specify an alternative location for the config file). Always make sure you are defining your settings from within the `CuttingEdge` module. For instance:
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
module CuttingEdge
|
124
|
+
REFRESH_SCHEDULE = '2h'
|
125
|
+
end
|
126
|
+
```
|
127
|
+
|
128
|
+
The sample [config.rb](config.rb) contains some examples of constants that you may wish to configure. Here are some descriptions of what the less obvious ones achieve:
|
129
|
+
|
130
|
+
* `SECRET_TOKEN`: set a global secret token for administrative purposes. This token is used to configure [hooks](#Refreshing-dependency-status-through-git-hooks), and to list [hidden projects](#Hide-Repositories).
|
131
|
+
* `SERVER_URL`: the link to the app that should be displayed, for instance in emails. Defaults to `"http://#{SERVER_HOST}"`
|
132
|
+
* `MAIL_TEMPLATE`: override the [ERB](https://www.stuartellis.name/articles/erb/) template used to render [emails](#Email-Notifications). See [mail.html.erb](lib/cutting_edge/templates/mail.html.erb) for an example on which variables you can use within the template.
|
133
|
+
|
134
|
+
### Email Notifications
|
135
|
+
|
136
|
+
CuttingEdge can send email notifications whenever a change in the dependency status of a monitored project is detected. This is disabled by default. Enable it in `config.rb`:
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
module CuttingEdge
|
140
|
+
MAIL_TO = 'mydeps@mymail.com' # Default address to send email to. If set to false (=default!), don't send any emails except for repositories that have their 'email:' attribute set in projects.yml
|
141
|
+
MAIL_FROM = "cutting_edge@my_server.com" # From Address used for sending emails.
|
142
|
+
end
|
143
|
+
```
|
3
144
|
|
4
|
-
|
145
|
+
By default, the app wil try to use an SMTP server on `localhost:25`. Change these settings in your `config.rb` by calling `Mail.defaults`:
|
5
146
|
|
6
|
-
|
147
|
+
```ruby
|
148
|
+
# This should be outside the module CuttingEdge
|
149
|
+
Mail.defaults do
|
150
|
+
delivery_method :smtp, address: "localhost", port: 1025
|
151
|
+
end
|
152
|
+
```
|
7
153
|
|
8
|
-
|
9
|
-
* Runs on http://localhost:4567
|
10
|
-
* Routes under `/source/org/name`
|
11
|
-
* For example: http://localhost:4567/github/gollum/gollum/info
|
154
|
+
See [the mail gem](https://github.com/mikel/mail#sending-an-email) for more information.
|
12
155
|
|
13
|
-
|
156
|
+
You can switch off email notifications for a single project by setting its `email:` key to `false` in [projects.yml](#projects-yml). Alternatively, you can set the `email:` key for a single project to a different address than the default `MAIL_TO`.
|
14
157
|
|
15
|
-
|
158
|
+
### Adding self-hosted repository servers
|
159
|
+
|
160
|
+
You can monitor projects on your own self-hosted Gitlab or Gitea instances. To do so, you need to tell CuttingEdge about your server by editing `config.rb` as follows:
|
16
161
|
|
17
|
-
* Fetch gemfile and gemspec for a given Gem
|
18
|
-
* Currently, the `GithubGem` class specifies the needed information for a gem hosted on github, ditto for the `GitlabGem` class for gitlab.
|
19
|
-
* These are subclasses of `RepositoryGem`.
|
20
|
-
* Parse both files for dependency requirements
|
21
|
-
* Does not bork if either of the files could not be retrieved.
|
22
|
-
* Determine the latest version for each required gem
|
23
|
-
* By querying rubygems for a version of the gem `>= 0`.
|
24
|
-
* Generate a Hash of results of the following form:
|
25
162
|
```ruby
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
:
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
* These results are stored in a Moneta store under a key generated by `RepositoryGem#identifier` (for e.g. a `GithubGem`, the identifier will be of the form `'github/org/name'`).
|
69
|
-
* The Moneta store used by the Worker is provided by the Sinatra app Class: `::CuttingEdge::App.store`.
|
70
|
-
* So we must do e.g. `CuttingEdge::App.set(:store, Moneta.new(:Memory))` to set the `#store` method on the `CuttingEdge` Class.
|
71
|
-
|
72
|
-
### Example use of the DependencyWorker and Gem API
|
73
|
-
|
74
|
-
See `test.rb` for a basic example (without Sinatra) of how the setup works. Run it with `bundle exec ruby test.rb`.
|
163
|
+
module CuttingEdge
|
164
|
+
require './lib/cutting_edge/repo.rb'
|
165
|
+
define_gitlab_server('mygitlab', 'https://mygitlab.com')
|
166
|
+
define_gitea_server('mygitea', 'https://mygitea.com')
|
167
|
+
end
|
168
|
+
```
|
169
|
+
|
170
|
+
This will allow you to use the `mygitlab:` and `mygitea:` keys in `projects.yml`, for instance like so:
|
171
|
+
|
172
|
+
```yaml
|
173
|
+
mygitlab:
|
174
|
+
myorg:
|
175
|
+
project-name:
|
176
|
+
lang: rust
|
177
|
+
mygitea:
|
178
|
+
myorg2:
|
179
|
+
project-name2:
|
180
|
+
lang: python
|
181
|
+
```
|
182
|
+
|
183
|
+
Don't forget to run CuttingEdge with the `--config` option!
|
184
|
+
|
185
|
+
### Authorization and private repositories
|
186
|
+
|
187
|
+
If you want to monitor dependencies in a private (e.g. GitHub or Gitlab) project, you can instruct CuttingEdge to use an API token for accessing the dependency files. In `projects.yml`:
|
188
|
+
|
189
|
+
```yaml
|
190
|
+
github:
|
191
|
+
secret-org:
|
192
|
+
secret-repo:
|
193
|
+
auth_token: 'mysecrettoken'
|
194
|
+
```
|
195
|
+
|
196
|
+
For info on generating API tokens, see:
|
197
|
+
|
198
|
+
* [GitHub](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token)
|
199
|
+
* [Gitlab](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)
|
200
|
+
* [Gitea](https://docs.gitea.io/en-us/api-usage/)
|
201
|
+
|
202
|
+
### Defining repositories in config.rb
|
203
|
+
|
204
|
+
If you don't want to expose information about a project in (**such as an [API token](#Authorization-and-private-repositories)!**) `projects.yml` (which may be publically accessible on the internet), you can instead define your project repository programatically in `config.rb`. This will allow you to define repositories with secret parameters by (for instance) utilising environment variables:
|
75
205
|
|
76
206
|
```ruby
|
77
|
-
|
207
|
+
module CuttingEdge
|
208
|
+
require './lib/cutting_edge/repo.rb'
|
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'])
|
211
|
+
}
|
212
|
+
end
|
213
|
+
```
|
78
214
|
|
79
|
-
|
215
|
+
This approach is especially useful on Heroku, where you can use [Heroku config variables](https://devcenter.heroku.com/articles/config-vars).
|
80
216
|
|
81
|
-
|
82
|
-
gem_dependencies = Redis::Value.new(gem.identifier)
|
217
|
+
### Hide Repositories
|
83
218
|
|
84
|
-
|
219
|
+
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`:
|
85
220
|
|
86
|
-
|
221
|
+
```yaml
|
222
|
+
github:
|
223
|
+
secret-org:
|
224
|
+
secret-repo:
|
225
|
+
auth_token: 'mysecrettoken'
|
226
|
+
hide: 'myhiddenrepo'
|
227
|
+
```
|
87
228
|
|
88
|
-
|
229
|
+
...or again, you can do so in `config.rb` following the [method explained above](#Defining-repositories-in-configrb):
|
89
230
|
|
90
|
-
|
231
|
+
```ruby
|
232
|
+
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'])
|
233
|
+
end
|
91
234
|
```
|
92
235
|
|
236
|
+
Setting the `hide` key to a token of your choice will ensure that:
|
237
|
+
|
238
|
+
1. your hidden repo is not listed in the web frontend.
|
239
|
+
* to list all hidden repositories, you can enter your `CuttingEdge::SECRET_TOKEN` after clicking the "List hidden repositories" on the landing page.
|
240
|
+
* **NB: this is your [global administrator token](#configrb), not the particular token used to hide a particular project.**
|
241
|
+
2. the `/info` route and SVG image for your hidden repo are not accessible without the repo-specific token you have set via `hide:`
|
242
|
+
|
243
|
+
When you go to the `/info` route for your hidden repo (by first entering your administrator token, then clicking on the SVG for the project), you can click the "Embed" button and thereby acquire a link to the SVG dependency status image that contains the `hide:` token. You can thus use this link on a private repository, without giving collaborators on that project access to information about your other hidden repositories!
|
244
|
+
|
245
|
+
### Refreshing dependency status through git hooks
|
246
|
+
|
247
|
+
CuttingEdge by default checks whether the status of your dependencies has changed once every hour. However, if you wish, you can also setup hooks so that dependency status is checked (for instance) whenever you make a commit to your project.
|
248
|
+
|
249
|
+
For this purpose, CuttingEdge provides the following route:
|
250
|
+
|
251
|
+
```
|
252
|
+
http://mycuttingedge.com/github/org/myproject/refresh?token=mysecrettoken
|
253
|
+
```
|
254
|
+
|
255
|
+
An HTTP `POST` request to that route will cause the dependencies for that project to refresh. This requires you to define a secret token in `config.rb`, so that third parties cannot trigger refreshes. In `config.rb`:
|
256
|
+
|
257
|
+
```ruby
|
258
|
+
module CuttingEdge
|
259
|
+
CuttingEdge::SECRET_TOKEN = 'mysecrettoken' # Note: this token is used to refresh all the projects on your CuttingEdge instance
|
260
|
+
end
|
261
|
+
```
|
262
|
+
|
263
|
+
Using this route you can, for instance, set up a [GitHub Action](https://docs.github.com/en/free-pro-team@latest/actions) (or equivalent for other providers). Of course, this requires defining the secret token as (for instance) a [GitHub Secret](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets).
|
264
|
+
|
265
|
+
You can test the route like this:
|
266
|
+
|
267
|
+
```
|
268
|
+
curl -d 'token=mysecrettoken' http://mycuttingedge.com/github/org/myproject/refresh
|
269
|
+
```
|
270
|
+
|
271
|
+
## Using Redis and other data stores
|
272
|
+
|
273
|
+
CuttingEdge does not require persistence, as the data it uses (which dependencies does a project have, and are they up to date?) is refreshed periodically anyway. By default, this information is stored in memory. However, if you would like to store data in a different kind of data store (for instance Redis) that can be trivially accomplished. This may further decrease the amount of RAM CuttingEdge requires, and possibly improve performance.
|
274
|
+
|
275
|
+
CuttingEdge uses [Moneta](https://github.com/moneta-rb/moneta) as an abstraction layer for its data store, so to change the data store can just do the following in `config.rb`:
|
276
|
+
|
277
|
+
```ruby
|
278
|
+
module CuttingEdge
|
279
|
+
STORE = Moneta.new(:Redis)
|
280
|
+
end
|
281
|
+
```
|
282
|
+
|
283
|
+
See the [Moneta](https://github.com/moneta-rb/moneta) instructions.
|
284
|
+
|
285
|
+
Note that Heroku offers a free [Redis Add-on](https://elements.heroku.com/addons/heroku-redis).
|
286
|
+
|
287
|
+
## Contributing
|
288
|
+
|
289
|
+
See [here](CONTRIBUTING.md).
|
290
|
+
|
93
291
|
## License
|
94
292
|
|
95
|
-
This work is licensed under the terms of the [GNU GPLv3.0](LICENSE).
|
293
|
+
This work is licensed under the terms of the [GNU Affero GPLv3.0](LICENSE). Copyright Dawa Ometto and Bart Kamphorst, 2020.
|