dokkufy 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -1
- data/README.md +2 -2
- data/bin/dokkufy +23 -1
- data/dokkufy.gemspec +2 -0
- data/lib/dokkufy/info.rb +2 -2
- data/lib/dokkufy/plugin.rb +50 -0
- data/lib/dokkufy/server.rb +6 -6
- data/lib/dokkufy.rb +1 -0
- data/scripts/install_plugin.sh +3 -0
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceb50dc113332ec5b965ad73c745b0e7753f7e3d
|
4
|
+
data.tar.gz: 41047fe98e3d4f7d3c92f90ff6ec3029cd62e4c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 169e372670a094818b49d502f759144e7337df7bcd1a0816c1fb335f12d1f3df1cee2b2524b36ce0e1ce457141f2d1ed6b6a4ad5c47491dc5769e33691458eb3
|
7
|
+
data.tar.gz: de1cb36a4a7921b847334bb97c44ac2592a19a772725fd1b8dfd2ea7e20466b3a423c38830fa98ab306eb5f6358fc01402c10783fb9812010de6796c4c547a6d
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dokkufy (0.0.
|
4
|
+
dokkufy (0.0.3)
|
5
5
|
commander
|
6
|
+
hpricot
|
7
|
+
terminal-table
|
6
8
|
|
7
9
|
GEM
|
8
10
|
remote: https://rubygems.org/
|
@@ -10,6 +12,8 @@ GEM
|
|
10
12
|
commander (4.2.0)
|
11
13
|
highline (~> 1.6.11)
|
12
14
|
highline (1.6.21)
|
15
|
+
hpricot (0.8.6)
|
16
|
+
terminal-table (1.4.5)
|
13
17
|
|
14
18
|
PLATFORMS
|
15
19
|
ruby
|
data/README.md
CHANGED
@@ -9,8 +9,8 @@ dokkufy <command>
|
|
9
9
|
help shows this list
|
10
10
|
server installs Dokku on a Ubuntu 12.04 or 14.04 server
|
11
11
|
server:upgrade upgrades a Dokku server
|
12
|
-
|
13
|
-
|
12
|
+
plugin shows a list of Dokku plugins
|
13
|
+
plugin:install installs a plugin on the server
|
14
14
|
app adds a dokku remote for a server to an app
|
15
15
|
|
16
16
|
dokku <command> runs dokku commands on the server attached to this app
|
data/bin/dokkufy
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'dokkufy'
|
3
3
|
require 'commander'
|
4
|
+
require 'terminal-table'
|
4
5
|
|
5
6
|
Commander.configure do
|
6
7
|
program :name, 'Dokkufy'
|
@@ -9,7 +10,7 @@ Commander.configure do
|
|
9
10
|
program :help, 'Author', 'Cristiano Betta <cbetta@gmail.com>'
|
10
11
|
|
11
12
|
command :'server' do |c|
|
12
|
-
c.syntax = 'dokkufy server <hostname> <username> <domain>'
|
13
|
+
c.syntax = 'dokkufy server [<hostname> <username> <domain>]'
|
13
14
|
c.description = "Installs Dokku on a Ubuntu 12.04 or 14.04 server"
|
14
15
|
c.option '--version', Float, 'Dokku version'
|
15
16
|
c.action do |args, options|
|
@@ -26,5 +27,26 @@ Commander.configure do
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
30
|
+
command :'plugin:list' do |c|
|
31
|
+
c.syntax = 'dokkufy plugin:list'
|
32
|
+
c.description = "Lists known Dokku plugins"
|
33
|
+
c.option('--with-notes'){ $with_notes = true }
|
34
|
+
c.action do |args, options|
|
35
|
+
plugins = Dokkufy::Plugin.all($with_notes)
|
36
|
+
puts Terminal::Table.new rows: plugins, headings: ["ID", "Name", "Description"]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
command :'plugin:install' do |c|
|
41
|
+
c.syntax = 'dokkufy plugin:install <plugin_name_or_id> [<hostname> <username>]'
|
42
|
+
c.description = "Installs a known Dokku plugin"
|
43
|
+
c.action do |args, options|
|
44
|
+
id_or_name = args[0] || ask('Plugin ID or Name: ')
|
45
|
+
hostname = args[1] || ask('Server hostname or IP: ')
|
46
|
+
username = args[2] || ask('Username on server: ')
|
47
|
+
Dokkufy::Plugin.new(hostname, username).install(id_or_name)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
29
51
|
default_command :help
|
30
52
|
end
|
data/dokkufy.gemspec
CHANGED
data/lib/dokkufy/info.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Dokkufy
|
2
|
-
VERSION = "0.0.
|
3
|
-
NAME = "dokkufy"
|
2
|
+
VERSION = "0.0.4" unless defined? Dokkufy::VERSION
|
3
|
+
NAME = "dokkufy" unless defined? Dokkufy::NAME
|
4
4
|
DESCRIPTION = "A Dokku toolchain" unless defined? Dokkufy::DESCRIPTION
|
5
5
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'hpricot'
|
3
|
+
|
4
|
+
module Dokkufy
|
5
|
+
class Plugin
|
6
|
+
|
7
|
+
attr_accessor :hostname, :username, :id
|
8
|
+
|
9
|
+
def initialize hostname, username
|
10
|
+
self.hostname = hostname
|
11
|
+
self.username = username
|
12
|
+
end
|
13
|
+
|
14
|
+
def install id_or_name
|
15
|
+
self.id = id_or_name
|
16
|
+
Dokkufy::Server.new(hostname, username).install_plugin(id)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.all with_notes = false
|
20
|
+
open("https://github.com/progrium/dokku/wiki/Plugins") do |f|
|
21
|
+
hp = Hpricot(f)
|
22
|
+
plugins = hp.search("tbody:first tr td").each_slice(3)
|
23
|
+
return plugins.each_with_index.map do |plugin, index|
|
24
|
+
entry = [index+1,
|
25
|
+
plugin.first.children.first.attributes["href"].split("github.com/").last,
|
26
|
+
plugin.first.children.first.inner_text]
|
27
|
+
entry << plugin.last.inner_text if with_notes
|
28
|
+
entry
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def id=(id_or_name)
|
36
|
+
if id_or_name.to_i.to_s == id_or_name
|
37
|
+
Dokkufy::Plugin.all.each do |plugin|
|
38
|
+
if plugin[0] == id_or_name.to_i
|
39
|
+
@id = plugin[1]
|
40
|
+
return
|
41
|
+
end
|
42
|
+
end
|
43
|
+
else
|
44
|
+
@id = id_or_name
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
data/lib/dokkufy/server.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
module Dokkufy
|
2
2
|
class Server
|
3
|
-
attr_accessor :
|
3
|
+
attr_accessor :hostname, :username
|
4
4
|
|
5
|
-
def initialize
|
6
|
-
self.
|
5
|
+
def initialize hostname, username
|
6
|
+
self.hostname = hostname
|
7
7
|
self.username = username
|
8
8
|
end
|
9
9
|
|
10
10
|
def setup_key
|
11
11
|
user = `echo $USER`
|
12
|
-
command = "cat ~/.ssh/id_rsa.pub | ssh #{username}@#{
|
12
|
+
command = "cat ~/.ssh/id_rsa.pub | ssh #{username}@#{hostname} 'sudo sshcommand acl-add dokku #{user}'"
|
13
13
|
system command
|
14
14
|
end
|
15
15
|
|
16
16
|
def method_missing(m, *args, &block)
|
17
17
|
method_name = m.to_s
|
18
18
|
filename = Dokkufy::Utils.script method_name
|
19
|
-
server = "#{username}@#{
|
19
|
+
server = "#{username}@#{hostname}"
|
20
20
|
`scp #{filename} #{server}:`
|
21
|
-
system("ssh -t
|
21
|
+
system("ssh -t #{server} 'OPTION=#{args.first} ./#{method_name}.sh'")
|
22
22
|
`ssh -t -q #{server} 'rm #{method_name}.sh'`
|
23
23
|
end
|
24
24
|
end
|
data/lib/dokkufy.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dokkufy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cristiano Betta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: terminal-table
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hpricot
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
27
55
|
description: A Dokku toolchain
|
28
56
|
email:
|
29
57
|
- cbetta@gmail.com
|
@@ -42,11 +70,13 @@ files:
|
|
42
70
|
- dokkufy.gemspec
|
43
71
|
- lib/dokkufy.rb
|
44
72
|
- lib/dokkufy/info.rb
|
73
|
+
- lib/dokkufy/plugin.rb
|
45
74
|
- lib/dokkufy/server.rb
|
46
75
|
- lib/dokkufy/utils.rb
|
47
76
|
- scripts/configure_vhost.sh
|
48
77
|
- scripts/ensure_passwordless_sudo.sh
|
49
78
|
- scripts/install_dokku.sh
|
79
|
+
- scripts/install_plugin.sh
|
50
80
|
homepage: http://github.com/cbetta/dokkufy
|
51
81
|
licenses:
|
52
82
|
- MIT
|