fig-newton 0.1.0 → 0.2.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: ba0039fab7f8e7d3e05e8d75f573e94fd62d305c
4
- data.tar.gz: 5daf640730b3f87ed823423e6c9e93c3fdb4a97b
3
+ metadata.gz: 7ae9477373aa0ae005aced6fa37f28154a753330
4
+ data.tar.gz: 8280262e74e41764692e56b7bb1b10c2e8613abe
5
5
  SHA512:
6
- metadata.gz: fa2eaa670b103495e3244e14c8eb6c24e59b7034a809884a168ffa4a28584758b6dce9bda6c3b9fcbd357f35304c5b9d6a013fba4eef81623a5efd9894aeb011
7
- data.tar.gz: 1c56d50071f76cee2b1597a3ed2422549549c8d8115365e612379160c89b419e0469026f813ae6ae5ba03d7eaf7d78c3af3c29a21120f2e4e31347aa6113dddc
6
+ metadata.gz: 42f9469977f06ec0f42ecfb0c74750bb52aa85bc77c83552bc7d9b27449c7535e5b52cccb7c9037c40bc93e24a85d2874fb20cadc77aaf16f6041819b87772a6
7
+ data.tar.gz: 32d0360aab28d3244f897cd18af45a63627970372736300d35a89e5a9f88f0cc7169923fbc8e966509b0b0368200e8769e10bb982ef8ffde4c585c78d001eeac
data/README.md CHANGED
@@ -33,3 +33,7 @@ Bring up all the applications defined for the given stack. Equivalent to running
33
33
  ### `down STACK_NAME`
34
34
 
35
35
  Bring down all the applications defined for the given stack. Equivalent to running `fig down` in each application directory.
36
+
37
+ ### `pull STACK_NAME`
38
+
39
+ Pull the latest code for all the repos defined for the given stack. Equivalent to running `git pull` in each application directory.
@@ -13,6 +13,13 @@ module FigNewton
13
13
  `git clone #{full_repo} #{clone_directory} &>/dev/null`
14
14
  end
15
15
 
16
+ def pull(parent_directory = ".")
17
+ source_directory = full_dir(parent_directory)
18
+
19
+ puts "-- Pulling latest upstream in '#{source_directory}'"
20
+ `cd #{source_directory} && git pull`
21
+ end
22
+
16
23
  def up(parent_directory)
17
24
  source_directory = full_dir(parent_directory)
18
25
 
@@ -50,5 +50,16 @@ module FigNewton
50
50
  command = FigNewton::Commands::Down.new(stack_name, options[:conf])
51
51
  command.run(options[:parent_directory])
52
52
  end
53
+
54
+ desc "pull STACK_NAME APP_NAME", "Pull the latest code for all (or one) of the repos defined for the given stack"
55
+ option :parent_directory, type: :string,
56
+ default: ".",
57
+ desc: "The parent directory of the cloned repositories",
58
+ aliases: ["p"]
59
+ def pull(stack_name, app = nil)
60
+ require "fig-newton/commands/pull"
61
+ command = FigNewton::Commands::Pull.new(stack_name, app, options[:conf])
62
+ command.run(options[:parent_directory])
63
+ end
53
64
  end
54
65
  end
@@ -1,4 +1,3 @@
1
- require "pp"
2
1
  require "fig-newton/config"
3
2
 
4
3
  module FigNewton
@@ -10,7 +9,7 @@ module FigNewton
10
9
  end
11
10
 
12
11
  def run(parent_directory)
13
- config.apps.each { |app| app.clone(parent_directory) }
12
+ config.apps.each { |_, app| app.clone(parent_directory) }
14
13
  end
15
14
 
16
15
  private
@@ -9,7 +9,7 @@ module FigNewton
9
9
  end
10
10
 
11
11
  def run(parent_directory)
12
- config.apps.each { |app| app.down(parent_directory) }
12
+ config.apps.each { |_, app| app.down(parent_directory) }
13
13
  end
14
14
 
15
15
  private
@@ -0,0 +1,25 @@
1
+ require "fig-newton/config"
2
+
3
+ module FigNewton
4
+ module Commands
5
+ class Pull
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].pull(parent_directory)
15
+ else
16
+ config.apps.each { |_, app| app.pull(parent_directory) }
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ attr_accessor :config, :stack_name
23
+ end
24
+ end
25
+ end
@@ -9,7 +9,7 @@ module FigNewton
9
9
  end
10
10
 
11
11
  def run(parent_directory)
12
- config.apps.each { |app| app.up(parent_directory) }
12
+ config.apps.each { |_, app| app.up(parent_directory) }
13
13
  end
14
14
 
15
15
  private
@@ -24,8 +24,10 @@ module FigNewton
24
24
  end
25
25
 
26
26
  def apps
27
- @apps ||= data["apps"].map do |name, config|
28
- FigNewton::App.new(name, config)
27
+ @apps ||= data["apps"].each_with_object({}) do |app, apps|
28
+ name, config = app.flatten
29
+ apps[name] = FigNewton::App.new(name, config)
30
+ apps
29
31
  end
30
32
  end
31
33
 
@@ -1,3 +1,3 @@
1
1
  module FigNewton
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.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.1.0
4
+ version: 0.2.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-02-04 00:00:00.000000000 Z
11
+ date: 2015-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -73,6 +73,7 @@ files:
73
73
  - lib/fig-newton/commands/clone.rb
74
74
  - lib/fig-newton/commands/down.rb
75
75
  - lib/fig-newton/commands/init.rb
76
+ - lib/fig-newton/commands/pull.rb
76
77
  - lib/fig-newton/commands/up.rb
77
78
  - lib/fig-newton/config.rb
78
79
  - lib/fig-newton/version.rb