zillabyte-cli 0.1.36 → 0.1.37

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODc0ZWQxNjAxYzg2NmU2ZWU2MTIzNzg4ZTk5NGQyOTUyYjE0MzU5Yw==
4
+ OGUxZDA3NGNiZWIyOWUzNmE3ZmMxYTUzYmUwMzNjYzExZmQ5MjM2Ng==
5
5
  data.tar.gz: !binary |-
6
- NDVhYTU2M2FiZjk1ZGU1ZWQxZmI1OTE4NDViOTZlZDYwZjgwOGQ1Yw==
6
+ MWVjMThkNzRjZGRhZmM4NGY0YjIyYzg1ODcxZmJiYjVhMWIwZWYyZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2Y4NWI4YjAyODkyMmNhMTA3OTA5ZTY1ZGZmMzIzNzJmOWEwY2ZhNzRiYzQx
10
- Yzc5NmYyNzJmZTQ1YmFlOGE2MjI1MzdjMDVkMTM4NWY2NWZmMDBhY2Y1Yjkz
11
- YmUxMzBiMDYxZjA5NGRiN2U4ZmFiYmRjNzA1ZTIzMjQzN2EwNDM=
9
+ NDU0YjQzYTFmYmM4ZmViOGEzNzkwYzY2ZWQzNjJhOTY5ZmU0YTBkNjg0Y2Vl
10
+ YWI3Y2U4OTE5MWIwMmI2OWQ4ODRjMDZlYjAzMjcxMjMwNzEzMDU1NmVhZGFk
11
+ MjJkM2QwOGM1YmE5OTA4MGUxM2UxZDRkMGIwYjNkY2Y4MzkwN2Y=
12
12
  data.tar.gz: !binary |-
13
- ODgwNzFlMGZlNTVkNmFjZjAwZTAyZjhlMzgwNDc5ODJiMzJiMWNmMDQ4NTQy
14
- ZmNlMDMyNWVhZmY3NTM3M2NhZWQ0ODU2YWYzMGQxM2JmNmE3YmZjMDFlNzU4
15
- YjE0ZGI2ZGUwYjUyMDliZDc0YjNjMDY5MjNhNTk4NmNiZjU4MjY=
13
+ MWE4ZTg4NGI4Yjk3MDNhZTk3NDNkOWNiMjRmNmMzN2Q3NTQzZDUxM2JiYTA2
14
+ ZWI4ZGI5ZmJlMGVmMWIxYTdiMTI4Mzk2NzViNDFiYjY2ZmE4OTdjZGY1Y2Zi
15
+ N2Q5ZDFiODdlOTY2Y2RjODQyN2FmMThlOTdiOTA4MTVhMDM3ZTI=
@@ -1,34 +1,34 @@
1
- require "zillabyte/cli/base"
2
-
3
- # manage git for apps
1
+ #require "zillabyte/cli/base"
4
2
  #
5
- class Zillabyte::Command::Git < Zillabyte::Command::Base
6
-
7
- # git:remote [OPTIONS]
8
- #
9
- # Adds a git remote to an app repo.
10
- # If OPTIONS are specified they will be passed to git remote add.
11
- #
12
- # -r, --remote REMOTE # The git remote to create, default "Zillabyte"
13
- # -n, --name NAME # The name of the app, default current directory's name
14
- #
15
- # Examples:
16
- #
17
- # $ zillabyte git:remote -a example
18
- # Git remote zillabyte added
19
- #
20
- # $ zillabyte git:remote -a example
21
- # ! Git remote zillabyte already exists
22
- #
23
- def remote
24
-
25
- git_options = args.join(" ")
26
- remote = options[:remote] || 'zillabyte'
27
- name = options[:name] || get_flow_name()
28
- error "could not infer app name" if name.nil?
29
-
30
- add_git_remote(name, remote)
31
-
32
- end
33
-
34
- end
3
+ ## manage git for apps
4
+ ##
5
+ #class Zillabyte::Command::Git < Zillabyte::Command::Base
6
+ #
7
+ # # git:remote [OPTIONS]
8
+ # #
9
+ # # Adds a git remote to an app repo.
10
+ # # If OPTIONS are specified they will be passed to git remote add.
11
+ # #
12
+ # # -r, --remote REMOTE # The git remote to create, default "Zillabyte"
13
+ # # -n, --name NAME # The name of the app, default current directory's name
14
+ # #
15
+ # # Examples:
16
+ # #
17
+ # # $ zillabyte git:remote -a example
18
+ # # Git remote zillabyte added
19
+ # #
20
+ # # $ zillabyte git:remote -a example
21
+ # # ! Git remote zillabyte already exists
22
+ # #
23
+ # def remote
24
+ #
25
+ # git_options = args.join(" ")
26
+ # remote = options[:remote] || 'zillabyte'
27
+ # name = options[:name] || get_flow_name()
28
+ # error "could not infer app name" if name.nil?
29
+ #
30
+ # add_git_remote(name, remote)
31
+ #
32
+ # end
33
+ #
34
+ #end
@@ -1,175 +1,175 @@
1
- require "zillabyte/cli/base"
2
- require "zillabyte/cli/helpers/table_output_builder"
3
-
4
- # manage authentication keys
1
+ #require "zillabyte/cli/base"
2
+ #require "zillabyte/cli/helpers/table_output_builder"
5
3
  #
6
- class Zillabyte::Command::Keys < Zillabyte::Command::Base
7
-
8
- SHORT_KEY_SPLIT = 18
9
- SHORT_KEY_MAX = 64
10
-
11
- # keys:add NAME [KEY]
12
- #
13
- # Add a key for the current user.
14
- # If no KEY is specified, will try to find ~/.ssh/id_rsa.pub.
15
- #
16
- # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
17
- #
18
- def add()
19
- type = options[:output_type] || nil
20
- name = shift_argument()
21
- if name.nil?
22
- error("no name given", type)
23
- end
24
- keypath = shift_argument() || "~/.ssh/id_rsa.pub"
25
- begin
26
- key = File.binread(File.expand_path(keypath))
27
- rescue => e
28
- error(e.message, type)
29
- end
30
- message = api.keys.add(name, key)
31
- if type == "json"
32
- display("{}")
33
- else
34
- display(message)
35
- end
36
- end
37
-
38
- # keys:show NAME
39
- #
40
- # Show a key for the current user.
41
- #
42
- # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
43
- #
44
- def show()
45
- type = options[:output_type] || nil
46
- name = shift_argument()
47
- if name.nil?()
48
- error("no name given", type)
49
- end
50
-
51
- key = api.keys.show(name)
52
- if type == "json"
53
- display({"key" => key}.to_json())
54
- else
55
- display(key)
56
- end
57
- end
58
-
59
- # keys:remove [NAME]
60
- #
61
- # Remove a key from the current user.
62
- #
63
- # -l, --long # Display extended information for each key
64
- # -f, --force # Force -- remove key without prompting
65
- # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
66
- #
67
- def remove()
68
- type = options[:output_type] || nil
69
- long = options[:long]
70
- force = options[:force]
71
- name = shift_argument()
72
- key_data = if name.nil?()
73
- if force
74
- error("no name given", type)
75
- end
76
- keys = api.keys.list()
77
- display("=== Keys")
78
- display(format_keys(keys, long, nil))
79
- # NOTE: it may not be the most efficient thing to use a hash here, unless
80
- # we expect users to routinely try to remove invalid keys.
81
- keymap = Hash[*keys.flatten()]
82
- loop do
83
- display("Please enter the name of the key you wish to remove (case-sensitive):")
84
- name = ask().chomp()
85
- if name.empty?()
86
- error("Aborting.", type)
87
- end
88
- if keymap.has_key?(name)
89
- break(keymap[name])
90
- end
91
- display("Key not found: `#{name}`")
92
- end
93
- else
94
- key = api.keys.show(name)
95
- if force
96
- key
97
- else
98
- display(format_keys([[name, key]], long, nil))
99
- loop do
100
- display("Proceed with removal? (yes or no)")
101
- choice = ask().chomp()
102
- if choice == "y" || choice == "yes"
103
- break(key)
104
- elsif choice == "n" || choice == "no"
105
- error("Aborting.", type)
106
- else
107
- display("Invalid response.")
108
- end
109
- end
110
- end
111
- key
112
- end
113
-
114
- message = api.keys.remove(name, key_data)
115
- if type == "json"
116
- display("{}")
117
- else
118
- display(message)
119
- end
120
- end
121
-
122
- # keys
123
- #
124
- # Display keys for the current user.
125
- #
126
- # -l, --long # Display extended information for each key
127
- # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
128
- #
129
- def index()
130
- type = options[:output_type] || nil
131
- long = options[:long]
132
-
133
- keys = api.keys.list()
134
- if type.nil?()
135
- display("=== Keys")
136
- end
137
- display(format_keys(keys, long, type))
138
- end
139
-
140
- # keys:clear
141
- #
142
- # Remove all authentication keys from the current user.
143
- #
144
- # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
145
- #
146
- def clear()
147
- type = options[:output_type] || nil
148
-
149
- message = api.keys.clear()
150
- if type == "json"
151
- display("{}")
152
- else
153
- display(message)
154
- end
155
- end
156
-
157
-
158
- private
159
-
160
-
161
- def format_keys(keys, long, type)
162
- outlong = long || type == "json"
163
- rows = keys.map() { |row|
164
- name = row[0]
165
- key = row[1]
166
- if outlong || key.length() < SHORT_KEY_MAX
167
- [key, name]
168
- else
169
- ["#{key[0...SHORT_KEY_SPLIT]}...#{key[SHORT_KEY_SPLIT - SHORT_KEY_MAX + 2..-1]}", name]
170
- end
171
- }
172
- headings = ["key", "name"]
173
- TableOutputBuilder.build_table(headings, rows, type)
174
- end
175
- end
4
+ ## manage authentication keys
5
+ ##
6
+ #class Zillabyte::Command::Keys < Zillabyte::Command::Base
7
+ #
8
+ # SHORT_KEY_SPLIT = 18
9
+ # SHORT_KEY_MAX = 64
10
+ #
11
+ # # keys:add NAME [KEY]
12
+ # #
13
+ # # Add a key for the current user.
14
+ # # If no KEY is specified, will try to find ~/.ssh/id_rsa.pub.
15
+ # #
16
+ # # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
17
+ # #
18
+ # def add()
19
+ # type = options[:output_type] || nil
20
+ # name = shift_argument()
21
+ # if name.nil?
22
+ # error("no name given", type)
23
+ # end
24
+ # keypath = shift_argument() || "~/.ssh/id_rsa.pub"
25
+ # begin
26
+ # key = File.binread(File.expand_path(keypath))
27
+ # rescue => e
28
+ # error(e.message, type)
29
+ # end
30
+ # message = api.keys.add(name, key)
31
+ # if type == "json"
32
+ # display("{}")
33
+ # else
34
+ # display(message)
35
+ # end
36
+ # end
37
+ #
38
+ # # keys:show NAME
39
+ # #
40
+ # # Show a key for the current user.
41
+ # #
42
+ # # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
43
+ # #
44
+ # def show()
45
+ # type = options[:output_type] || nil
46
+ # name = shift_argument()
47
+ # if name.nil?()
48
+ # error("no name given", type)
49
+ # end
50
+ #
51
+ # key = api.keys.show(name)
52
+ # if type == "json"
53
+ # display({"key" => key}.to_json())
54
+ # else
55
+ # display(key)
56
+ # end
57
+ # end
58
+ #
59
+ # # keys:remove [NAME]
60
+ # #
61
+ # # Remove a key from the current user.
62
+ # #
63
+ # # -l, --long # Display extended information for each key
64
+ # # -f, --force # Force -- remove key without prompting
65
+ # # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
66
+ # #
67
+ # def remove()
68
+ # type = options[:output_type] || nil
69
+ # long = options[:long]
70
+ # force = options[:force]
71
+ # name = shift_argument()
72
+ # key_data = if name.nil?()
73
+ # if force
74
+ # error("no name given", type)
75
+ # end
76
+ # keys = api.keys.list()
77
+ # display("=== Keys")
78
+ # display(format_keys(keys, long, nil))
79
+ # # NOTE: it may not be the most efficient thing to use a hash here, unless
80
+ # # we expect users to routinely try to remove invalid keys.
81
+ # keymap = Hash[*keys.flatten()]
82
+ # loop do
83
+ # display("Please enter the name of the key you wish to remove (case-sensitive):")
84
+ # name = ask().chomp()
85
+ # if name.empty?()
86
+ # error("Aborting.", type)
87
+ # end
88
+ # if keymap.has_key?(name)
89
+ # break(keymap[name])
90
+ # end
91
+ # display("Key not found: `#{name}`")
92
+ # end
93
+ # else
94
+ # key = api.keys.show(name)
95
+ # if force
96
+ # key
97
+ # else
98
+ # display(format_keys([[name, key]], long, nil))
99
+ # loop do
100
+ # display("Proceed with removal? (yes or no)")
101
+ # choice = ask().chomp()
102
+ # if choice == "y" || choice == "yes"
103
+ # break(key)
104
+ # elsif choice == "n" || choice == "no"
105
+ # error("Aborting.", type)
106
+ # else
107
+ # display("Invalid response.")
108
+ # end
109
+ # end
110
+ # end
111
+ # key
112
+ # end
113
+ #
114
+ # message = api.keys.remove(name, key_data)
115
+ # if type == "json"
116
+ # display("{}")
117
+ # else
118
+ # display(message)
119
+ # end
120
+ # end
121
+ #
122
+ # # keys
123
+ # #
124
+ # # Display keys for the current user.
125
+ # #
126
+ # # -l, --long # Display extended information for each key
127
+ # # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
128
+ # #
129
+ # def index()
130
+ # type = options[:output_type] || nil
131
+ # long = options[:long]
132
+ #
133
+ # keys = api.keys.list()
134
+ # if type.nil?()
135
+ # display("=== Keys")
136
+ # end
137
+ # display(format_keys(keys, long, type))
138
+ # end
139
+ #
140
+ # # keys:clear
141
+ # #
142
+ # # Remove all authentication keys from the current user.
143
+ # #
144
+ # # --output_type OUTPUT_TYPE # Specify an output format type i.e. json #HIDDEN
145
+ # #
146
+ # def clear()
147
+ # type = options[:output_type] || nil
148
+ #
149
+ # message = api.keys.clear()
150
+ # if type == "json"
151
+ # display("{}")
152
+ # else
153
+ # display(message)
154
+ # end
155
+ # end
156
+ #
157
+ #
158
+ # private
159
+ #
160
+ #
161
+ # def format_keys(keys, long, type)
162
+ # outlong = long || type == "json"
163
+ # rows = keys.map() { |row|
164
+ # name = row[0]
165
+ # key = row[1]
166
+ # if outlong || key.length() < SHORT_KEY_MAX
167
+ # [key, name]
168
+ # else
169
+ # ["#{key[0...SHORT_KEY_SPLIT]}...#{key[SHORT_KEY_SPLIT - SHORT_KEY_MAX + 2..-1]}", name]
170
+ # end
171
+ # }
172
+ # headings = ["key", "name"]
173
+ # TableOutputBuilder.build_table(headings, rows, type)
174
+ # end
175
+ #end
@@ -1,5 +1,5 @@
1
1
  module Zillabyte
2
2
  module CLI
3
- VERSION = "0.1.36"
3
+ VERSION = "0.1.37"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zillabyte-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.36
4
+ version: 0.1.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - zillabyte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-27 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake