dokkufy 0.0.6 → 0.0.7
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 +4 -4
- data/README.md +19 -1
- data/bin/dokkufy +27 -0
- data/lib/dokkufy/app.rb +28 -0
- data/lib/dokkufy/git.rb +51 -0
- data/lib/dokkufy/info.rb +1 -1
- data/lib/dokkufy.rb +6 -4
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04789fa5bbd4f59f47a969ef3a5ddb13a64c221b
|
4
|
+
data.tar.gz: 961bff96b825c09fdcd7cbef8b022cbe6b32bf0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13dcbb9bd528df50311a78f217aafde4febcf5c337df9c0de1e9aa832edebfdfdbfd71d7b97b86cd07b072d420ccf23f7bcd7f8582f4aabb20ff5cfbcb184176
|
7
|
+
data.tar.gz: 0902c6fc1876b6614362d005b29c7126963b3334297198abe55b3f62a577c5493f6e0c4b855057548888a0e81346bcac37cd031194019e0bd4a75ec121d5879e
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ A [Dokku](https://github.com/progrium/dokku) toolbelt inspired by the [Heroku to
|
|
4
4
|
|
5
5
|
## Planned commands
|
6
6
|
|
7
|
-
```
|
7
|
+
```
|
8
8
|
dokkufy <command>
|
9
9
|
help shows this list
|
10
10
|
server installs Dokku on a Ubuntu 12.04 or 14.04 server
|
@@ -13,6 +13,7 @@ dokkufy <command>
|
|
13
13
|
plugin:install installs a plugin on the server
|
14
14
|
plugin:uninstall uninstalls a plugin on the server
|
15
15
|
app adds a dokku remote for a server to an app
|
16
|
+
app:clear removes a dokku remote for a server for an app
|
16
17
|
|
17
18
|
dokku <command> runs dokku commands on the server attached to this app
|
18
19
|
```
|
@@ -57,8 +58,25 @@ dokkufy plugin:uninstall <plugin_name_or_id> [<hostname> <username>]
|
|
57
58
|
|
58
59
|
Uninstalls a Dokku plugin either by name or ID (as received by `dokkufy plugin:list`) on a server. Simply performs a delete of the folder. Server instances already deployed with this plugin will need to be redeployed.
|
59
60
|
|
61
|
+
### dokkufy app
|
62
|
+
|
63
|
+
```sh
|
64
|
+
dokkufy app <git_repo> [OR <hostname> <dokku_username>]
|
65
|
+
```
|
66
|
+
|
67
|
+
Adds a dokku remote to the local git repository for an app. Also writes this remote to a `.dokkurc` file.
|
68
|
+
|
69
|
+
### dokkufy app:clear
|
70
|
+
|
71
|
+
```sh
|
72
|
+
dokkufy app:clear
|
73
|
+
```
|
74
|
+
|
75
|
+
Removes any `dokku` remotes for the local git repository and deletes the `.dokkurc` file.
|
76
|
+
|
60
77
|
## Release notes
|
61
78
|
|
79
|
+
* **0.0.7** Adds the (un)dokkufication of apps
|
62
80
|
* **0.0.6** Adds plugin uninstall
|
63
81
|
* **0.0.5** Small bug fix to plugin installs
|
64
82
|
* **0.0.4** Adds plugin listing and installing
|
data/bin/dokkufy
CHANGED
@@ -55,5 +55,32 @@ Commander.configure do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
command :'app' do |c|
|
59
|
+
c.syntax = 'dokkufy app <git_repo> [OR <hostname> <dokku_username>]'
|
60
|
+
c.description = "Binds this app to a Dokku instance through git and a config file"
|
61
|
+
c.action do |args, options|
|
62
|
+
if args.empty?
|
63
|
+
git = Dokkufy::Git.new
|
64
|
+
if git.dokku_remote_present?
|
65
|
+
args = [git.dokku_remote]
|
66
|
+
else
|
67
|
+
hostname = ask('Server hostname or IP: ')
|
68
|
+
username = ask('Dokku username on server [dokku]: ')
|
69
|
+
username = "dokku" if username.strip == ""
|
70
|
+
args = [hostname, username]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
Dokkufy::App.new(args).dokkufy
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
command :'app:clear' do |c|
|
78
|
+
c.syntax = 'dokkufy app:clear'
|
79
|
+
c.description = "Undokkufies this app"
|
80
|
+
c.action do |args, options|
|
81
|
+
Dokkufy::Git.new.clear
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
58
85
|
default_command :help
|
59
86
|
end
|
data/lib/dokkufy/app.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Dokkufy
|
2
|
+
class App
|
3
|
+
|
4
|
+
attr_accessor :hostname, :username, :repo, :app_name
|
5
|
+
|
6
|
+
def initialize args
|
7
|
+
if args.length == 1
|
8
|
+
self.repo = args.first
|
9
|
+
self.username = args.first.split("@").first
|
10
|
+
self.hostname = args.first.split("@").last.split(":").first
|
11
|
+
self.app_name = args.first.split("@").last.split(":").last
|
12
|
+
elsif args.length == 2
|
13
|
+
self.hostname = args.first
|
14
|
+
self.username = args.last
|
15
|
+
self.app_name = File.basename(Dir.getwd)
|
16
|
+
self.repo = "#{username}@#{hostname}:#{app_name}"
|
17
|
+
else
|
18
|
+
raise ArgumentError("Invalid number of arguments")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def dokkufy
|
23
|
+
puts "Using #{repo}"
|
24
|
+
Dokkufy::Git.new.dokku_remote = repo
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/lib/dokkufy/git.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
module Dokkufy
|
2
|
+
class Git
|
3
|
+
|
4
|
+
def dokku_remote_present?
|
5
|
+
!dokku_remote.nil?
|
6
|
+
end
|
7
|
+
|
8
|
+
def dokku_remote
|
9
|
+
@dokku_remote ||= git_remote || dokkufile_remote
|
10
|
+
end
|
11
|
+
|
12
|
+
def dokku_remote=(remote)
|
13
|
+
@dokku_remote = remote
|
14
|
+
set_git_remote
|
15
|
+
set_dokkufile_remote
|
16
|
+
end
|
17
|
+
|
18
|
+
def clear
|
19
|
+
`rm .dokkurc`
|
20
|
+
`git remote remove dokku`
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def git_remote
|
26
|
+
output = `git remote -v`
|
27
|
+
output.lines.each do |line|
|
28
|
+
return line.split(" ")[1] if line.include?("dokku@")
|
29
|
+
end
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def dokkufile_remote
|
34
|
+
output = File.open(".dokkurc").read
|
35
|
+
return output.strip unless output.empty?
|
36
|
+
rescue
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def set_git_remote
|
41
|
+
puts "Setting git remote"
|
42
|
+
`git remote add dokku #{@dokku_remote}`
|
43
|
+
end
|
44
|
+
|
45
|
+
def set_dokkufile_remote
|
46
|
+
puts "Writing .dokkurc"
|
47
|
+
`echo #{@dokku_remote} > .dokkurc`
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
data/lib/dokkufy/info.rb
CHANGED
data/lib/dokkufy.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'dokkufy/info'
|
2
|
+
require 'dokkufy/utils'
|
3
|
+
require 'dokkufy/server'
|
4
|
+
require 'dokkufy/plugin'
|
5
|
+
require 'dokkufy/app'
|
6
|
+
require 'dokkufy/git'
|
5
7
|
|
6
8
|
module Dokkufy
|
7
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cristiano Betta
|
@@ -69,6 +69,8 @@ files:
|
|
69
69
|
- bin/dokkufy
|
70
70
|
- dokkufy.gemspec
|
71
71
|
- lib/dokkufy.rb
|
72
|
+
- lib/dokkufy/app.rb
|
73
|
+
- lib/dokkufy/git.rb
|
72
74
|
- lib/dokkufy/info.rb
|
73
75
|
- lib/dokkufy/plugin.rb
|
74
76
|
- lib/dokkufy/server.rb
|