webbynode 1.0.5.3 → 1.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of webbynode might be problematic. Click here for more details.
- data/.autotest +1 -0
- data/.bundle/config +2 -0
- data/.gitignore +4 -0
- data/.rvmrc +1 -0
- data/.travis.yml +9 -0
- data/Gemfile +1 -20
- data/Gemfile.lock +43 -50
- data/Manifest +0 -1
- data/Rakefile +1 -45
- data/bin/webbynode +0 -0
- data/bin/wn +0 -0
- data/lib/webbynode/api_client.rb +35 -63
- data/lib/webbynode/command.rb +2 -1
- data/lib/webbynode/commands/accounts.rb +11 -8
- data/lib/webbynode/commands/change_dns.rb +1 -1
- data/lib/webbynode/commands/database.rb +7 -7
- data/lib/webbynode/commands/dns_aliases.rb +6 -6
- data/lib/webbynode/commands/{guides.rb → docs.rb} +3 -2
- data/lib/webbynode/commands/help.rb +3 -3
- data/lib/webbynode/commands/init.rb +16 -16
- data/lib/webbynode/commands/push.rb +7 -7
- data/lib/webbynode/commands/remote.rb +1 -1
- data/lib/webbynode/commands/settings.rb +1 -1
- data/lib/webbynode/commands/tasks.rb +3 -3
- data/lib/webbynode/commands/user.rb +5 -5
- data/lib/webbynode/commands/version.rb +1 -1
- data/lib/webbynode/commands/webbies.rb +17 -22
- data/lib/webbynode/manager2_api_client.rb +94 -0
- data/lib/webbynode/manager_api_client.rb +94 -0
- data/lib/webbynode/models/webby.rb +3 -0
- data/lib/webbynode/notify.rb +1 -1
- data/lib/webbynode/server.rb +1 -1
- data/lib/webbynode/updater.rb +28 -8
- data/lib/webbynode/version.rb +8 -0
- data/lib/webbynode.rb +5 -5
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/fixtures/manager2/webbies +11 -0
- data/spec/fixtures/manager2/webbies_unauthorized +10 -0
- data/spec/fixtures/manager2/zones +11 -0
- data/spec/fixtures/manager2/zones_a_record +11 -0
- data/spec/fixtures/manager2/zones_a_record_error +10 -0
- data/spec/fixtures/manager2/zones_new_zone +11 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/webbynode/api_client_spec.rb +15 -128
- data/spec/webbynode/command_spec.rb +6 -0
- data/spec/webbynode/commands/accounts_spec.rb +10 -4
- data/spec/webbynode/commands/apps_spec.rb +1 -0
- data/spec/webbynode/commands/database_spec.rb +4 -1
- data/spec/webbynode/commands/{guides_spec.rb → docs_spec.rb} +2 -2
- data/spec/webbynode/commands/init_spec.rb +27 -64
- data/spec/webbynode/commands/push_spec.rb +29 -15
- data/spec/webbynode/commands/remote_spec.rb +2 -0
- data/spec/webbynode/commands/version_spec.rb +1 -1
- data/spec/webbynode/commands/webbies_spec.rb +17 -2
- data/spec/webbynode/manager2_api_client_spec.rb +127 -0
- data/spec/webbynode/manager_api_client_spec.rb +136 -0
- data/webbynode.gemspec +30 -49
- metadata +297 -127
- data/PostInstall.txt +0 -45
- data/changelog.rdoc +0 -437
- data/cucumber.yml.old +0 -1
data/.autotest
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'autotest/bundler'
|
data/.bundle/config
ADDED
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm ruby-1.9.3-p327@webbynode --create
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,22 +1,3 @@
|
|
1
1
|
source :rubygems
|
2
2
|
|
3
|
-
|
4
|
-
gem 'highline'
|
5
|
-
gem 'httparty', '~> 0.7.4'
|
6
|
-
gem 'net-ssh', '= 2.1.0'
|
7
|
-
gem 'taps', '0.3.23'
|
8
|
-
gem 'webbynode-rainbow', '~> 1.1.3'
|
9
|
-
|
10
|
-
group :development do
|
11
|
-
gem 'rspec'
|
12
|
-
gem 'growl'
|
13
|
-
gem 'guard'
|
14
|
-
gem 'guard-rspec'
|
15
|
-
gem 'ZenTest'
|
16
|
-
gem 'autotest-growl'
|
17
|
-
gem 'database_cleaner'
|
18
|
-
gem 'awesome_print'
|
19
|
-
gem 'fakeweb'
|
20
|
-
gem 'echoe'
|
21
|
-
gem 'rcov'
|
22
|
-
end
|
3
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,67 +1,66 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
webbynode (1.1.0)
|
5
|
+
domainatrix (~> 0.0.7)
|
6
|
+
highline (~> 1.6.1)
|
7
|
+
httparty (~> 0.7.4)
|
8
|
+
net-ssh (= 2.1.0)
|
9
|
+
sqlite3 (~> 1.3.4)
|
10
|
+
taps (~> 0.3.23)
|
11
|
+
webbynode-rainbow (~> 1.1.3)
|
12
|
+
|
1
13
|
GEM
|
2
14
|
remote: http://rubygems.org/
|
3
15
|
specs:
|
4
16
|
ZenTest (4.5.0)
|
5
|
-
addressable (2.2
|
6
|
-
allison (2.0.3)
|
17
|
+
addressable (2.3.2)
|
7
18
|
autotest-growl (0.2.9)
|
8
19
|
awesome_print (0.3.2)
|
9
20
|
configuration (1.2.0)
|
10
21
|
crack (0.1.8)
|
11
|
-
|
12
|
-
|
13
|
-
domainatrix (0.0.7)
|
22
|
+
diff-lcs (1.1.3)
|
23
|
+
domainatrix (0.0.11)
|
14
24
|
addressable
|
15
|
-
echoe (4.5.6)
|
16
|
-
allison
|
17
|
-
gemcutter
|
18
|
-
rubyforge
|
19
25
|
fakeweb (1.3.0)
|
20
|
-
gemcutter (0.7.0)
|
21
|
-
growl (1.0.3)
|
22
26
|
guard (0.3.0)
|
23
27
|
open_gem (~> 1.4.2)
|
24
28
|
thor (~> 0.14.6)
|
25
29
|
guard-rspec (0.1.9)
|
26
30
|
guard (>= 0.2.2)
|
27
|
-
highline (1.6.
|
28
|
-
httparty (0.7.
|
31
|
+
highline (1.6.15)
|
32
|
+
httparty (0.7.8)
|
29
33
|
crack (= 0.1.8)
|
30
|
-
json_pure (1.5.3)
|
31
34
|
launchy (0.3.7)
|
32
35
|
configuration (>= 0.0.5)
|
33
36
|
rake (>= 0.8.1)
|
34
|
-
mime-types (1.
|
37
|
+
mime-types (1.19)
|
35
38
|
net-ssh (2.1.0)
|
36
39
|
open_gem (1.4.2)
|
37
40
|
launchy (~> 0.3.5)
|
38
|
-
rack (1.
|
39
|
-
rake (0.
|
41
|
+
rack (1.4.1)
|
42
|
+
rake (10.0.2)
|
43
|
+
rb-fsevent (0.9.2)
|
40
44
|
rcov (0.9.9)
|
41
|
-
rest-client (1.6.
|
45
|
+
rest-client (1.6.7)
|
42
46
|
mime-types (>= 1.16)
|
43
|
-
rspec (2.
|
44
|
-
rspec-core (~> 2.
|
45
|
-
rspec-expectations (~> 2.
|
46
|
-
rspec-mocks (~> 2.
|
47
|
-
rspec-core (2.
|
48
|
-
rspec-expectations (2.
|
49
|
-
diff-lcs (~> 1.1.
|
50
|
-
rspec-mocks (2.
|
51
|
-
rubyforge (2.0.4)
|
52
|
-
json_pure (>= 1.1.7)
|
47
|
+
rspec (2.12.0)
|
48
|
+
rspec-core (~> 2.12.0)
|
49
|
+
rspec-expectations (~> 2.12.0)
|
50
|
+
rspec-mocks (~> 2.12.0)
|
51
|
+
rspec-core (2.12.1)
|
52
|
+
rspec-expectations (2.12.0)
|
53
|
+
diff-lcs (~> 1.1.3)
|
54
|
+
rspec-mocks (2.12.0)
|
53
55
|
sequel (3.20.0)
|
54
56
|
sinatra (1.0)
|
55
57
|
rack (>= 1.0)
|
56
|
-
sqlite3 (1.3.
|
57
|
-
|
58
|
-
sqlite3 (>= 1.3.3)
|
59
|
-
taps (0.3.23)
|
58
|
+
sqlite3 (1.3.6)
|
59
|
+
taps (0.3.24)
|
60
60
|
rack (>= 1.0.1)
|
61
61
|
rest-client (>= 1.4.0, < 1.7.0)
|
62
62
|
sequel (~> 3.20.0)
|
63
63
|
sinatra (~> 1.0.0)
|
64
|
-
sqlite3-ruby (~> 1.2)
|
65
64
|
thor (0.14.6)
|
66
65
|
webbynode-rainbow (1.1.3)
|
67
66
|
|
@@ -69,20 +68,14 @@ PLATFORMS
|
|
69
68
|
ruby
|
70
69
|
|
71
70
|
DEPENDENCIES
|
72
|
-
ZenTest
|
73
|
-
autotest-growl
|
74
|
-
awesome_print
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
httparty (~> 0.7.4)
|
84
|
-
net-ssh (= 2.1.0)
|
85
|
-
rcov
|
86
|
-
rspec
|
87
|
-
taps (= 0.3.23)
|
88
|
-
webbynode-rainbow (~> 1.1.3)
|
71
|
+
ZenTest (~> 4.5.0)
|
72
|
+
autotest-growl (~> 0.2.9)
|
73
|
+
awesome_print (~> 0.3.2)
|
74
|
+
fakeweb (~> 1.3.0)
|
75
|
+
guard (~> 0.3.0)
|
76
|
+
guard-rspec (~> 0.1.9)
|
77
|
+
rake (~> 10.0.2)
|
78
|
+
rb-fsevent (~> 0.9.2)
|
79
|
+
rcov (~> 0.9.9)
|
80
|
+
rspec (~> 2.12.0)
|
81
|
+
webbynode!
|
data/Manifest
CHANGED
data/Rakefile
CHANGED
@@ -1,51 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'rake'
|
2
|
+
require 'rake'
|
3
3
|
require 'rake/testtask'
|
4
4
|
|
5
|
-
require 'echoe'
|
6
|
-
|
7
|
-
Echoe.new('webbynode', '1.0.5.3') do |p|
|
8
|
-
p.description = "Webbynode Deployment Gem"
|
9
|
-
p.url = "http://webbynode.com"
|
10
|
-
p.author = "Felipe Coury"
|
11
|
-
p.email = "felipe@webbynode.com"
|
12
|
-
p.ignore_pattern = ["tmp/*", "script/*"]
|
13
|
-
p.dependencies = [
|
14
|
-
['bundler', '>=0.9.26'],
|
15
|
-
['net-ssh', '=2.1.0'],
|
16
|
-
['taps', '~>0.3.19'],
|
17
|
-
['highline', '>=1.5.2'],
|
18
|
-
['httparty', '~>0.7.4'],
|
19
|
-
['launchy', '>=0.3.7'],
|
20
|
-
['domainatrix','>=0.0.7'],
|
21
|
-
['webbynode-rainbow','~>1.1.3'],
|
22
|
-
]
|
23
|
-
# p.dependencies = [
|
24
|
-
# ['activeresource','>= 2.3.4'],
|
25
|
-
# ['activesupport','>= 2.3.4'],
|
26
|
-
# ['rainbow', '>=1.0.4'],
|
27
|
-
# ['highline', '>=1.5.1'],
|
28
|
-
# ['httparty', '>=0.4.5']
|
29
|
-
# ]
|
30
|
-
p.install_message = "
|
31
|
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
32
|
-
Webbynode Rapid Deployment Gem
|
33
|
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
34
|
-
|
35
|
-
Thank you for installing Webbynode gem. You're now
|
36
|
-
able to deploy and manage your applications from
|
37
|
-
the comfort of your command line.
|
38
|
-
|
39
|
-
Please read our guide for a quickstart:
|
40
|
-
http://guides.webbynode.com/articles/rapidapps/
|
41
|
-
|
42
|
-
For more information use the commands:
|
43
|
-
wn help
|
44
|
-
wn guides
|
45
|
-
|
46
|
-
"
|
47
|
-
end
|
48
|
-
|
49
5
|
require 'rspec/core/rake_task'
|
50
6
|
|
51
7
|
desc 'Default: run specs.'
|
data/bin/webbynode
CHANGED
File without changes
|
data/bin/wn
CHANGED
File without changes
|
data/lib/webbynode/api_client.rb
CHANGED
@@ -1,76 +1,53 @@
|
|
1
1
|
module Webbynode
|
2
2
|
class ApiClient
|
3
3
|
include HTTParty
|
4
|
-
base_uri "https://manager.webbynode.com/api/yaml"
|
5
|
-
|
6
4
|
CREDENTIALS_FILE = "#{Io.home_dir}/.webbynode"
|
7
5
|
|
8
6
|
Unauthorized = Class.new(StandardError)
|
9
7
|
InactiveZone = Class.new(StandardError)
|
10
8
|
ApiError = Class.new(StandardError)
|
11
|
-
|
9
|
+
|
12
10
|
def io
|
13
11
|
@io ||= Io.new
|
14
12
|
end
|
15
|
-
|
16
|
-
def
|
17
|
-
|
18
|
-
if zones = response["zones"]
|
19
|
-
zones.inject({}) { |h, zone| h[zone[:domain]] = zone; h }
|
20
|
-
end
|
13
|
+
|
14
|
+
def self.system
|
15
|
+
ApiClient.new.credentials['system']
|
21
16
|
end
|
22
|
-
|
23
|
-
def create_record(record, ip)
|
24
|
-
original_record = record
|
25
17
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
if
|
32
|
-
|
18
|
+
def self.instance
|
19
|
+
instance_for(system)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.instance_for(system)
|
23
|
+
if system == "manager2"
|
24
|
+
Manager2ApiClient.new
|
33
25
|
else
|
34
|
-
|
26
|
+
ManagerApiClient.new
|
35
27
|
end
|
36
|
-
|
37
|
-
create_a_record(zone[:id], record, ip, original_record)
|
38
28
|
end
|
39
29
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
response
|
44
|
-
end
|
45
|
-
|
46
|
-
def create_a_record(id, record, ip, original_record)
|
47
|
-
response = post("/dns/#{id}/records/new", :query => {"record[name]" => record, "record[type]" => "A", "record[data]" => ip})
|
48
|
-
if response["errors"] and response["errors"] =~ /Data has already been taken/
|
49
|
-
io.log "'#{original_record}' is already setup on Webbynode DNS, make sure it's pointing to #{ip}", :warning
|
50
|
-
return
|
30
|
+
def ip_for(hostname)
|
31
|
+
if webby = webbies[hostname]
|
32
|
+
webby.ip
|
51
33
|
end
|
52
|
-
|
53
|
-
handle_error(response)
|
54
|
-
response["record"]
|
55
34
|
end
|
56
35
|
|
57
36
|
def handle_error(response)
|
58
37
|
raise ApiError, response["error"] if response["error"]
|
38
|
+
raise ApiError, format_error(response["errors"]) if response["errors"]
|
59
39
|
raise ApiError, "invalid response from the API (code #{response.code})" unless response.code == 200
|
60
40
|
end
|
61
|
-
|
62
|
-
def
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
response = post("/webbies") || {}
|
69
|
-
|
70
|
-
@webbies = response
|
41
|
+
|
42
|
+
def format_error(error_hash)
|
43
|
+
output = []
|
44
|
+
error_hash.each_pair do |field, errors|
|
45
|
+
errors.each do |error|
|
46
|
+
output << "#{field} #{error}"
|
47
|
+
end
|
71
48
|
end
|
72
|
-
|
73
|
-
|
49
|
+
|
50
|
+
output.join(", ")
|
74
51
|
end
|
75
52
|
|
76
53
|
def credentials
|
@@ -81,39 +58,34 @@ module Webbynode
|
|
81
58
|
creds = if io.file_exists?(CREDENTIALS_FILE) and !overwrite
|
82
59
|
properties
|
83
60
|
else
|
61
|
+
system = overwrite[:system] if overwrite.is_a?(Hash) and overwrite[:system]
|
84
62
|
email = overwrite[:email] if overwrite.is_a?(Hash) and overwrite[:email]
|
85
63
|
token = overwrite[:token] if overwrite.is_a?(Hash) and overwrite[:token]
|
86
64
|
|
87
|
-
io.log io.read_from_template("api_token") unless email and token
|
65
|
+
io.log io.read_from_template("api_token") unless email and token and system
|
66
|
+
|
67
|
+
system ||= ask("What's the end point you're using - manager or manager2? ")
|
68
|
+
email ||= ask("Login email: ")
|
69
|
+
token ||= ask("API token: ")
|
88
70
|
|
89
|
-
|
90
|
-
token ||= ask("API token: ")
|
71
|
+
puts ""
|
91
72
|
|
92
|
-
response =
|
73
|
+
response = ApiClient.instance_for(system).check_auth(email, token)
|
93
74
|
if response.code == 401 or response.code == 411
|
94
75
|
raise Unauthorized, "You have provided the wrong credentials"
|
95
76
|
end
|
96
77
|
|
97
78
|
properties['email'] = email
|
98
79
|
properties['token'] = token
|
80
|
+
properties['system'] = system
|
99
81
|
properties.save
|
100
82
|
|
101
|
-
|
102
|
-
|
103
|
-
{ :email => email, :token => token }
|
83
|
+
{ :email => email, :token => token, :system => system }
|
104
84
|
end
|
105
85
|
end
|
106
86
|
|
107
87
|
def properties
|
108
88
|
@properties ||= Webbynode::Properties.new(CREDENTIALS_FILE)
|
109
89
|
end
|
110
|
-
|
111
|
-
def post(uri, options={})
|
112
|
-
response = self.class.post(uri, { :body => credentials }.merge(options))
|
113
|
-
if response.code == 401 or response.code == 411
|
114
|
-
raise Unauthorized, "You have provided the wrong credentials"
|
115
|
-
end
|
116
|
-
response
|
117
|
-
end
|
118
90
|
end
|
119
91
|
end
|
data/lib/webbynode/command.rb
CHANGED
@@ -213,7 +213,7 @@ module Webbynode
|
|
213
213
|
end
|
214
214
|
|
215
215
|
def api
|
216
|
-
@@api ||=
|
216
|
+
@@api ||= ApiClient.instance
|
217
217
|
end
|
218
218
|
|
219
219
|
def notify(msg)
|
@@ -267,6 +267,7 @@ module Webbynode
|
|
267
267
|
end
|
268
268
|
|
269
269
|
begin
|
270
|
+
@@api = ApiClient.instance
|
270
271
|
validate_initialization if settings[:requires_initialization!]
|
271
272
|
validate_options if settings[:requires_options!]
|
272
273
|
execute
|
@@ -24,7 +24,7 @@ module Webbynode::Commands
|
|
24
24
|
|
25
25
|
def missing_target?
|
26
26
|
unless io.file_exists?(target)
|
27
|
-
io.log "Account alias #{param(:name).
|
27
|
+
io.log "Account alias #{param(:name).bright} not found. Use #{"wn account list".bright} for a full list."
|
28
28
|
return true
|
29
29
|
end
|
30
30
|
end
|
@@ -35,7 +35,7 @@ module Webbynode::Commands
|
|
35
35
|
|
36
36
|
def default
|
37
37
|
credentials = api.credentials
|
38
|
-
io.log "Current account: #{credentials["email"].
|
38
|
+
io.log "Current account: #{credentials["email"].bright}"
|
39
39
|
end
|
40
40
|
|
41
41
|
def list
|
@@ -46,11 +46,14 @@ module Webbynode::Commands
|
|
46
46
|
return
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
current_email = api.credentials["email"]
|
50
|
+
current_system = api.credentials["system"]
|
50
51
|
files.each do |f|
|
51
52
|
if f =~ /\.webbynode_(.*)/
|
52
|
-
|
53
|
-
io.
|
53
|
+
current = io.file_matches(f, /email=#{current_email}/)
|
54
|
+
current = current && io.file_matches(f, /system=#{current_system}$/)
|
55
|
+
mark = current ? "* " : " "
|
56
|
+
io.log "#{mark.bright}#{$1}"
|
54
57
|
end
|
55
58
|
end
|
56
59
|
end
|
@@ -68,7 +71,7 @@ module Webbynode::Commands
|
|
68
71
|
return if missing_target?
|
69
72
|
io.copy_file target, "#{Prefix}"
|
70
73
|
account_alias = param(:name).dup
|
71
|
-
io.log "Successfully switched to account alias #{account_alias.
|
74
|
+
io.log "Successfully switched to account alias #{account_alias.bright}."
|
72
75
|
end
|
73
76
|
|
74
77
|
def new
|
@@ -84,12 +87,12 @@ module Webbynode::Commands
|
|
84
87
|
return if missing_target?
|
85
88
|
|
86
89
|
if io.file_exists?("#{Prefix}_#{param(:new_name)}")
|
87
|
-
io.log "Account alias #{param(:new_name).
|
90
|
+
io.log "Account alias #{param(:new_name).bright} already exists, use #{"wn account delete".bright} to remove it first."
|
88
91
|
return
|
89
92
|
end
|
90
93
|
|
91
94
|
io.rename_file "#{Prefix}_#{param(:name)}", "#{Prefix}_#{param(:new_name)}"
|
92
|
-
io.log "Account alias #{param(:name).
|
95
|
+
io.log "Account alias #{param(:name).bright} successfully renamed to #{param(:new_name).bright}."
|
93
96
|
end
|
94
97
|
end
|
95
98
|
end
|
@@ -30,7 +30,7 @@ module Webbynode::Commands
|
|
30
30
|
|
31
31
|
io.log "Your application will start responding to #{param(:dns_entry)} after next deployment."
|
32
32
|
rescue Webbynode::ApiClient::InactiveZone
|
33
|
-
io.log "Domain #{$!.message.
|
33
|
+
io.log "Domain #{$!.message.bright} already setup on Webbynode DNS, but it's inactive."
|
34
34
|
io.log "Please reactivate it and try again."
|
35
35
|
end
|
36
36
|
end
|
@@ -11,7 +11,7 @@ module Webbynode::Commands
|
|
11
11
|
attr_reader :db
|
12
12
|
|
13
13
|
def default
|
14
|
-
io.log "Missing action: use #{"pull".
|
14
|
+
io.log "Missing action: use #{"pull".bright}, #{"push".bright} or #{"config".bright}. For more help use #{"#{File.basename $0} help database".bright}."
|
15
15
|
end
|
16
16
|
|
17
17
|
def pull
|
@@ -59,16 +59,16 @@ module Webbynode::Commands
|
|
59
59
|
:remote_ip => ip)
|
60
60
|
rescue TapsError
|
61
61
|
if $!.message =~ /LoadError: no such file to load -- (.*)/
|
62
|
-
io.log "#{"ERROR:".
|
62
|
+
io.log "#{"ERROR:".bright} Missing database adapter. You need to install #{$1.bright} gem to handle your database."
|
63
63
|
elsif $!.message =~ /Mysql::Error: Unknown database '(.*)'/
|
64
|
-
io.log "#{"ERROR:".
|
64
|
+
io.log "#{"ERROR:".bright} Unknown database #{$1.bright}. Create the local database and try again."
|
65
65
|
elsif $!.message =~ /Sequel::DatabaseConnectionError -\> Mysql::Error: (.*)/
|
66
|
-
io.log "#{"ERROR:".
|
66
|
+
io.log "#{"ERROR:".bright} Invalid MySQL credentials for your local database (#{$1})"
|
67
67
|
else
|
68
68
|
if $!.message =~ /(.*) -\> (.*)/
|
69
|
-
io.log "#{"ERROR:".
|
69
|
+
io.log "#{"ERROR:".bright} Unexpected error - #{$2}"
|
70
70
|
else
|
71
|
-
io.log "#{"ERROR:".
|
71
|
+
io.log "#{"ERROR:".bright} Unexpected error - #{$!.message}"
|
72
72
|
end
|
73
73
|
end
|
74
74
|
ensure
|
@@ -93,7 +93,7 @@ module Webbynode::Commands
|
|
93
93
|
|
94
94
|
def ask_db_credentials(force=false)
|
95
95
|
retrieve_db_credentials
|
96
|
-
|
96
|
+
|
97
97
|
if force || db[:name].nil?
|
98
98
|
db[:name] = query("Database name", db[:name] || io.db_name)
|
99
99
|
db[:user] = query(" User name", db[:user] || io.db_name)
|
@@ -22,9 +22,9 @@ module Webbynode::Commands
|
|
22
22
|
|
23
23
|
def show
|
24
24
|
if aliases.any?
|
25
|
-
io.log("Current aliases: #{aliases.join(' ').
|
25
|
+
io.log("Current aliases: #{aliases.join(' ').bright}")
|
26
26
|
else
|
27
|
-
io.log("No current aliases. To add new aliases use:\n\n #{"#{File.basename $0} dns_aliases add ".
|
27
|
+
io.log("No current aliases. To add new aliases use:\n\n #{"#{File.basename $0} dns_aliases add ".bright}new-dns-alias")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -32,12 +32,12 @@ module Webbynode::Commands
|
|
32
32
|
new_alias = param(:alias)
|
33
33
|
|
34
34
|
if aliases.include?(new_alias)
|
35
|
-
io.log "Alias #{new_alias.
|
35
|
+
io.log "Alias #{new_alias.bright} already exists."
|
36
36
|
else
|
37
37
|
aliases << new_alias
|
38
38
|
save_aliases
|
39
39
|
|
40
|
-
io.log "Alias #{new_alias.
|
40
|
+
io.log "Alias #{new_alias.bright} added."
|
41
41
|
show
|
42
42
|
end
|
43
43
|
end
|
@@ -49,10 +49,10 @@ module Webbynode::Commands
|
|
49
49
|
aliases.delete to_remove
|
50
50
|
save_aliases
|
51
51
|
|
52
|
-
io.log "Alias #{to_remove.
|
52
|
+
io.log "Alias #{to_remove.bright} removed."
|
53
53
|
show
|
54
54
|
else
|
55
|
-
io.log "Alias #{to_remove.
|
55
|
+
io.log "Alias #{to_remove.bright} doesn't exist."
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'launchy'
|
2
2
|
|
3
3
|
module Webbynode::Commands
|
4
|
-
class
|
5
|
-
summary "Opens
|
4
|
+
class Docs < Webbynode::Command
|
5
|
+
summary "Opens Webbynode Documentation in your browser"
|
6
|
+
add_alias "guides"
|
6
7
|
|
7
8
|
def execute
|
8
9
|
Launchy.open "http://wbno.de/rapp"
|
@@ -5,7 +5,7 @@ module Webbynode::Commands
|
|
5
5
|
|
6
6
|
def execute
|
7
7
|
if param(:command) == "commands"
|
8
|
-
puts "usage: #{"webbynode".
|
8
|
+
puts "usage: #{"webbynode".bright} #{"COMMAND".bright}"
|
9
9
|
puts
|
10
10
|
puts "Available commands:"
|
11
11
|
dir = File.join(File.expand_path(File.dirname(__FILE__)), "/*.rb")
|
@@ -13,10 +13,10 @@ module Webbynode::Commands
|
|
13
13
|
command = file.split("/").last
|
14
14
|
command.gsub!(/\.rb/, "")
|
15
15
|
|
16
|
-
puts " #{command.ljust(15).
|
16
|
+
puts " #{command.ljust(15).bright} #{Webbynode::Command.class_for(command).setting(:summary)}"
|
17
17
|
end
|
18
18
|
puts
|
19
|
-
puts "Try '#{"webbynode help".
|
19
|
+
puts "Try '#{"webbynode help".bright} #{"COMMAND".bright}' for more information."
|
20
20
|
else
|
21
21
|
kls = Help.for(param(:command))
|
22
22
|
if kls
|