diggit-developers_activity 0.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.
@@ -0,0 +1,7 @@
1
+ https://github.com/angular/angular.js.git
2
+ https://github.com/matthieu-foucault/jquery.git
3
+ https://github.com/rails/rails.git
4
+ https://github.com/jenkinsci/jenkins.git
5
+ https://github.com/ansible/ansible.git
6
+ https://github.com/mono/mono.git
7
+ https://github.com/sebastianbergmann/phpunit.git
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+
3
+ require 'diggit/developers_activity/activity_extractor/modules'
4
+ require 'diggit/developers_activity'
5
+
6
+ # The set of functions extracting modules metrics, ie, LoC and the number of bugfixes
7
+ #
8
+ #
9
+ module Diggit
10
+ module DevelopersActivity
11
+ module ModuleMetricsExtractor
12
+ extend self
13
+
14
+ def extract_module_metrics(source, source_options, db, repo)
15
+ modules_bugfixes = extract_bugfixes(source_options['bug-fix-commits'], repo)
16
+ modules_loc = extract_loc(source, db)
17
+
18
+ modules_metrics = []
19
+ modules_loc.each do |maudule, loc|
20
+ modules_metrics << { project: source, 'module' => maudule, 'LoC' => loc,
21
+ 'BugFixes' => modules_bugfixes[maudule].size }
22
+ end
23
+ modules_metrics
24
+ end
25
+
26
+ def extract_bugfixes(bug_fix_commits, repo)
27
+ modules_bugfixes = Hash.new { |hash, key| hash[key] = Set.new }
28
+ bug_fix_commits.each do |commit_oid|
29
+ commit = repo.lookup(commit_oid)
30
+ next if commit.parents.size != 1 # ignore merges
31
+ diff = commit.parents[0].diff(commit, DIFF_OPTIONS)
32
+ diff.find_similar!(DIFF_RENAME_OPTIONS)
33
+ diff.each do |patch|
34
+ maudule = ActivityExtractor::Modules.get_patch_module(patch)
35
+ modules_bugfixes[maudule] = (modules_bugfixes[maudule] << commit_oid) unless maudule.nil?
36
+ end
37
+ end
38
+ modules_bugfixes
39
+ end
40
+
41
+ def extract_loc(source, db)
42
+ modules_loc = Hash.new(0)
43
+ cloc_source = db.db['cloc-file'].find_one({ source: source })
44
+ cloc_source['cloc'].each do |cloc_file|
45
+ maudule = ActivityExtractor::Modules.get_module(cloc_file['path'])
46
+ modules_loc[maudule] = modules_loc[maudule] + cloc_file['code'] unless maudule.nil?
47
+ end
48
+ modules_loc
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,5 @@
1
+ module Diggit
2
+ module DevelopersActivity
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+
3
+ require 'fileutils'
4
+
5
+ module Diggit
6
+ module DevelopersActivity
7
+ # Initializes a workspace with the developers activity dataset
8
+ #
9
+ #
10
+ module WorkspaceInit
11
+ extend self
12
+
13
+ DIGGIT_RC = '.dgitrc'
14
+ DIGGIT_SOURCES_OPTIONS = '.dgitsources-options'
15
+ SOURCES_LIST = 'sources.list'
16
+
17
+ INCLUDES_FOLDER = 'includes'
18
+ DIGGIT_FOLDER = ".diggit"
19
+
20
+ def init
21
+ `dgit init`
22
+ dataset_dir = File.expand_path('dataset', File.dirname(__FILE__))
23
+
24
+ FileUtils.cp(File.expand_path(DIGGIT_RC, dataset_dir), '.')
25
+ FileUtils.cp(File.expand_path(DIGGIT_SOURCES_OPTIONS, dataset_dir), '.')
26
+ FileUtils.cp(File.expand_path(SOURCES_LIST, dataset_dir), '.')
27
+
28
+ analyses_dir = File.expand_path('analyses', File.dirname(__FILE__))
29
+ home = File.expand_path(INCLUDES_FOLDER, File.expand_path(DIGGIT_FOLDER, Dir.home))
30
+ FileUtils.ln_s(analyses_dir, File.expand_path('developers_activity', home))
31
+ end
32
+ end
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: diggit-developers_activity
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Matthieu Foucault
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: diggit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ description: |-
56
+ This gem contains a set of analyses extracting developers activity from git repositories,
57
+ using different granularities of time periods. It also includes a dataset of git repositories for which we extacted
58
+ the identity of bug-fixing commits for a given release, as well as author identity merge information.
59
+ email:
60
+ - foucault.matthieu@gmail.com
61
+ executables:
62
+ - diggit-init-dev-activity-workspace
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - ".gitignore"
67
+ - Gemfile
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/diggit-init-dev-activity-workspace
72
+ - diggit-developers_activity.gemspec
73
+ - lib/diggit/developers_activity.rb
74
+ - lib/diggit/developers_activity/activity_extractor.rb
75
+ - lib/diggit/developers_activity/activity_extractor/authors.rb
76
+ - lib/diggit/developers_activity/activity_extractor/modules.rb
77
+ - lib/diggit/developers_activity/activity_extractor/renames.rb
78
+ - lib/diggit/developers_activity/analyses.rb
79
+ - lib/diggit/developers_activity/analyses/activity_analysis.rb
80
+ - lib/diggit/developers_activity/analyses/module_metrics_analysis.rb
81
+ - lib/diggit/developers_activity/analyses/months_activity_analysis.rb
82
+ - lib/diggit/developers_activity/analyses/project_developers_analysis.rb
83
+ - lib/diggit/developers_activity/analyses/releases_activity_analysis.rb
84
+ - lib/diggit/developers_activity/dataset/.dgitrc
85
+ - lib/diggit/developers_activity/dataset/.dgitsources-options
86
+ - lib/diggit/developers_activity/dataset/sources.list
87
+ - lib/diggit/developers_activity/module_metrics_extractor.rb
88
+ - lib/diggit/developers_activity/version.rb
89
+ - lib/diggit/developers_activity/workspace_init.rb
90
+ homepage: ''
91
+ licenses:
92
+ - LGPL
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.4.5
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Analyses and dataset for the diggit tool.
114
+ test_files: []
115
+ has_rdoc: