dokkufy 0.0.4 → 0.0.5

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: ceb50dc113332ec5b965ad73c745b0e7753f7e3d
4
- data.tar.gz: 41047fe98e3d4f7d3c92f90ff6ec3029cd62e4c0
3
+ metadata.gz: 105fbfc0e0dc47918f360cdb2ca51e71f16477ac
4
+ data.tar.gz: db0cc58a072c41305e876deac01f7e357669baaa
5
5
  SHA512:
6
- metadata.gz: 169e372670a094818b49d502f759144e7337df7bcd1a0816c1fb335f12d1f3df1cee2b2524b36ce0e1ce457141f2d1ed6b6a4ad5c47491dc5769e33691458eb3
7
- data.tar.gz: de1cb36a4a7921b847334bb97c44ac2592a19a772725fd1b8dfd2ea7e20466b3a423c38830fa98ab306eb5f6358fc01402c10783fb9812010de6796c4c547a6d
6
+ metadata.gz: 21d64a72135fdef4fd796e32ae00440f399be509ce55ec60980824d51b564102e20cdb3c2f27cc570615a29722c5a4932018f499466b173141ff3b44e7eb6d3f
7
+ data.tar.gz: f724b939f2b53f712062e0d8e5c4b5ba5b0995f8197193bd4946799d4756a16be4b9d99c2782d3e2d60000ef23f9bcc0175348050259db5ed0da370e5c8fabc5
data/README.md CHANGED
@@ -9,8 +9,9 @@ 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
- plugin shows a list of Dokku plugins
12
+ plugin:list shows a list of Dokku plugins
13
13
  plugin:install installs a plugin on the server
14
+ plugin:uninstall uninstalls a plugin on the server
14
15
  app adds a dokku remote for a server to an app
15
16
 
16
17
  dokku <command> runs dokku commands on the server attached to this app
@@ -18,19 +19,40 @@ dokku <command> runs dokku commands on the server attached to this app
18
19
 
19
20
  ## Implemented commands
20
21
 
22
+ Most commands take their parameters as command line arguments or through an interactive prompt.
23
+
21
24
  ### dokkufy server
22
25
 
23
26
  ```sh
24
27
  dokkufy server <hostname> <username> <domain> --version <version>
25
28
  ```
26
29
 
27
- Installs dokku on server at IP or Hostname `<hostname>`, using the `<username>` account to install the software.
30
+ Installs Dokku on server at IP or Hostname `<hostname>`, using the `<username>` account to install the software.
28
31
 
29
32
  It also sets up the app on domain `<domain>`, resulting in all apps being served as a subdomain of that domain.
30
33
 
31
34
  Optionally this takes a `<version>` to specify the [Dokku tag](https://github.com/progrium/dokku/tags).
35
+
36
+ ### dokkufy plugin:list
37
+
38
+ ```sh
39
+ dokkufy plugin:list
40
+ ```
41
+
42
+ Lists all plugins as listed on the [Dokku wiki](https://github.com/progrium/dokku/wiki/Plugins). Only supports plugins that follow the standard install procedure.
43
+
44
+ ### dokkufy plugin:install
45
+
46
+ ```sh
47
+ dokkufy plugin:install <plugin_name_or_id> [<hostname> <username>]
48
+ ```
49
+
50
+ Installs a Dokku plugin either by name or ID (as received by `dokkufy plugin:list`) on a server. Only supports the standard install procedure. Check the plugins wiki for any additional install notes.
51
+
32
52
  ## Release notes
33
53
 
54
+ * **0.0.5** Small bug fix to plugin installs
55
+ * **0.0.4** Adds plugin listing and installing
34
56
  * **0.0.3** Determines latest version from Dokku github page
35
57
  * **0.0.2** Added `server` command
36
58
  * **0.0.1** Gem skeleton
data/bin/dokkufy CHANGED
@@ -20,10 +20,7 @@ Commander.configure do
20
20
  version = options.version.nil? ? Dokkufy::Utils.stable_version : "v#{options.version}"
21
21
 
22
22
  server = Dokkufy::Server.new(hostname, username)
23
- server.ensure_passwordless_sudo
24
- server.install_dokku(version)
25
- server.configure_vhost(domain)
26
- server.setup_key
23
+ server.dokkufy(version, domain)
27
24
  end
28
25
  end
29
26
 
@@ -32,8 +29,7 @@ Commander.configure do
32
29
  c.description = "Lists known Dokku plugins"
33
30
  c.option('--with-notes'){ $with_notes = true }
34
31
  c.action do |args, options|
35
- plugins = Dokkufy::Plugin.all($with_notes)
36
- puts Terminal::Table.new rows: plugins, headings: ["ID", "Name", "Description"]
32
+ puts Terminal::Table.new rows: Dokkufy::Plugin.all($with_notes), headings: ["ID", "Name", "Description"]
37
33
  end
38
34
  end
39
35
 
data/lib/dokkufy/info.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dokkufy
2
- VERSION = "0.0.4" unless defined? Dokkufy::VERSION
2
+ VERSION = "0.0.5" unless defined? Dokkufy::VERSION
3
3
  NAME = "dokkufy" unless defined? Dokkufy::NAME
4
4
  DESCRIPTION = "A Dokku toolchain" unless defined? Dokkufy::DESCRIPTION
5
5
  end
@@ -4,7 +4,7 @@ require 'hpricot'
4
4
  module Dokkufy
5
5
  class Plugin
6
6
 
7
- attr_accessor :hostname, :username, :id
7
+ attr_accessor :hostname, :username, :path
8
8
 
9
9
  def initialize hostname, username
10
10
  self.hostname = hostname
@@ -12,18 +12,20 @@ module Dokkufy
12
12
  end
13
13
 
14
14
  def install id_or_name
15
- self.id = id_or_name
16
- Dokkufy::Server.new(hostname, username).install_plugin(id)
15
+ self.path = id_or_name
16
+ Dokkufy::Server.new(hostname, username).install_plugin(path, name)
17
17
  end
18
18
 
19
19
  def self.all with_notes = false
20
+ return @plugins if @plugins
20
21
  open("https://github.com/progrium/dokku/wiki/Plugins") do |f|
21
22
  hp = Hpricot(f)
22
- plugins = hp.search("tbody:first tr td").each_slice(3)
23
- return plugins.each_with_index.map do |plugin, index|
23
+ plugins = hp.search("tbody tr td").each_slice(3)
24
+ @plugins = plugins.each_with_index.map do |plugin, index|
25
+ first_element = plugin.first.children.reject{|e| e.inner_text.strip == ""}.first
24
26
  entry = [index+1,
25
- plugin.first.children.first.attributes["href"].split("github.com/").last,
26
- plugin.first.children.first.inner_text]
27
+ first_element.attributes["href"].split("github.com/").last,
28
+ first_element.inner_text]
27
29
  entry << plugin.last.inner_text if with_notes
28
30
  entry
29
31
  end
@@ -32,11 +34,11 @@ module Dokkufy
32
34
 
33
35
  private
34
36
 
35
- def id=(id_or_name)
37
+ def path=(id_or_name)
36
38
  if id_or_name.to_i.to_s == id_or_name
37
39
  Dokkufy::Plugin.all.each do |plugin|
38
40
  if plugin[0] == id_or_name.to_i
39
- @id = plugin[1]
41
+ @path = plugin[1]
40
42
  return
41
43
  end
42
44
  end
@@ -45,6 +47,14 @@ module Dokkufy
45
47
  end
46
48
  end
47
49
 
50
+ def name
51
+ Dokkufy::Plugin.all.each do |plugin|
52
+ if plugin[1] == path
53
+ return plugin[2].split(" ").first.downcase
54
+ end
55
+ end
56
+ end
57
+
48
58
 
49
59
  end
50
60
  end
@@ -7,6 +7,13 @@ module Dokkufy
7
7
  self.username = username
8
8
  end
9
9
 
10
+ def dokkufy(version, domain)
11
+ ensure_passwordless_sudo
12
+ install_dokku(version)
13
+ configure_vhost(domain)
14
+ setup_key
15
+ end
16
+
10
17
  def setup_key
11
18
  user = `echo $USER`
12
19
  command = "cat ~/.ssh/id_rsa.pub | ssh #{username}@#{hostname} 'sudo sshcommand acl-add dokku #{user}'"
@@ -18,8 +25,8 @@ module Dokkufy
18
25
  filename = Dokkufy::Utils.script method_name
19
26
  server = "#{username}@#{hostname}"
20
27
  `scp #{filename} #{server}:`
21
- system("ssh -t #{server} 'OPTION=#{args.first} ./#{method_name}.sh'")
22
- `ssh -t -q #{server} 'rm #{method_name}.sh'`
28
+ system("ssh -t #{server} 'OPTION1=#{args[0]} OPTION2=#{args[1]} ./#{method_name}.sh'")
29
+ `ssh -t -q #{server} 'rm ~/#{method_name}.sh'`
23
30
  end
24
31
  end
25
32
  end
@@ -1 +1 @@
1
- sudo bash -c "echo $OPTION > /home/dokku/VHOST"
1
+ sudo bash -c "echo $OPTION1 > /home/dokku/VHOST"
@@ -6,4 +6,4 @@ if [ "$VERSION" == "$OLD_VERSION" ]; then
6
6
  sudo apt-get install -y python-software-properties
7
7
  fi
8
8
 
9
- wget -qO- https://raw.github.com/progrium/dokku/$OPTION/bootstrap.sh | sudo DOKKU_TAG=v0.2.3 bash
9
+ wget -qO- https://raw.github.com/progrium/dokku/$OPTION1/bootstrap.sh | sudo DOKKU_TAG=v0.2.3 bash
@@ -1,3 +1,3 @@
1
1
  cd /var/lib/dokku/plugins
2
- sudo git clone https://github.com/$OPTION
2
+ sudo git clone https://github.com/$OPTION1 $OPTION2
3
3
  sudo dokku plugins-install
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
4
+ version: 0.0.5
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-03 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander