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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5963e0ac1ab04a116cf9b5811892b9119573201
4
- data.tar.gz: c4c0f266776a42a515a6dc03db4b900b12609f16
3
+ metadata.gz: b7157dd873827a3f1010c410bbefb4035038ea4d
4
+ data.tar.gz: 651ac243ffcc7b05b5639b37506a8fb820423fa6
5
5
  SHA512:
6
- metadata.gz: dcbcd3ce458e1040d885948fa14b8e535d01080f0b7cf951d380ebfd81bf51aaa0a2a6c5aa634da00da3844884d681706b11ab8543a91f6d00fee0410cfd96ba
7
- data.tar.gz: 1e740550d3bf6a48a1dcff84112789cec7760fa921de0d9ef922e0078b5205d378988367f1345e81668524f17e3d835b53e11d1506bbbdf3e50afc42b28af1a4
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
- if ARGV[0] != "help" && app = ARGV.shift
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] != 'help' &&
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
@@ -1,3 +1,3 @@
1
1
  module Appd
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
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 "#{"source ~/.appd/#{options.server} && " if options.server}direnv exec #{options.apps_path}/#{options.app} #{command}"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morgan Showman