appli 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/appli.rb CHANGED
@@ -14,7 +14,7 @@ module Appli
14
14
  class NotConfiguredError < StandardError; end
15
15
  class MustBeInRepositoryError < StandardError; end
16
16
 
17
- VERSION = "0.0.7"
17
+ VERSION = "0.0.8"
18
18
 
19
19
  def run(command, args = [])
20
20
  load_commands
@@ -29,22 +29,42 @@ command "db:import" do |number, path|
29
29
  end
30
30
 
31
31
  desc 'List all databases on this application'
32
- usage "appli [application] db"
32
+ usage "appli [application] db:lists"
33
33
  command "db:list" do
34
- puts '-' * 85
34
+ puts '-' * 80
35
35
  print 'Name'.ljust(15)
36
36
  print 'Username'.ljust(15)
37
37
  print 'Password'.ljust(15)
38
- print 'Host'.ljust(30)
38
+ print 'Host'.ljust(25)
39
39
  puts
40
- puts '-' * 85
40
+ puts '-' * 80
41
41
 
42
42
  for database in get("applications/#{@options[:application]}/databases")
43
43
  database = database['database']
44
44
  print database['name'].ljust(15)
45
45
  print database['username'].ljust(15)
46
46
  print database['password'].ljust(15)
47
- print database['host']['name'].ljust(30)
47
+ print database['host']['name'].ljust(25)
48
48
  puts
49
49
  end
50
- end
50
+ end
51
+
52
+ desc 'Create a new database with the entered label'
53
+ usage 'appli [application] db:create {label}'
54
+ command "db:create", :required_args => 1 do |*label|
55
+ label = label.join(' ')
56
+ if db = api_on_app('databases', {:database => {:label => label}}.to_json)
57
+ puts "Database has been created successfully. Connection details can be found below:"
58
+ db = JSON.parse(db)['database']
59
+ puts
60
+ puts " Label.............: #{db['label']}"
61
+ puts " Database Name.....: #{db['name']}"
62
+ puts " Username..........: #{db['username']}"
63
+ puts " Password..........: #{db['password']}"
64
+ puts " Host..............: #{db['host']['name']}"
65
+ puts
66
+ else
67
+ puts "Database could not be created."
68
+ display_errors
69
+ end
70
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
@@ -36,11 +36,11 @@ files:
36
36
  - lib/appli.rb
37
37
  - lib/commands/apps.rb
38
38
  - lib/commands/cap.rb
39
+ - lib/commands/db.rb
39
40
  - lib/commands/domains.rb
40
41
  - lib/commands/gems.rb
41
42
  - lib/commands/keys.rb
42
43
  - lib/commands/logs.rb
43
- - lib/commands/mysql.rb
44
44
  - lib/commands/ssh.rb
45
45
  - lib/commands/stats.rb
46
46
  has_rdoc: true