stewfinder 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.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rubocop.yml +33 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +1 -0
- data/exe/stewfinder +6 -0
- data/lib/stewfinder/version.rb +3 -0
- data/lib/stewfinder.rb +62 -0
- data/stewfinder.gemspec +24 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b7568eef5a5a01727b1d544b6d62ccc2ac54228c
|
4
|
+
data.tar.gz: cdd6bb1ae7576d98a7d219e4c2ac2c3037685342
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6f21aed6cd835cf1c35dd754188a44fbdefd87c7bb2e92807c693dbd132a0491c947c971c1c70a13b0999c09aadac9f21004b6eafb28848a09000a3abfe03521
|
7
|
+
data.tar.gz: ad3360ad32eed9cec6301d8da37bffeeca2c1622b80d6b79a5822b076b7b70fba03d49b32466ecab86b67d186b147956568f12a8b85aa7ef83db93ff19c6a4a6
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Metrics/AbcSize:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Metrics/ClassLength:
|
5
|
+
Max: 1024
|
6
|
+
|
7
|
+
Metrics/CyclomaticComplexity:
|
8
|
+
Max: 8
|
9
|
+
|
10
|
+
Metrics/LineLength:
|
11
|
+
Max: 512
|
12
|
+
|
13
|
+
Metrics/MethodLength:
|
14
|
+
Max: 128
|
15
|
+
|
16
|
+
Metrics/PerceivedComplexity:
|
17
|
+
Max: 8
|
18
|
+
|
19
|
+
|
20
|
+
Style/AccessorMethodName:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Style/Documentation:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/NumericLiterals:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/RaiseArgs:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/SignalException:
|
33
|
+
EnforcedStyle: only_raise
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Appfolio
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Stewfinder
|
2
|
+
|
3
|
+
This gem provides command line utilities for working locally with [Ladle](https://github.com/appfolio/ladle) style stewards files.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install via the command line:
|
8
|
+
|
9
|
+
$ gem install stewfinder
|
10
|
+
|
11
|
+
Or add it to the Gemfile of your application, if you'd like to make it available to all developers:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'stewfinder'
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Run it from your terminal:
|
20
|
+
|
21
|
+
stewfinder /path/to/file.rb
|
22
|
+
|
23
|
+
Output looks like this:
|
24
|
+
|
25
|
+
Stewards for this file:
|
26
|
+
- XanderStrike
|
27
|
+
- bboe
|
28
|
+
|
29
|
+
For extra points, add it as a build configuration in your favorite text editor! In Sublime do ⌘+⇧+P "New Build System" and paste in the following:
|
30
|
+
|
31
|
+
```json
|
32
|
+
{
|
33
|
+
"shell_cmd": "stewfinder $file"
|
34
|
+
}
|
35
|
+
```
|
36
|
+
|
37
|
+
You can now find it with ⌘+⇧+P "stewards" or bind it to a hotkey!
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
1. Fork it ( https://github.com/appfolio/stewfinder/fork )
|
42
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/exe/stewfinder
ADDED
data/lib/stewfinder.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'stewfinder/version'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
class Stewfinder
|
5
|
+
def initialize(filename)
|
6
|
+
@name = filename
|
7
|
+
end
|
8
|
+
|
9
|
+
def find
|
10
|
+
stewards = get_stewards
|
11
|
+
|
12
|
+
puts 'Stewards for this file:'
|
13
|
+
if stewards.empty?
|
14
|
+
puts 'None'
|
15
|
+
else
|
16
|
+
puts ' - ' + stewards.uniq.sort.join("\n - ")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def get_stewfiles
|
23
|
+
stewfiles = []
|
24
|
+
cur_path = Pathname(@name)
|
25
|
+
while cur_path
|
26
|
+
stewfiles << File.join(cur_path, 'stewards.yml') if File.exist?(File.join(cur_path, 'stewards.yml'))
|
27
|
+
prev_path = cur_path
|
28
|
+
cur_path = cur_path.split.first
|
29
|
+
break if cur_path == prev_path
|
30
|
+
end
|
31
|
+
stewfiles
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_stewards
|
35
|
+
stewards = []
|
36
|
+
stewfiles = get_stewfiles
|
37
|
+
stewfiles.each do |file|
|
38
|
+
steward_hash = YAML.load_file(file)
|
39
|
+
next unless steward_hash
|
40
|
+
|
41
|
+
steward_hash['stewards'].each do |s|
|
42
|
+
case s
|
43
|
+
when String
|
44
|
+
stewards << s
|
45
|
+
when Hash
|
46
|
+
begin
|
47
|
+
if [s['include']].flatten.any? { |i| File.fnmatch?(i.to_s, @name) } &&
|
48
|
+
[s['exclude']].flatten.none? { |i| File.fnmatch?(i.to_s, @name) }
|
49
|
+
stewards << s['github_username']
|
50
|
+
end
|
51
|
+
rescue
|
52
|
+
puts "Invalid Format: #{s.inspect} in file #{file}"
|
53
|
+
end
|
54
|
+
else
|
55
|
+
puts "Invalid Format: #{s.inspect} in file #{file}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
stewards
|
61
|
+
end
|
62
|
+
end
|
data/stewfinder.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'stewfinder/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'stewfinder'
|
8
|
+
spec.version = Stewfinder::VERSION
|
9
|
+
spec.authors = ['Alexander Standke']
|
10
|
+
spec.email = ['alexander.standke@appfolio.com']
|
11
|
+
spec.summary = "Get it while it's hot!"
|
12
|
+
spec.description = 'Finds stewards for a given file.'
|
13
|
+
spec.homepage = 'https://github.com/appfolio/stewfinder'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = ['stewfinder']
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stewfinder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Standke
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-22 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
|
+
description: Finds stewards for a given file.
|
42
|
+
email:
|
43
|
+
- alexander.standke@appfolio.com
|
44
|
+
executables:
|
45
|
+
- stewfinder
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rubocop.yml"
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- exe/stewfinder
|
56
|
+
- lib/stewfinder.rb
|
57
|
+
- lib/stewfinder/version.rb
|
58
|
+
- stewfinder.gemspec
|
59
|
+
homepage: https://github.com/appfolio/stewfinder
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.4.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Get it while it's hot!
|
83
|
+
test_files: []
|
84
|
+
has_rdoc:
|