appd 0.6.0 → 0.6.1
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 +2 -0
- data/exe/appd +6 -1
- data/lib/appd/cli.rb +8 -1
- data/lib/appd/version.rb +1 -1
- data/lib/appd.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7157dd873827a3f1010c410bbefb4035038ea4d
|
4
|
+
data.tar.gz: 651ac243ffcc7b05b5639b37506a8fb820423fa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1e1d79b66dcce4c4ea4abc93e9a8f5839c991a39ffce4da7261ddaed5a6be6a0177663a253fbc523dfed7b79f6ffb411505aa87d2724dc50af9acf89afc5dba
|
7
|
+
data.tar.gz: cb0b688732b81bfcc79805eea7625cddcc0fa0639d7d5a087f03f89004c73d8653eb13edf3afd76d1bac566ab350aa497ef9a1021061918e99ab1aeb4e36e94e
|
data/README.md
CHANGED
@@ -42,6 +42,7 @@ Options:
|
|
42
42
|
|
43
43
|
Commands:
|
44
44
|
help # Show this help
|
45
|
+
select # Select a Docker Server ENV file to use
|
45
46
|
ps # List containers
|
46
47
|
build SERVICES # Build or rebuild services
|
47
48
|
up SERVICES # Create and start services
|
@@ -51,6 +52,7 @@ Commands:
|
|
51
52
|
|
52
53
|
Notes: Appd looks for apps in the $APPS_PATH directory.
|
53
54
|
APPNAME can be . for current app.
|
55
|
+
The currently selected Docker Server ENV file is stored in ~/.appd/current-server
|
54
56
|
```
|
55
57
|
|
56
58
|
## Docker Server ENV Files
|
data/exe/appd
CHANGED
@@ -6,7 +6,12 @@ Signal.trap("INT") { exit 1 }
|
|
6
6
|
require "appd"
|
7
7
|
require "appd/cli"
|
8
8
|
|
9
|
-
|
9
|
+
APPD_PATH = File.expand_path("~/.appd")
|
10
|
+
|
11
|
+
Dir.mkdir(APPD_PATH) if !File.directory?(APPD_PATH)
|
12
|
+
File.write("#{APPD_PATH}/current-server") if !File.file?("#{APPD_PATH}/current-server")
|
13
|
+
|
14
|
+
if ARGV[0] != "help" && ARGV[0] != "select" && app = ARGV.shift
|
10
15
|
if app == "."
|
11
16
|
ARGV << "-p"
|
12
17
|
ARGV << Dir.pwd
|
data/lib/appd/cli.rb
CHANGED
@@ -4,7 +4,8 @@ module Appd
|
|
4
4
|
class CLI < Thor
|
5
5
|
class_option :apps_path, type: :string, aliases: "-p", default: Appd.apps_path, desc: "Override $APPS_PATH"
|
6
6
|
class_option :app, type: :string, hide: true, aliases: "-a", required: ARGV.count > 0 &&
|
7
|
-
ARGV[0] !=
|
7
|
+
ARGV[0] != "help" &&
|
8
|
+
ARGV[0] != "select" &&
|
8
9
|
ARGV[0] != "."
|
9
10
|
class_option :file, type: :string, aliases: "-f", default: "docker-compose.yml", desc: "Specify a docker-compose.yml file relative to the app"
|
10
11
|
class_option :server, type: :string, aliases: "-s", desc: "Specify a docker server env file"
|
@@ -26,6 +27,12 @@ module Appd
|
|
26
27
|
self.class.commands.each { |_, command| printf "%-30s %s\n", " #{command.usage} ", "# #{command.description}" }
|
27
28
|
puts "\nNotes: Appd looks for apps in the $APPS_PATH directory."
|
28
29
|
puts " APPNAME can be . for current app."
|
30
|
+
puts " The currently selected Docker Server ENV file is stored in ~/.appd/current-server"
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "select", "Select a Docker Server ENV file to use"
|
34
|
+
def select(server)
|
35
|
+
Appd.select(server)
|
29
36
|
end
|
30
37
|
|
31
38
|
desc "ps", "List containers"
|
data/lib/appd/version.rb
CHANGED
data/lib/appd.rb
CHANGED
@@ -7,6 +7,16 @@ module Appd
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.exec(command, options)
|
10
|
-
super "
|
10
|
+
super "source ~/.appd/#{options.server ? options.server : "current-server"} && direnv exec #{options.apps_path}/#{options.app} #{command}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.select(server)
|
14
|
+
if File.file?("#{APPD_PATH}/#{server}")
|
15
|
+
print "Selecting the #{server} Docker Server ENV file..."
|
16
|
+
File.open("#{APPD_PATH}/current-server", "w") { |f| f.write("source ~/.appd/#{server}") }
|
17
|
+
puts "Done!"
|
18
|
+
else
|
19
|
+
puts "There is no Docker Server ENV file for #{server}..."
|
20
|
+
end
|
11
21
|
end
|
12
22
|
end
|