gtool 0.0.6 → 0.0.7

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.
@@ -15,7 +15,8 @@ Installation
15
15
 
16
16
  **as a gem**
17
17
 
18
- Wait for someone to turn this into a gem.
18
+ gem install gtool
19
+ % gtool # magic!
19
20
 
20
21
  **from source**
21
22
 
@@ -25,7 +26,7 @@ Wait for someone to turn this into a gem.
25
26
  export RUBYLIB="${RUBYLIB}:`pwd`/ruby-gprov/lib:`pwd`/gtool/lib"
26
27
  export PATH="${PATH}:`pwd`/gtool/bin"
27
28
 
28
- % gtool # magic!
29
+ % gtool # more magic!
29
30
 
30
31
  Usage
31
32
  -----
@@ -0,0 +1,67 @@
1
+ require 'thor'
2
+ require 'gtool'
3
+ require 'gtool/util/ask_default'
4
+ require 'gprov'
5
+ require 'digest/sha1'
6
+
7
+ module Gtool
8
+ module Provision
9
+ class Nickname < Thor
10
+ include Gtool::Util
11
+ Gtool::Provision::User.register self, "nickname", "nickname [COMMAND]", "GProv user nickname manipulation"
12
+ namespace :'user:nickname'
13
+
14
+ class_option "debug", :type => :boolean, :desc => "Enable debug output", :aliases => "-d"
15
+ class_option "noop", :type => :boolean, :desc => "Enable noop mode", :aliases => "-n"
16
+
17
+ desc "list", "Get all nicknames for a domain"
18
+ def list
19
+ connection = Gtool::Auth.connection(options)
20
+ nicknames = GProv::Provision::Nickname.all(connection, options)
21
+ fields = GProv::Provision::Nickname.attribute_names
22
+ field_names = GProv::Provision::Nickname.attribute_titles
23
+
24
+ rows = nicknames.map do |nickname|
25
+ fields.map {|f| nickname.send f}
26
+ end
27
+
28
+ rows.unshift field_names
29
+ print_table rows
30
+ say "#{rows.length - 1} entries.", :cyan
31
+ end
32
+
33
+ desc "get", "Get nicknames for a user"
34
+ def get(username)
35
+ connection = Gtool::Auth.connection(options)
36
+ nicknames = GProv::Provision::Nickname.all(connection, options.merge(:username => username))
37
+ fields = GProv::Provision::Nickname.attribute_names
38
+ field_names = GProv::Provision::Nickname.attribute_titles
39
+
40
+ rows = nicknames.map do |nickname|
41
+ fields.map {|f| nickname.send f}
42
+ end
43
+
44
+ rows.unshift field_names
45
+ print_table rows
46
+ say "#{rows.length - 1} entries.", :cyan
47
+ end
48
+
49
+ desc "create USER NICKNAME", "Create a new nickname for a user"
50
+ def create(username, nickname)
51
+ connection = Gtool::Auth.connection(options)
52
+
53
+ nick = GProv::Provision::Nickname.new(:connection => connection)
54
+ nick.login = username
55
+ nick.nickname = nickname
56
+
57
+ nick.create!
58
+
59
+ invoke "user:nickname:get", [nickname]
60
+ end
61
+
62
+ def self.banner(task, namespace = true, subcommand = false)
63
+ "#{basename} #{task.formatted_usage(self, true, subcommand)}"
64
+ end
65
+ end
66
+ end
67
+ end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Gtool
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
metadata CHANGED
@@ -1,64 +1,61 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gtool
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 6
10
- version: 0.0.6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Adrien Thebo
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-02-11 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: gprov
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.0.0
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: thor
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
46
38
  type: :runtime
47
- version_requirements: *id002
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
48
46
  description: All the fun of Google Provisioning, none of the HTML
49
47
  email: adrien@puppetlabs.com
50
- executables:
48
+ executables:
51
49
  - gtool
52
50
  extensions: []
53
-
54
51
  extra_rdoc_files: []
55
-
56
- files:
52
+ files:
57
53
  - bin/gtool
58
54
  - lib/gtool/auth.rb
59
55
  - lib/gtool/cli.rb
60
56
  - lib/gtool/provision/customerid.rb
61
57
  - lib/gtool/provision/group.rb
58
+ - lib/gtool/provision/nickname.rb
62
59
  - lib/gtool/provision/orgmember.rb
63
60
  - lib/gtool/provision/orgunit.rb
64
61
  - lib/gtool/provision/user.rb
@@ -70,36 +67,26 @@ files:
70
67
  - README.markdown
71
68
  homepage: http://github.com/adrienthebo/gtool
72
69
  licenses: []
73
-
74
70
  post_install_message:
75
71
  rdoc_options: []
76
-
77
- require_paths:
72
+ require_paths:
78
73
  - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
74
+ required_ruby_version: !ruby/object:Gem::Requirement
80
75
  none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
88
- required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
81
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
97
86
  requirements: []
98
-
99
87
  rubyforge_project:
100
- rubygems_version: 1.8.10
88
+ rubygems_version: 1.8.24
101
89
  signing_key:
102
90
  specification_version: 3
103
91
  summary: Command line interface to the Google Provisioning API
104
92
  test_files: []
105
-