authkeys 0.0.1 → 0.0.2
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.
- data/authkeys.gemspec +1 -0
- data/lib/authkeys.rb +5 -1
- data/lib/authkeys/key.rb +7 -0
- data/lib/authkeys/key_collection.rb +33 -0
- data/lib/authkeys/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +22 -5
data/authkeys.gemspec
CHANGED
data/lib/authkeys.rb
CHANGED
data/lib/authkeys/key.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Authkeys
|
2
|
+
class KeyCollection
|
3
|
+
def initialize(file)
|
4
|
+
@file = file
|
5
|
+
end
|
6
|
+
|
7
|
+
def each(&block)
|
8
|
+
keys.each do |key|
|
9
|
+
yield(key)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def keys
|
16
|
+
key_lines.collect do |line|
|
17
|
+
Key.new(line)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def key_lines
|
22
|
+
raw_lines.reject {|item| item.strip.empty? || item.strip.start_with?("#") }
|
23
|
+
end
|
24
|
+
|
25
|
+
def raw_lines
|
26
|
+
file_data.split("\n")
|
27
|
+
end
|
28
|
+
|
29
|
+
def file_data
|
30
|
+
@file_data ||= File.read(@file)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/authkeys/version.rb
CHANGED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'authkeys'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authkeys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joshua B. Bussdieker
|
@@ -46,6 +46,20 @@ dependencies:
|
|
46
46
|
version: "0"
|
47
47
|
type: :development
|
48
48
|
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
49
63
|
description:
|
50
64
|
email:
|
51
65
|
- jbussdieker@gmail.com
|
@@ -63,7 +77,10 @@ files:
|
|
63
77
|
- Rakefile
|
64
78
|
- authkeys.gemspec
|
65
79
|
- lib/authkeys.rb
|
80
|
+
- lib/authkeys/key.rb
|
81
|
+
- lib/authkeys/key_collection.rb
|
66
82
|
- lib/authkeys/version.rb
|
83
|
+
- spec/spec_helper.rb
|
67
84
|
homepage: ""
|
68
85
|
licenses:
|
69
86
|
- MIT
|
@@ -97,5 +114,5 @@ rubygems_version: 1.8.15
|
|
97
114
|
signing_key:
|
98
115
|
specification_version: 3
|
99
116
|
summary: Manage authorized keys files
|
100
|
-
test_files:
|
101
|
-
|
117
|
+
test_files:
|
118
|
+
- spec/spec_helper.rb
|