fig-newton 0.2.0 → 0.3.0

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: 7ae9477373aa0ae005aced6fa37f28154a753330
4
- data.tar.gz: 8280262e74e41764692e56b7bb1b10c2e8613abe
3
+ metadata.gz: 4b5a41dc06f75c9fb6399e765b55bb0f10112bac
4
+ data.tar.gz: ab72bec5b02e6d0dc0572a7e3056b8c721136c64
5
5
  SHA512:
6
- metadata.gz: 42f9469977f06ec0f42ecfb0c74750bb52aa85bc77c83552bc7d9b27449c7535e5b52cccb7c9037c40bc93e24a85d2874fb20cadc77aaf16f6041819b87772a6
7
- data.tar.gz: 32d0360aab28d3244f897cd18af45a63627970372736300d35a89e5a9f88f0cc7169923fbc8e966509b0b0368200e8769e10bb982ef8ffde4c585c78d001eeac
6
+ metadata.gz: b7b265e993ddbff08f1ef6b710e0319d630b9111fa3f0f7302592dd9911cfc7353c0110d077f190523a124a07e7c3897d885d23ba63e65628344d681e6012da7
7
+ data.tar.gz: 529837261c693b3edddf5daed09189cce65868d1eaa0ec4fc5336f5a6dbd6d29f31fab7b3fbdb270f82e7a2510b038162759fd0803c1cea1d8aa541e33c16a45
@@ -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
 
@@ -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
- aliaes: ["f"]
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
@@ -1,3 +1,3 @@
1
1
  module FigNewton
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.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-10 00:00:00.000000000 Z
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