diggit 3.0.0 → 3.0.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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +12 -0
- data/README.md +19 -14
- data/bin/dgit +14 -13
- data/lib/dgit/core.rb +16 -9
- data/lib/dgit/log.rb +10 -6
- data/lib/dgit/version.rb +1 -1
- metadata +18 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 923c33e8ad605d0ce6a4213cc65b733d39e5a022bc316ce5274a5cead3a793a1
|
4
|
+
data.tar.gz: 835b774912312f59d93049e237259b73d51a022bd8ec2268be9c0391986e215f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90e82684cdea177aab66ba4a32d31a82a25a00dd358840b1139572bb5da9d9857957f10331d4ffb5cc7e96b28d96d064a8558bfe7734dd25aee470111ca0774c
|
7
|
+
data.tar.gz: 5bb52f527c746f2666f272460a80ade1e5f4558e3cabdab27c824c131200a200b31907b688fa275fb2e753ad4e67730b5f930d8e28c33a9748048e7254204fab
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog of Diggit
|
2
2
|
|
3
|
+
### Version 3.0.1
|
4
|
+
* Verbose option now used
|
5
|
+
* Improved gemspec
|
6
|
+
* Use new OJ upstream
|
7
|
+
* Improve help messages
|
8
|
+
|
9
|
+
### Version 3.0.0 (Cod)
|
10
|
+
* Compatible with new Oj version
|
11
|
+
* Cleaner docker image
|
12
|
+
* Updated conflict_merge analysis
|
13
|
+
* Fix dependencies vulnerabilities
|
14
|
+
|
3
15
|
### Version 2.1.2
|
4
16
|
* Improve documentation
|
5
17
|
* Fix bug of `sources del`
|
data/README.md
CHANGED
@@ -1,18 +1,23 @@
|
|
1
|
-
# Diggit
|
1
|
+
# Diggit
|
2
2
|
|
3
|
-
|
3
|
+
An agile tool to analyze Git repositories
|
4
4
|
|
5
|
-
|
5
|
+
## State
|
6
6
|
|
7
|
-
|
7
|
+
* Develop branch: [](https://travis-ci.org/jrfaller/diggit) [](https://coveralls.io/r/jrfaller/diggit?branch=develop) [](http://inch-ci.org/github/jrfaller/diggit)
|
8
|
+
* Master branch: [](https://travis-ci.org/jrfaller/diggit) [](https://coveralls.io/r/jrfaller/diggit?branch=develop) [](http://inch-ci.org/github/jrfaller/diggit)
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
### Prerequisites
|
8
13
|
|
9
14
|
In order for Ruby's libgit binding, [rugged](Pre-requisites), to work, you need to install several native libraries. To build the libgit version shipped with rugged's gem, you need `pkg-config` and `cmake` installed. If you want rugged to be able to clone ssh or https repositories, you need several additional depenc as listed on [libgit website](https://github.com/libgit2/libgit2#optional-dependencies).
|
10
15
|
|
11
|
-
|
16
|
+
### From a gem
|
12
17
|
|
13
18
|
Just run `gem install diggit`.
|
14
19
|
|
15
|
-
|
20
|
+
### From the sources, with bundler
|
16
21
|
|
17
22
|
Install diggit using the following commands:
|
18
23
|
```
|
@@ -23,35 +28,35 @@ bundler install
|
|
23
28
|
```
|
24
29
|
Beware, the gem bin directory must be in your path. Also, the `dgit` command is in the `bin` folder of diggit.
|
25
30
|
|
26
|
-
|
31
|
+
### From the sources, with vagrant
|
27
32
|
|
28
33
|
You can automatically get a working VM with all required dependencies with only one command, how cool is that? For this, just install [vagrant](https://www.vagrantup.com/) and [virtualbox](https://www.virtualbox.org/), and `vagrant up` in a freshly cloned diggit folder (see previous section). Beware, this magic only works on Mac OS and Linux because it uses NFS shared folders. Note that if you use this method, you don't care about the prerequisites.
|
29
34
|
|
30
|
-
|
35
|
+
## Usage
|
31
36
|
|
32
37
|
Don't forget that dgit binary has an associated help that can be consulted using `dgit help`. Additionally, if you have installed Diggit from the sources, you can generate the documentation by running `yard doc` in the cloned folder.
|
33
38
|
|
34
|
-
|
39
|
+
### Configuration
|
35
40
|
|
36
41
|
The diggit tool is designed to help you analyze software repositories. Firstly you have to create a new folder in which you launch the `dgit init` command. This way, the folder becomes a diggit folder in which you can configure repositories and analyses.
|
37
42
|
|
38
|
-
|
43
|
+
#### Setting-up the repositories
|
39
44
|
|
40
45
|
You can add some repositories to be analyzed with the following command: `dgit sources add https://github.com/jrfaller/diggit.git`.
|
41
46
|
|
42
|
-
|
47
|
+
#### Setting-up analyses
|
43
48
|
|
44
49
|
An analysis is applied to each repository. You can configure the analyses to be performed with the following command: `dgit analyses add test_analysis`. Analyses are performed in the order they have been added. Analyses are provided in the `plugins/analysis` folder (from the diggit installation or in any initialized diggit folder). The filename of an analysis is the underscore cased name of the class where it is defined (which is camel cased). Analyses classes must extend the `Diggit::Analysis` class.
|
45
50
|
|
46
|
-
|
51
|
+
#### Setting-up joins
|
47
52
|
|
48
53
|
A join is performed after all analyses of all repositories have been performed. You can configure the joins to be performed with the following command: `dgit joins add test_join`. Joins are performed in the order they have been added. Similarly to analyses, joins are provided in the `plugins/join` folder (from the diggit installation or in any initialized diggit folder). The filename of a join is the underscore cased name of the class where it is defined (which is camel cased). Joins must provide constraints on the analyses that must have been performed on the sources by using `require_analyses` in the class defining the join. For instance, to require the `test_analysis` analysisn, you need to use the statement `require_analyses test_analysis`. Joins classes must extend the `Diggit::Join` class.
|
49
54
|
|
50
|
-
|
55
|
+
#### Using addons
|
51
56
|
|
52
57
|
Addons add features to analyses or joins: for instance the capability of writing to a MongoDB database, etc. To enable addons for an analysis or a join you need to use `require_addons` in an analysis or join class. For instance, to use the filesytem addon you need the following statement: `require_addons out`
|
53
58
|
|
54
|
-
|
59
|
+
### Cloning, analysing and joining
|
55
60
|
|
56
61
|
Once diggit is configured you can perform the analyses. First, you have to clone the repositories by using `dgit clones perform`. Then you can launch the analyses by using `dgit analyses perform`. Finally, the joins are executed via the command `dgit joins perform`. You can use the `mode` option to handle the cleaning of joins or analyses (e.g. `dgit analyses perform -m rerun`).
|
57
62
|
|
data/bin/dgit
CHANGED
@@ -24,7 +24,7 @@ module Diggit
|
|
24
24
|
include GLI::App
|
25
25
|
|
26
26
|
extend self
|
27
|
-
program_desc '
|
27
|
+
program_desc 'The agile git repository analysis tool.'
|
28
28
|
|
29
29
|
switch %i[v verbose], default_value: false, negatable: false, desc: "Indicates if the debug information are visible."
|
30
30
|
flag %i[f folder], default_value: ".", desc: "Path to the diggit folder. Default: current folder."
|
@@ -92,22 +92,23 @@ module Diggit
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
|
+
c.desc 'The source URL.'
|
96
|
+
c.arg_name '<url>'
|
95
97
|
c.desc 'Add a source.'
|
96
|
-
c.arg_name 'url'
|
97
98
|
c.command :add do |add|
|
98
99
|
add.action do |_global_options, _options, args|
|
99
100
|
Diggit::Dig.it.journal.add_source args[0]
|
100
101
|
end
|
101
102
|
end
|
102
103
|
c.desc 'Delete a source.'
|
103
|
-
c.arg_name 'id'
|
104
|
+
c.arg_name '<id>'
|
104
105
|
c.command :del do |del|
|
105
106
|
del.action do |_global_options, _options, args|
|
106
107
|
Diggit::Dig.it.journal.del_source args[0].to_i
|
107
108
|
end
|
108
109
|
end
|
109
110
|
c.desc 'Import sources from a file.'
|
110
|
-
c.arg_name 'file'
|
111
|
+
c.arg_name '<file>'
|
111
112
|
c.command :import do |import|
|
112
113
|
import.action do |_global_options, _options, args|
|
113
114
|
File.open(args[0]).each { |line| Diggit::Dig.it.journal.add_source(line.strip) }
|
@@ -124,7 +125,7 @@ module Diggit
|
|
124
125
|
end
|
125
126
|
end
|
126
127
|
c.desc 'Display information on a source'
|
127
|
-
c.arg_name 'id'
|
128
|
+
c.arg_name '<id>'
|
128
129
|
c.command :info do |info|
|
129
130
|
info.action do |_global_options, _options, args|
|
130
131
|
src = Diggit::Dig.it.journal.sources_by_ids(args[0].to_i)[0]
|
@@ -162,14 +163,14 @@ module Diggit
|
|
162
163
|
end
|
163
164
|
end
|
164
165
|
c.desc 'Add a join.'
|
165
|
-
c.arg_name 'name'
|
166
|
+
c.arg_name '<name>'
|
166
167
|
c.command :add do |add|
|
167
168
|
add.action do |_global_options, _options, args|
|
168
169
|
Diggit::Dig.it.config.add_join args[0]
|
169
170
|
end
|
170
171
|
end
|
171
172
|
c.desc 'Delete a join.'
|
172
|
-
c.arg_name 'name'
|
173
|
+
c.arg_name '<name>'
|
173
174
|
c.command :del do |del|
|
174
175
|
del.action do |_global_options, _options, args|
|
175
176
|
Diggit::Dig.it.config.del_join args[0]
|
@@ -177,9 +178,9 @@ module Diggit
|
|
177
178
|
end
|
178
179
|
c.desc 'Perform joins.'
|
179
180
|
c.command :perform do |perform|
|
180
|
-
perform.flag %i[s sources], desc: "list of sources", type: Array, default_value: []
|
181
|
+
perform.flag %i[s sources], desc: "list of sources id", type: Array, default_value: []
|
181
182
|
perform.flag %i[a analyses], desc: "list of analyses", type: Array, default_value: []
|
182
|
-
perform.flag %i[m mode], desc: "running mode",
|
183
|
+
perform.flag %i[m mode], desc: "running mode: run, clean or rerun",
|
183
184
|
must_match: { "run" => :run, "clean" => :clean, "rerun" => :rerun }, default_value: :run
|
184
185
|
perform.action do |_global_options, options, _args|
|
185
186
|
Diggit::Dig.it.join(options[:s], options[:a], options[:m])
|
@@ -197,14 +198,14 @@ module Diggit
|
|
197
198
|
end
|
198
199
|
end
|
199
200
|
c.desc 'Add an analysis.'
|
200
|
-
c.arg_name 'name'
|
201
|
+
c.arg_name '<name>'
|
201
202
|
c.command :add do |add|
|
202
203
|
add.action do |_global_options, _options, args|
|
203
204
|
Diggit::Dig.it.config.add_analysis args[0]
|
204
205
|
end
|
205
206
|
end
|
206
207
|
c.desc 'Delete an analysis.'
|
207
|
-
c.arg_name 'name'
|
208
|
+
c.arg_name '<name>'
|
208
209
|
c.command :del do |del|
|
209
210
|
del.action do |_global_options, _options, args|
|
210
211
|
Diggit::Dig.it.config.del_analysis args[0]
|
@@ -212,9 +213,9 @@ module Diggit
|
|
212
213
|
end
|
213
214
|
c.desc 'Perform analyses.'
|
214
215
|
c.command :perform do |perform|
|
215
|
-
perform.flag %i[s sources], desc: "list of sources", type: Array, default_value: []
|
216
|
+
perform.flag %i[s sources], desc: "list of sources id", type: Array, default_value: []
|
216
217
|
perform.flag %i[a analyses], desc: "list of analyses", type: Array, default_value: []
|
217
|
-
perform.flag %i[m mode], desc: "running mode",
|
218
|
+
perform.flag %i[m mode], desc: "running mode: run, clean or rerun",
|
218
219
|
must_match: { "run" => :run, "clean" => :clean, "rerun" => :rerun }, default_value: :run
|
219
220
|
perform.action do |_global_options, options, _args|
|
220
221
|
Diggit::Dig.it.analyze(options[:s], options[:a], options[:m])
|
data/lib/dgit/core.rb
CHANGED
@@ -28,7 +28,12 @@ class Dummy
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
Oj.default_options = Oj.default_options.merge(
|
31
|
+
Oj.default_options = Oj.default_options.merge(
|
32
|
+
mode: :object,
|
33
|
+
indent: 2,
|
34
|
+
auto_define: true,
|
35
|
+
circular: true
|
36
|
+
)
|
32
37
|
Oj.register_odd(Rugged::Repository, Dummy, :new, :to_s)
|
33
38
|
|
34
39
|
class String
|
@@ -148,11 +153,11 @@ module Diggit
|
|
148
153
|
class Config
|
149
154
|
attr_reader :analyses, :joins
|
150
155
|
|
151
|
-
def initialize(
|
156
|
+
def initialize(config_hash)
|
152
157
|
@analyses = []
|
153
158
|
@joins = []
|
154
|
-
|
155
|
-
|
159
|
+
config_hash[:analyses].each { |a| load_analysis(a) }
|
160
|
+
config_hash[:joins].each { |j| load_join(j) }
|
156
161
|
end
|
157
162
|
|
158
163
|
def to_hash
|
@@ -267,9 +272,6 @@ module Diggit
|
|
267
272
|
f_glob = PluginLoader.plugin_paths(name, type, File.expand_path('../..', __dir__))
|
268
273
|
f_home = PluginLoader.plugin_paths(name, type, File.join(Dir.home, Dig::DGIT_FOLDER))
|
269
274
|
f_local = PluginLoader.plugin_paths(name, type, Dig.it.folder)
|
270
|
-
Log.debug "Plugin files in global: #{f_glob}."
|
271
|
-
Log.debug "Plugin files in home: #{f_home}."
|
272
|
-
Log.debug "Plugin files in local directory: #{f_local}."
|
273
275
|
found = true
|
274
276
|
if !f_local.empty?
|
275
277
|
f_local.each { |f| require File.expand_path(f) }
|
@@ -391,7 +393,7 @@ module Diggit
|
|
391
393
|
# @return [void]
|
392
394
|
def save_journal
|
393
395
|
File.open(config_path(DGIT_SOURCES), "w") { |f| @journal.sources.each { |source| f.puts(source.url) } }
|
394
|
-
Oj.to_file(config_path(DGIT_JOURNAL), @journal
|
396
|
+
Oj.to_file(config_path(DGIT_JOURNAL), @journal)
|
395
397
|
end
|
396
398
|
|
397
399
|
# Load the options from `.dgit/options`
|
@@ -423,7 +425,10 @@ module Diggit
|
|
423
425
|
# @param source_ids [Array<Integer>] the ids of the sources.
|
424
426
|
# @return [void]
|
425
427
|
def clone(*source_ids)
|
426
|
-
@journal.sources_by_ids(*source_ids).select { |s| s.entry.new? }.each
|
428
|
+
@journal.sources_by_ids(*source_ids).select { |s| s.entry.new? }.each do |s|
|
429
|
+
Log.fine("cloning #{s.url} (#{s.oid})")
|
430
|
+
s.clone
|
431
|
+
end
|
427
432
|
ensure
|
428
433
|
save_journal
|
429
434
|
end
|
@@ -436,6 +441,7 @@ module Diggit
|
|
436
441
|
def analyze(source_ids = [], analyses = [], mode = :run)
|
437
442
|
@journal.sources_by_ids(*source_ids).select { |s| s.entry.cloned? }.each do |s|
|
438
443
|
@config.get_analyses(*analyses).each do |klass|
|
444
|
+
Log.fine("Performing analysis #{klass} (#{mode}) on #{s.url}")
|
439
445
|
a = klass.new(@options)
|
440
446
|
s.load_repository
|
441
447
|
a.source = s
|
@@ -452,6 +458,7 @@ module Diggit
|
|
452
458
|
# @return [void]
|
453
459
|
def join(source_ids = [], joins = [], mode = :run)
|
454
460
|
@config.get_joins(*joins).each do |klass|
|
461
|
+
Log.fine("Performing join #{klass}")
|
455
462
|
j = klass.new(@options)
|
456
463
|
clean(j, @journal.workspace) if clean_mode?(mode) && @journal.workspace.has?(j)
|
457
464
|
source_array = @journal.sources_by_ids(*source_ids).select do |s|
|
data/lib/dgit/log.rb
CHANGED
@@ -24,22 +24,26 @@ class Formatador
|
|
24
24
|
attr_accessor :level
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.
|
28
|
-
Formatador.display_line(str) if visible(__method__)
|
27
|
+
def self.fine(str)
|
28
|
+
Formatador.display_line("[blue]#{str}[/]") if visible(__method__)
|
29
29
|
end
|
30
30
|
|
31
|
-
def self.
|
32
|
-
Formatador.display_line(str) if visible(__method__)
|
31
|
+
def self.info(str)
|
32
|
+
Formatador.display_line("[purple]#{str}[/]") if visible(__method__)
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.ok(str)
|
36
36
|
Formatador.display_line("[green]#{str}[/]") if visible(__method__)
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.
|
39
|
+
def self.debug(str)
|
40
40
|
Formatador.display_line("[yellow]#{str}[/]") if visible(__method__)
|
41
41
|
end
|
42
42
|
|
43
|
+
def self.warn(str)
|
44
|
+
Formatador.display_line("[orange]#{str}[/]") if visible(__method__)
|
45
|
+
end
|
46
|
+
|
43
47
|
def self.error(str)
|
44
48
|
Formatador.display_line("[red]#{str}[/]") if visible(__method__)
|
45
49
|
end
|
@@ -48,7 +52,7 @@ class Formatador
|
|
48
52
|
target = method.to_sym
|
49
53
|
if %i[ok error info].include?(target)
|
50
54
|
true
|
51
|
-
elsif
|
55
|
+
elsif %i[warn debug fine].include?(target) && level == :fine
|
52
56
|
true
|
53
57
|
else
|
54
58
|
false
|
data/lib/dgit/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diggit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Rémy Falleri
|
8
|
+
- Floréal Morandat
|
8
9
|
- Matthieu Foucault
|
10
|
+
- Mohamed Oumaziz
|
9
11
|
autorequire:
|
10
12
|
bindir: bin
|
11
13
|
cert_chain: []
|
12
|
-
date: 2018-01-
|
14
|
+
date: 2018-01-23 00:00:00.000000000 Z
|
13
15
|
dependencies:
|
14
16
|
- !ruby/object:Gem::Dependency
|
15
17
|
name: formatador
|
@@ -142,6 +144,9 @@ dependencies:
|
|
142
144
|
requirement: !ruby/object:Gem::Requirement
|
143
145
|
requirements:
|
144
146
|
- - "~>"
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
- - ">="
|
145
150
|
- !ruby/object:Gem::Version
|
146
151
|
version: 0.49.0
|
147
152
|
type: :development
|
@@ -149,6 +154,9 @@ dependencies:
|
|
149
154
|
version_requirements: !ruby/object:Gem::Requirement
|
150
155
|
requirements:
|
151
156
|
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- - ">="
|
152
160
|
- !ruby/object:Gem::Version
|
153
161
|
version: 0.49.0
|
154
162
|
- !ruby/object:Gem::Dependency
|
@@ -156,6 +164,9 @@ dependencies:
|
|
156
164
|
requirement: !ruby/object:Gem::Requirement
|
157
165
|
requirements:
|
158
166
|
- - "~>"
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
- - ">="
|
159
170
|
- !ruby/object:Gem::Version
|
160
171
|
version: 0.9.11
|
161
172
|
type: :development
|
@@ -163,10 +174,12 @@ dependencies:
|
|
163
174
|
version_requirements: !ruby/object:Gem::Requirement
|
164
175
|
requirements:
|
165
176
|
- - "~>"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
- - ">="
|
166
180
|
- !ruby/object:Gem::Version
|
167
181
|
version: 0.9.11
|
168
|
-
description:
|
169
|
-
analysis of many Git repositories."
|
182
|
+
description: Diggit is an agile tool that allows you to analyze git repositories.
|
170
183
|
email: jr.falleri@gmail.com
|
171
184
|
executables:
|
172
185
|
- dgit
|
@@ -228,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
241
|
version: '0'
|
229
242
|
requirements: []
|
230
243
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.7.4
|
232
245
|
signing_key:
|
233
246
|
specification_version: 4
|
234
247
|
summary: A Git repository analysis tool.
|