fig-newton 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fig-newton/app.rb +9 -0
- data/lib/fig-newton/cli.rb +12 -1
- data/lib/fig-newton/commands/clean.rb +25 -0
- data/lib/fig-newton/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b5a41dc06f75c9fb6399e765b55bb0f10112bac
|
4
|
+
data.tar.gz: ab72bec5b02e6d0dc0572a7e3056b8c721136c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7b265e993ddbff08f1ef6b710e0319d630b9111fa3f0f7302592dd9911cfc7353c0110d077f190523a124a07e7c3897d885d23ba63e65628344d681e6012da7
|
7
|
+
data.tar.gz: 529837261c693b3edddf5daed09189cce65868d1eaa0ec4fc5336f5a6dbd6d29f31fab7b3fbdb270f82e7a2510b038162759fd0803c1cea1d8aa541e33c16a45
|
data/lib/fig-newton/app.rb
CHANGED
@@ -20,6 +20,15 @@ module FigNewton
|
|
20
20
|
`cd #{source_directory} && git pull`
|
21
21
|
end
|
22
22
|
|
23
|
+
def clean(parent_directory = ".")
|
24
|
+
source_directory = full_dir(parent_directory)
|
25
|
+
|
26
|
+
down(parent_directory)
|
27
|
+
|
28
|
+
puts "-- Cleaning killed containers in '#{source_directory}'"
|
29
|
+
`cd #{source_directory} && fig rm --force`
|
30
|
+
end
|
31
|
+
|
23
32
|
def up(parent_directory)
|
24
33
|
source_directory = full_dir(parent_directory)
|
25
34
|
|
data/lib/fig-newton/cli.rb
CHANGED
@@ -11,7 +11,7 @@ module FigNewton
|
|
11
11
|
option :force, type: :boolean,
|
12
12
|
default: false,
|
13
13
|
desc: "Overwrite file if it already exists",
|
14
|
-
|
14
|
+
aliases: ["f"]
|
15
15
|
def init(stack_name)
|
16
16
|
require "fig-newton/commands/init"
|
17
17
|
command = FigNewton::Commands::Init.new(stack_name, options[:conf])
|
@@ -61,5 +61,16 @@ module FigNewton
|
|
61
61
|
command = FigNewton::Commands::Pull.new(stack_name, app, options[:conf])
|
62
62
|
command.run(options[:parent_directory])
|
63
63
|
end
|
64
|
+
|
65
|
+
desc "clean STACK_NAME APP_NAME", "Bring down all (or one) of the applications defined for the given stack. Equivalent to running fig rm in each application directory."
|
66
|
+
option :parent_directory, type: :string,
|
67
|
+
default: ".",
|
68
|
+
desc: "The parent directory of the cloned repositories",
|
69
|
+
aliases: ["p"]
|
70
|
+
def clean(stack_name, app = nil)
|
71
|
+
require "fig-newton/commands/clean"
|
72
|
+
command = FigNewton::Commands::Clean.new(stack_name, app, options[:conf])
|
73
|
+
command.run(options[:parent_directory])
|
74
|
+
end
|
64
75
|
end
|
65
76
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "fig-newton/config"
|
2
|
+
|
3
|
+
module FigNewton
|
4
|
+
module Commands
|
5
|
+
class Clean
|
6
|
+
def initialize(stack_name, app, config_dir)
|
7
|
+
@stack_name = stack_name
|
8
|
+
@app = app
|
9
|
+
@config = FigNewton::Config.from_file(File.join(config_dir, @stack_name))
|
10
|
+
end
|
11
|
+
|
12
|
+
def run(parent_directory)
|
13
|
+
if @app
|
14
|
+
config.apps[@app].clean(parent_directory)
|
15
|
+
else
|
16
|
+
config.apps.each { |_, app| app.clean(parent_directory) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_accessor :config, :stack_name
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/fig-newton/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fig-newton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Dunn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- lib/fig-newton.rb
|
71
71
|
- lib/fig-newton/app.rb
|
72
72
|
- lib/fig-newton/cli.rb
|
73
|
+
- lib/fig-newton/commands/clean.rb
|
73
74
|
- lib/fig-newton/commands/clone.rb
|
74
75
|
- lib/fig-newton/commands/down.rb
|
75
76
|
- lib/fig-newton/commands/init.rb
|