appd 0.4.4 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c70cdc12650f1797a37f766edbf19dbfbe415416
4
- data.tar.gz: 850737f8f46f4593dcf3c3a80ee185089e066948
3
+ metadata.gz: dfde514840abf3ced575c0a6e2f6cb3470150290
4
+ data.tar.gz: 87e2bdf442b99a9465a0f2a69d64ec051db10698
5
5
  SHA512:
6
- metadata.gz: 74b3e36f40681ed700a34546b260e8719e7418ac3c477b6a2d7846fdcbbfe75fd41054bac1b75a3eec6193d09124891ae3794db8bf2dd350dc565905edae92a5
7
- data.tar.gz: ee4030a341a16c36059c04da9d161cd40eac21b36e7c9cb0389067e8f259a5c5859928a5801e47e7464a61e6c1c59a2bf5b06fc85ea17ef1c92b8f72a87b797b
6
+ metadata.gz: 2fcc059df173e05c84f6ce6a2f1aab340a209377ada1c3a151b9d8f3702b2b0855faa91483cdaa6c2977503d58e7c4de677b34f260ccd01ee942d7d18f54d080
7
+ data.tar.gz: 149efeb8e3d49db78c5ea70c247254adf435104eaed5a0d335656ad95c292d07eb713c803d565f5673d4282cb5c6ec4a18102c3154d66c6b19d323df316b1c4b
data/README.md CHANGED
@@ -32,7 +32,13 @@ export APP_PATH /path/to/your/apps
32
32
  # See help
33
33
  appd help
34
34
  Usage:
35
- appd APPNAME command
35
+ appd APPNAME command [OPTIONS]
36
+
37
+ Options:
38
+ -p # Override $APP_PATH
39
+ -f # Specify a docker-compose.yml file relative to the app
40
+ # (defaults to: "docker-compose.yml")
41
+ -s # Specify a docker server env file
36
42
 
37
43
  Commands:
38
44
  help # Show this help
@@ -43,8 +49,47 @@ Commands:
43
49
  restart SERVICES # Restart services
44
50
  exec SERVICE -c "COMMAND" # Execute a command in a running container
45
51
 
46
- Note: appd looks for apps in the $APP_PATH directory.
47
- APPNAME can be . for current app.
52
+ Notes: Appd looks for apps in the $APP_PATH directory.
53
+ APPNAME can be . for current app.
54
+ ```
55
+
56
+ ## Docker Server ENV Files
57
+ Docker server env files are stored in `~/.appd/` and these files setup
58
+ the current environment with the correct environment variables for
59
+ connecting to docker. You can either specify the variables manually or
60
+ execute the appropriate docker-machine command.
61
+
62
+ ### Manual ENV
63
+
64
+ Usage:
65
+
66
+ ```sh
67
+ appd my-app ps -s manual
68
+ ```
69
+
70
+ ENV file:
71
+
72
+ ```sh
73
+ # ~/.appd/manual
74
+ export DOCKER_TLS_VERIFY="1"
75
+ export DOCKER_HOST="tcp://127.0.0.1:2376"
76
+ export DOCKER_CERT_PATH="/your/path/to/cert"
77
+ unset DOCKER_MACHINE_NAME
78
+ ```
79
+
80
+ ### Docker Machine ENV
81
+
82
+ Usage:
83
+
84
+ ```sh
85
+ appd my-app ps -s docker-machine
86
+ ```
87
+
88
+ ENV file:
89
+
90
+ ```sh
91
+ # ~/.appd/docker-machine
92
+ eval "$(docker-machine env my-docker-machine)"
48
93
  ```
49
94
 
50
95
  ## Development
data/lib/appd/app.rb CHANGED
@@ -37,7 +37,7 @@ module Appd
37
37
  end
38
38
 
39
39
  def docker_compose(command)
40
- Appd.exec "direnv exec #{app_path} docker-compose -f #{app_path}/docker-compose.yml #{command}"
40
+ Appd.exec "direnv exec #{app_path} docker-compose -f #{app_path}/#{options.file} #{command}", server: options.server
41
41
  end
42
42
  end
43
43
  end
data/lib/appd/cli.rb CHANGED
@@ -2,21 +2,30 @@ require "thor"
2
2
 
3
3
  module Appd
4
4
  class CLI < Thor
5
- class_option :app_path, type: :string, hide: true
6
- class_option :app, type: :string, hide: true, required: ARGV.count > 0 &&
7
- ARGV[0] != 'help' &&
8
- ARGV[0] != "."
5
+ class_option :app_path, type: :string, aliases: "-p", desc: "Override $APP_PATH"
6
+ class_option :app, type: :string, hide: true, aliases: "-a", required: ARGV.count > 0 &&
7
+ ARGV[0] != 'help' &&
8
+ ARGV[0] != "."
9
+ class_option :file, type: :string, aliases: "-f", default: "docker-compose.yml", desc: "Specify a docker-compose.yml file relative to the app"
10
+ class_option :server, type: :string, aliases: "-s", desc: "Specify a docker server env file"
9
11
 
10
12
  default_task :help
11
13
 
12
14
  desc "help", "Show this help"
13
15
  def help
14
16
  puts "Usage:"
15
- puts " appd APPNAME command\n\n"
16
- puts "Commands:"
17
+ puts " appd APPNAME command [OPTIONS]\n\n"
18
+ puts "Options:"
19
+ self.class.class_options.each do |_, option|
20
+ if !option.hide
21
+ printf "%-30s %s\n", " #{option.aliases.join(", ")} ", "# #{option.description}"
22
+ printf "%-30s %s\n", "", "# (defaults to: \"#{option.default}\")" if option.default
23
+ end
24
+ end
25
+ puts "\nCommands:"
17
26
  self.class.commands.each { |_, command| printf "%-30s %s\n", " #{command.usage} ", "# #{command.description}" }
18
- puts "\nNote: appd looks for apps in the $APP_PATH directory."
19
- puts " APPNAME can be . for current app."
27
+ puts "\nNotes: Appd looks for apps in the $APP_PATH directory."
28
+ puts " APPNAME can be . for current app."
20
29
  end
21
30
 
22
31
  desc "ps", "List containers"
data/lib/appd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Appd
2
- VERSION = "0.4.4"
2
+ VERSION = "0.5.1"
3
3
  end
data/lib/appd.rb CHANGED
@@ -2,7 +2,7 @@ require "appd/app"
2
2
  require "appd/version"
3
3
 
4
4
  module Appd
5
- def self.exec(command)
6
- super command
5
+ def self.exec(command, **options)
6
+ super "#{"source ~/.appd/#{options[:server]} && " if options[:server]}#{command}"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morgan Showman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-17 00:00:00.000000000 Z
11
+ date: 2016-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler