dokku_client 1.2 → 1.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: b305671c05ed116254b085aeb57e5ddd9d956d9c
4
- data.tar.gz: e5a8b6f50737af0944cee926701144a857b552a8
3
+ metadata.gz: f04a83b266a594b2501262c1bbacaaa0cb10031e
4
+ data.tar.gz: 3b4d65d14a553d58d5b9d1110fe7283aa5b50684
5
5
  SHA512:
6
- metadata.gz: 732ebe7437f8b3927b4d3f95812a579302e6bf36e0ceb9339c78c1da00279d8f09238aa742adbca992b3841f50755ec37eef03a017afd051a83eb7b111cb0c9e
7
- data.tar.gz: 5a9b447b80378788f783346a7690450462e294acea6c6d7624bd2f18696e34ef28c9f8b8e144c2484d0da1b2c6b9cd11069f2c7fdef1d0da40de72bc606bbc5c
6
+ metadata.gz: bbceabbf61f7c9640eaba827a1836302d481f1ac84e5034df598fc854f6b68cd56fb87ea880ac562d306f60b5f9bf4cd4d712a6b9764faa6aff73658075b1d1b
7
+ data.tar.gz: fe64d135a13bccd0cf234c312e3f0d9ffe27d6786a2f05c61bded8a83d62fd146f954c2d4bbd8709ee66e0246dc708719d26434eeec0628fcedfbb5dc267999d
data/CHANGELOG CHANGED
@@ -1,6 +1,11 @@
1
- === 1.1 Current release
1
+ === 1.4 Current release
2
2
 
3
- * **TODO** more commands (mysql)
3
+ * **TODO** more commands (mariadb)
4
+
5
+ === 1.3
6
+
7
+ * fix redis command
8
+ * added mysql commands
4
9
 
5
10
  === 1.2
6
11
 
data/README.md CHANGED
@@ -46,7 +46,7 @@ In 'active commands' question when you configuring dokku client type plugin name
46
46
  + mongodb
47
47
  + redis
48
48
 
49
- Common and Config commands are enabled by default. If you don't answer to 'active commands' then all commands will be visible.
49
+ Common and Config commands are enabled by default. If you want all commands to be visible you need to type 'all' in the question.
50
50
 
51
51
 
52
52
  ## Show help
@@ -71,40 +71,47 @@ or
71
71
 
72
72
  Config commands:
73
73
  config (c) show environment variables for project
74
- get_config (gc) <KEY> show exact environment variable
75
- set_config (sc) KEY=VALUE [KEY2=VALUE2] set new environment variables
76
- unset_config (uc) KEY [KEY2] remove environment variables
74
+ config:get (gc) <KEY> show exact environment variable
75
+ config:set (sc) KEY=VALUE [KEY2=VALUE2] set new environment variables
76
+ config:unset (uc) KEY [KEY2] remove environment variables
77
77
 
78
78
  Memcached commands:
79
- create_mem create memcached container
80
- delete_mem delete memcached container
81
- info_mem display container informations
82
- logs_mem display last logs from memcached container
83
- link_mem <container> link an app to memcached container
79
+ memcached:create create memcached container
80
+ memcached:delete delete memcached container
81
+ memcached:info display container informations
82
+ memcached:logs display last logs from memcached container
83
+ memcached:link <container> link an app to memcached container
84
84
 
85
85
  MongoDB commands:
86
- create_mongo create a mongo database
87
- delete_mongo delete a mongo database
88
- console_mongo lunch mongodb console as admin
89
- link_mongo link mongo container to application
90
- logs_mongo display logs for mongo container
91
- list_mongo list all mongo databases
92
- status_mongo display status of mongo container
86
+ mongodb:create create a mongo database
87
+ mongodb:delete delete a mongo database
88
+ mongodb:console lunch mongodb console as admin
89
+ mongodb:link link mongo container to application
90
+ mongodb:logs display logs for mongo container
91
+ mongodb:list list all mongo databases
92
+ mongodb:status display status of mongo container
93
93
 
94
94
  Postgresql commands:
95
- create_postgres <db> create a postgresql database
96
- delete_postgres <db> delete specified postgresql database
97
- info_postgres <db> display database information
98
- link_postgres <db> link an app to a postgresql container
99
- list_postgres <db> display list of postgresql containers
100
- logs_postgres display last logs from postgresql container
95
+ postgresql:create <db> create a postgresql database
96
+ postgresql:delete <db> delete specified postgresql database
97
+ postgresql:info <db> display database information
98
+ postgresql:link <db> link an app to a postgresql container
99
+ postgresql:list <db> display list of postgresql containers
100
+ postgresql:logs display last logs from postgresql container
101
101
 
102
102
  Redis commands:
103
- create_redis create a redis container
104
- delete_redis delete redis container
105
- info_redis display container informations
106
- link_redis <container> link an app to a redis container
107
- logs_redis display last logs from redis container
103
+ redis:create create a redis container
104
+ redis:delete delete redis container
105
+ redis:info display container informations
106
+ redis:link <container> link an app to a redis container
107
+ redis:logs display last logs from redis container
108
+
109
+ Mysql commands:
110
+ mysql:create create a mysql container
111
+ mysql:delete delete mysql container
112
+ mysql:info display container informations
113
+ mysql:link <container> link an app to a mysql container
114
+ mysql:logs display last logs from mysql container
108
115
 
109
116
  ## Contributing
110
117
 
@@ -117,3 +124,4 @@ or
117
124
  ## Thanks
118
125
 
119
126
  This gem is inspired by https://github.com/lubieniebieski/pivo_flow. Thanks to it's author for the inspiration and idea.
127
+
@@ -17,6 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.add_runtime_dependency "grit"
18
18
  gem.add_runtime_dependency "highline"
19
19
  gem.add_runtime_dependency "colorize"
20
+ gem.add_runtime_dependency "konf"
20
21
 
21
22
  gem.add_development_dependency "rake"
22
23
  gem.add_development_dependency "pry"
@@ -0,0 +1,49 @@
1
+ no_argument:
2
+ - "logs"
3
+ - "reconfig"
4
+ - "config"
5
+ - "c"
6
+ - "l"
7
+ - "memcached:create"
8
+ - "memcached:delete"
9
+ - "memcached:info"
10
+ - "memcached:logs"
11
+ - "p"
12
+ - "url"
13
+ - "u"
14
+ - "postgresql:list"
15
+ - "rdm"
16
+ - "redis:create"
17
+ - "redis:delete"
18
+ - "redis:info"
19
+ - "redis:logs"
20
+ - "mongodb:create"
21
+ - "mongodb:delete"
22
+ - "mongodb:console"
23
+ - "mongodb:link"
24
+ - "mongodb:logs"
25
+ - "mongodb:list"
26
+ - "mongodb:status"
27
+ - "mysql:create"
28
+ - "mysql:delete"
29
+ - "mysql:info"
30
+ - "mysql:logs"
31
+ single_argument:
32
+ - "config:get"
33
+ - "gc"
34
+ - "memcached:link"
35
+ - "postgresql:create"
36
+ - "rc"
37
+ - "postgresql:info"
38
+ - "postgresql:delete"
39
+ - "postgresql:logs"
40
+ - "postgresql:link"
41
+ - "redis:link"
42
+ - "mysql:link"
43
+ multiple_arguments:
44
+ - "run_command"
45
+ - "r"
46
+ - "sc"
47
+ - "confi:set"
48
+ - "config:unset"
49
+ - "uc"
@@ -3,6 +3,7 @@ require 'grit'
3
3
  require 'optparse'
4
4
  require 'highline'
5
5
  require 'fileutils'
6
+ require 'konf'
6
7
 
7
8
  require 'dokku_client/core_extensions'
8
9
  require 'dokku_client/errors'
@@ -48,6 +48,17 @@ module DokkuClient
48
48
  @options["plugins"].include?(plugin) || @options["plugins"].include?('all')
49
49
  end
50
50
 
51
+ def common_description name, opts
52
+ if plugin_enabled(name)
53
+ opts.separator "\n #{name.capitalize} commands:"
54
+ opts.separator " #{name}:create create a #{name} container"
55
+ opts.separator " #{name}:delete delete #{name} container"
56
+ opts.separator " #{name}:info display container informations"
57
+ opts.separator " #{name}:link <container> link an app to a #{name} container"
58
+ opts.separator " #{name}:logs display last logs from #{name} container"
59
+ end
60
+ end
61
+
51
62
  private
52
63
 
53
64
  def config_update_success
@@ -21,6 +21,8 @@ module DokkuClient
21
21
  end
22
22
  end
23
23
 
24
+ List = Konf.new(YAML.load(File.read(File.expand_path('../../dokku.yml', __FILE__))))
25
+
24
26
  private
25
27
 
26
28
  # available commands
@@ -115,6 +117,18 @@ module DokkuClient
115
117
 
116
118
  def_delegator :dokku_redis, :logs_redis, :redis_logs
117
119
 
120
+ ### mysql commands
121
+
122
+ def_delegator :dokku_mysql, :create_mysql, :mysql_create
123
+
124
+ def_delegator :dokku_mysql, :delete_mysql, :mysql_delete
125
+
126
+ def_delegator :dokku_mysql, :info_mysql, :mysql_info
127
+
128
+ def_delegator :dokku_mysql, :link_mysql, :mysql_link
129
+
130
+ def_delegator :dokku_mysql, :logs_mysql, :mysql_logs
131
+
118
132
  def reconfig
119
133
  DokkuClient::Base.new.reconfig
120
134
  end
@@ -149,6 +163,10 @@ module DokkuClient
149
163
  @dokku_redis ||= DokkuClient::Plugins::Redis.new(@options)
150
164
  end
151
165
 
166
+ def dokku_mysql
167
+ @dokku_mysql ||= DokkuClient::Plugins::Mysql.new(@options)
168
+ end
169
+
152
170
  def no_argument_error
153
171
  puts "You forgot argument - look into help"
154
172
  end
@@ -165,6 +183,10 @@ module DokkuClient
165
183
  arg.include?(':') ? arg.gsub(':', '_').to_sym : arg.to_sym
166
184
  end
167
185
 
186
+ def get_list list, arg
187
+ List.public_send(list).include?(arg) ? arg : ""
188
+ end
189
+
168
190
  def parse_argv(args)
169
191
  @options = {}
170
192
 
@@ -174,10 +196,11 @@ module DokkuClient
174
196
  opts.separator "\n version show gem version"
175
197
  dokku_common.commands(opts)
176
198
  dokku_config.commands(opts)
177
- dokku_memcached.commands(opts)
178
199
  dokku_mongodb.commands(opts)
179
200
  dokku_postgresql.commands(opts)
180
201
  dokku_redis.commands(opts)
202
+ dokku_mysql.commands(opts)
203
+ dokku_memcached.commands(opts)
181
204
  opts.separator ""
182
205
  opts.separator "\nOptions"
183
206
 
@@ -203,15 +226,15 @@ module DokkuClient
203
226
 
204
227
  opt_parser.parse!(args)
205
228
 
206
- case args[0]
207
- when "config:get", "gc", "memcached:link", "postgresql:create", "rc", "postgresql:info", "postgresql:delete", "postgresql:logs", "postgresql:link", "redis:link"
208
- self.send(get_method(args[0]), args[1])
229
+ case arg = args[0]
230
+ when get_list("single_argument", arg)
231
+ self.send(get_method(arg), args[1])
209
232
  when "help"
210
233
  puts opt_parser
211
- when "logs", "reconfig", "config", "c", "l", "memcached:create", "memcached:delete", "memcached:info", "memcached:logs", "p", "url", "u", "postgresql:list", "rdm", "redis:create", "redis:delete", "redis:info", "redis:logs", "mongodb:create", "mongodb:delete", "mongodb:console", "mongodb:link", "mongodb:logs", "mongodb:list", "mongodb:status"
212
- self.send(get_method(args[0]))
213
- when "run_command", "r", "sc", "confi:set", "config:unset", "uc"
214
- first = get_method(args[0])
234
+ when get_list("no_argument", arg)
235
+ self.send(get_method(arg))
236
+ when get_list("multiple_arguments", arg)
237
+ first = get_method(arg)
215
238
  args.shift
216
239
  self.send(first, args.join(' '))
217
240
  when nil
@@ -26,14 +26,7 @@ module DokkuClient
26
26
  end
27
27
 
28
28
  def commands opts
29
- if plugin_enabled('memcached')
30
- opts.separator "\n Memcached commands:"
31
- opts.separator " memcached:create create memcached container"
32
- opts.separator " memcached:delete delete memcached container"
33
- opts.separator " memcached:info display container informations"
34
- opts.separator " memcached:logs display last logs from memcached container"
35
- opts.separator " memcached:link <container> link an app to memcached container"
36
- end
29
+ common_description('memcached', opts)
37
30
  end
38
31
 
39
32
  end
@@ -2,6 +2,33 @@ module DokkuClient
2
2
  module Plugins
3
3
  class Mysql < Base
4
4
 
5
+ def run
6
+ end
7
+
8
+ def create_mysql
9
+ dokku "mysql:create #{@options["project-name"]}"
10
+ end
11
+
12
+ def delete_mysql
13
+ dokku "mysql:delete #{@options["project-name"]}"
14
+ end
15
+
16
+ def info_mysql
17
+ dokku "mysql:info #{@options["project-name"]}"
18
+ end
19
+
20
+ def link_mysql db
21
+ dokku "mysql:link #{@options["project-name"]} #{db}"
22
+ end
23
+
24
+ def logs_mysql
25
+ dokku "mysql:logs #{@options["project-name"]}"
26
+ end
27
+
28
+ def commands opts
29
+ common_description('mysql', opts)
30
+ end
31
+
5
32
  end
6
33
  end
7
34
  end
@@ -18,7 +18,7 @@ module DokkuClient
18
18
  end
19
19
 
20
20
  def link_redis container
21
- dokku "redis:link #{@options["project-name"]} container"
21
+ dokku "redis:link #{@options["project-name"]} #{container}"
22
22
  end
23
23
 
24
24
  def logs_redis
@@ -26,14 +26,7 @@ module DokkuClient
26
26
  end
27
27
 
28
28
  def commands opts
29
- if plugin_enabled('redis')
30
- opts.separator "\n Redis commands:"
31
- opts.separator " redis:create create a redis container"
32
- opts.separator " redis:delete delete redis container"
33
- opts.separator " redis:info display container informations"
34
- opts.separator " redis:link <container> link an app to a redis container"
35
- opts.separator " redis:logs display last logs from redis container"
36
- end
29
+ common_description('redis', opts)
37
30
  end
38
31
 
39
32
  end
@@ -1,3 +1,3 @@
1
1
  module DokkuClient
2
- VERSION = '1.2'
2
+ VERSION = '1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dokku_client
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuba Łasecki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-28 00:00:00.000000000 Z
11
+ date: 2014-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grit
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: konf
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -96,6 +110,7 @@ files:
96
110
  - Rakefile
97
111
  - bin/dokku
98
112
  - dokku_client.gemspec
113
+ - lib/dokku.yml
99
114
  - lib/dokku_client.rb
100
115
  - lib/dokku_client/base.rb
101
116
  - lib/dokku_client/cli.rb