linodians 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aaff050739c2ee67606d1cc9add7a273d730a8f1
4
- data.tar.gz: 9f9273475a96a2cba589256e6167766b227d5839
3
+ metadata.gz: c67f30c1c4f6422cb01b7047f87e7c7ee645cd1c
4
+ data.tar.gz: 996a21281823ad86fc5a3b252b2b1f3e4beb019d
5
5
  SHA512:
6
- metadata.gz: 48b2ef85ffff5001a23007da2720064ec10d7ea3d0fa312f2b3c25753dd25140746cb367a357e89cbd778f82f985982bfe1fafb56c8b889a30334e0bc8709f47
7
- data.tar.gz: fe225e3b5131e0018dea127579d2d3eb14105a8827ffba3f3fc4be29be9ffeca0f68cb7524b61e46c97975408a4a27f620b2215963fa0adbf5ff4195300574da
6
+ metadata.gz: 91153294f21bf147d8cd922af92b4c81fef6d65304e6a4b6dd2c914b432caf9fb3a94f55eb07bbb04ad6132c739472432688973fd4d060c17d0d64d68340865e
7
+ data.tar.gz: 4f786446c12f4a03e180152ee020a97a2b4d78aecb75fbb958dc2c2d8e9f3f3140f0b29e1581a71866be9a83814abc74c2fd4087f04752d0f79fda42d0964a0b
data/bin/linodians ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'linodians'
4
+ require 'json'
5
+ require 'optparse'
6
+
7
+ options = {
8
+ format: :plain
9
+ }
10
+ opt = OptionParser.new do |opts|
11
+ opts.banner = 'Usage: linodians [-v] [-j]'
12
+ opts.on('-j', '--json', 'Output as json') do
13
+ options[:format] = :json
14
+ end
15
+ opts.on_tail('-v', '--version', 'Show version') do
16
+ puts Linodians::VERSION
17
+ exit
18
+ end
19
+ end.parse!
20
+
21
+ results = Linodians.new
22
+
23
+ case options[:format]
24
+ when :json
25
+ puts results.to_json
26
+ when :plain
27
+ results.each do |user|
28
+ puts "#{user.fullname} (#{user.username}): #{user.title}"
29
+ user.social.each { |site| puts " #{site}: #{user[site]}" }
30
+ end
31
+ else
32
+ puts 'How did you get in here?'
33
+ exit 1
34
+ end
data/lib/linodians.rb CHANGED
@@ -32,13 +32,15 @@ module Linodians
32
32
  end
33
33
 
34
34
  def parse_social(block)
35
- block.css('a.employee-link').map do |link|
35
+ links = block.css('a.employee-link').map do |link|
36
36
  # Social site name from CSS class, link target
37
37
  [link[:class].split.last.split('-').last.to_sym, link['href']]
38
38
  end.to_h
39
+ links.merge(social: links.keys)
39
40
  end
40
41
  end
41
42
  end
42
43
 
44
+ require 'linodians/version'
43
45
  require 'linodians/employee'
44
46
  require 'linodians/group'
@@ -0,0 +1,5 @@
1
+ ##
2
+ # Define the version
3
+ module Linodians
4
+ VERSION = '0.0.3'
5
+ end
data/linodians.gemspec CHANGED
@@ -1,6 +1,9 @@
1
+ $:.unshift File.expand_path('../lib/', __FILE__)
2
+ require 'linodians/version'
3
+
1
4
  Gem::Specification.new do |s|
2
5
  s.name = 'linodians'
3
- s.version = '0.0.2'
6
+ s.version = Linodians::VERSION
4
7
  s.date = Time.now.strftime("%Y-%m-%d")
5
8
 
6
9
  s.summary = 'Parse Linode employees'
@@ -12,6 +15,7 @@ Gem::Specification.new do |s|
12
15
 
13
16
  s.files = `git ls-files`.split
14
17
  s.test_files = `git ls-files spec/*`.split
18
+ s.executables = ['linodians']
15
19
 
16
20
  s.add_dependency 'nokogiri', '~> 1.6.5'
17
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linodians
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
@@ -96,7 +96,8 @@ dependencies:
96
96
  version: 2.0.0
97
97
  description: Library for viewing public Linode employee data
98
98
  email: me@lesaker.org
99
- executables: []
99
+ executables:
100
+ - linodians
100
101
  extensions: []
101
102
  extra_rdoc_files: []
102
103
  files:
@@ -108,9 +109,11 @@ files:
108
109
  - LICENSE
109
110
  - README.md
110
111
  - Rakefile
112
+ - bin/linodians
111
113
  - lib/linodians.rb
112
114
  - lib/linodians/employee.rb
113
115
  - lib/linodians/group.rb
116
+ - lib/linodians/version.rb
114
117
  - linodians.gemspec
115
118
  - spec/linodians_spec.rb
116
119
  - spec/spec_helper.rb