pk 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +25 -5
  2. data/bin/pk +28 -5
  3. data/lib/pk/version.rb +1 -1
  4. metadata +2 -2
data/README.md CHANGED
@@ -1,11 +1,31 @@
1
- ### pk - command line tool to print public keys
1
+ # pk
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/pk.png)](http://badge.fury.io/rb/pk)
4
+
5
+ Command line tool to print public keys.
6
+
7
+ ## Usage
2
8
 
3
9
  ```
4
- pk keys fm hm,su,sy
10
+ # install
11
+ gem install pk
12
+
13
+ # add team repo
14
+ pk team add team1 https://gist.github.com/4509339
5
15
 
6
- pk team add fm https://gist.github.com/abc
16
+ # update repo
7
17
  pk team reload
8
- pk team reload fm
18
+ pk team reload team1
19
+
20
+ # list teams, or list team members
9
21
  pk team list
10
- pk team list fm
22
+ pk team list team1
23
+
24
+ # print public keys
25
+ pk keys team1 member1,member2
26
+ pk keys team1
11
27
  ```
28
+
29
+ ## Rough cut version
30
+
31
+ It's still an early prototype, usable but fragile.
data/bin/pk CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  require 'thor'
4
4
 
5
+ class PkIgnoreFile
6
+ PKIGNORE_NAMES = %w(pkignore .pkignore).freeze
7
+
8
+ def initialize(path)
9
+ @ignore_list = PKIGNORE_NAMES.dup
10
+ PKIGNORE_NAMES.each do |filename|
11
+ file = File.expand_path(File.join(path, filename))
12
+ if File.exist? file
13
+ @ignore_list = @ignore_list + File.open(file, 'r').read.split("\n")
14
+ break
15
+ end
16
+ end
17
+ end
18
+
19
+ def ignore_file?(filename)
20
+ ignore = false
21
+ @ignore_list.each do |ignore_pattern|
22
+ if File.fnmatch(ignore_pattern, filename, File::FNM_PATHNAME)
23
+ ignore = true
24
+ break
25
+ end
26
+ end
27
+ ignore
28
+ end
29
+ end
30
+
5
31
  module Helper
6
32
 
7
33
  def init
@@ -9,16 +35,13 @@ module Helper
9
35
  end
10
36
 
11
37
  def all_members_of(team)
38
+ pkignore = PkIgnoreFile.new("~/.pk/data/#{team}")
12
39
  [].tap do |list|
13
40
  `ls ~/.pk/data/#{team}`.split.each do |filename|
14
- list << filename unless ignore_file?(filename)
41
+ list << filename unless pkignore.ignore_file?(filename)
15
42
  end
16
43
  end
17
44
  end
18
-
19
- def ignore_file?(filename)
20
- filename.include?('.') ? true : false
21
- end
22
45
  end
23
46
 
24
47
  class Team < Thor
data/lib/pk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pk
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-11 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Command line tool to collect and print public keys.
15
15
  email: