coconductor 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/bin/coconductor +12 -1
- data/coconductor.gemspec +2 -1
- data/lib/coconductor.rb +5 -1
- data/lib/coconductor/commands/diff.rb +2 -0
- data/lib/coconductor/matchers/dice.rb +6 -0
- data/lib/coconductor/project_files/code_of_conduct_file.rb +1 -1
- data/lib/coconductor/projects/github_project.rb +9 -0
- data/lib/coconductor/projects/project.rb +6 -2
- data/lib/coconductor/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bffa46bb8fa4dc61efcf0dbb3c1fbe52a15bd4d3beb7fd308022991dca191b1
|
4
|
+
data.tar.gz: 80cb1d7157a189e0ace506bd69da8d4bf1491b61b77549b3a3fab93024ff8858
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae28338a6e309678acdb61215a1061735b854d5f74b69f2937708c139523f3cd7d5c2cc47b87c2e499e97b9f12400cfeb512c4316dbcb01a71bff277659baa24
|
7
|
+
data.tar.gz: 7083ef079b5c2ef32c65f1f2993431b5b87962b1115b1ebdf12772b0cc421094dd7652b69d955c41834bdab212d457f77713cbc02771e5d20b292fbc5f81b967
|
data/README.md
CHANGED
@@ -45,10 +45,14 @@ project.code_of_conduct_file.confidence
|
|
45
45
|
### Command line
|
46
46
|
|
47
47
|
```
|
48
|
-
|
49
|
-
coconductor
|
50
|
-
coconductor
|
51
|
-
coconductor
|
48
|
+
Coconductor commands:
|
49
|
+
coconductor detect [PATH] # Detect the code of conduct of the given project
|
50
|
+
coconductor diff [PATH] # Compare the given code of conduct text to a known code of conduct
|
51
|
+
coconductor help [COMMAND] # Describe available commands or one specific command
|
52
|
+
coconductor version # Return the Coconductor version
|
53
|
+
|
54
|
+
Options:
|
55
|
+
[--remote], [--no-remote] # Assume PATH is a GitHub owner/repo path
|
52
56
|
```
|
53
57
|
|
54
58
|
#### Example output
|
data/bin/coconductor
CHANGED
@@ -2,15 +2,22 @@
|
|
2
2
|
|
3
3
|
require_relative '../lib/coconductor'
|
4
4
|
require 'thor'
|
5
|
+
require 'octokit'
|
5
6
|
|
6
7
|
class CoconductorCLI < Thor
|
7
8
|
package_name 'Coconductor'
|
8
9
|
default_task :detect
|
10
|
+
class_option :remote, type: :boolean,
|
11
|
+
desc: 'Assume PATH is a GitHub owner/repo path'
|
9
12
|
|
10
13
|
private
|
11
14
|
|
12
15
|
def path
|
13
|
-
|
16
|
+
@path ||= if remote?
|
17
|
+
"https://github.com/#{args.first}"
|
18
|
+
else
|
19
|
+
args.first || Dir.pwd
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
16
23
|
def project
|
@@ -24,6 +31,10 @@ class CoconductorCLI < Thor
|
|
24
31
|
def code_of_conduct_file
|
25
32
|
project.code_of_conduct_file
|
26
33
|
end
|
34
|
+
|
35
|
+
def remote?
|
36
|
+
options[:remote] || path =~ %r{^https://}
|
37
|
+
end
|
27
38
|
end
|
28
39
|
|
29
40
|
commands_dir = File.expand_path '../lib/coconductor/commands/', __dir__
|
data/coconductor.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
|
-
spec.add_dependency 'licensee', '~> 9.9', '>= 9.9.
|
26
|
+
spec.add_dependency 'licensee', '~> 9.9', '>= 9.9.4'
|
27
27
|
spec.add_dependency 'thor', '~> 0.20'
|
28
28
|
spec.add_dependency 'toml', '~> 0.2'
|
29
29
|
|
@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency 'pry', '~> 0.10'
|
32
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
33
|
spec.add_development_dependency 'rubocop', '~> 0.50'
|
34
|
+
spec.add_development_dependency 'webmock', '~> 3.1'
|
34
35
|
end
|
data/lib/coconductor.rb
CHANGED
@@ -21,7 +21,11 @@ module Coconductor
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def project(path, **args)
|
24
|
-
|
24
|
+
if path =~ %r{\Ahttps://github.com}
|
25
|
+
Coconductor::Projects::GitHubProject.new(path, args)
|
26
|
+
else
|
27
|
+
Coconductor::Projects::GitProject.new(path, args)
|
28
|
+
end
|
25
29
|
rescue Coconductor::Projects::GitProject::InvalidRepository
|
26
30
|
Coconductor::Projects::FSProject.new(path, args)
|
27
31
|
end
|
@@ -3,6 +3,15 @@ autoload :Octokit, 'octokit'
|
|
3
3
|
module Coconductor
|
4
4
|
module Projects
|
5
5
|
class GitHubProject < Licensee::Projects::GitHubProject
|
6
|
+
include Coconductor::Projects::Project
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def files
|
11
|
+
@files ||= begin
|
12
|
+
Coconductor::Projects::Project::DIRS.map { |p| dir_files(p) }.flatten
|
13
|
+
end
|
14
|
+
end
|
6
15
|
end
|
7
16
|
end
|
8
17
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
module Coconductor
|
2
2
|
module Projects
|
3
3
|
module Project
|
4
|
-
DIRS = ['./docs/', './.github/'].freeze
|
4
|
+
DIRS = ['./', './docs/', './.github/'].freeze
|
5
5
|
|
6
6
|
def code_of_conduct
|
7
7
|
code_of_conduct_file.code_of_conduct if code_of_conduct_file
|
8
8
|
end
|
9
9
|
|
10
10
|
def code_of_conduct_file
|
11
|
+
return @code_of_conduct_file if defined? @code_of_conduct_file
|
11
12
|
return if files.nil? || files.empty?
|
13
|
+
|
12
14
|
file = find_files do |filename|
|
13
15
|
ProjectFiles::CodeOfConductFile.name_score(filename)
|
14
16
|
end.first
|
@@ -16,7 +18,9 @@ module Coconductor
|
|
16
18
|
return unless file
|
17
19
|
|
18
20
|
content = load_file(file)
|
19
|
-
|
21
|
+
@code_of_conduct_file = begin
|
22
|
+
ProjectFiles::CodeOfConductFile.new(content, file)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
private
|
data/lib/coconductor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coconductor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: licensee
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '9.9'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 9.9.
|
22
|
+
version: 9.9.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '9.9'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 9.9.
|
32
|
+
version: 9.9.4
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: thor
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +114,20 @@ dependencies:
|
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0.50'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: webmock
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '3.1'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '3.1'
|
117
131
|
description:
|
118
132
|
email:
|
119
133
|
- ben.balter@github.com
|