guard-fig 0.1.0 → 0.1.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: d0a4fe257731ce9ad294f6c49f64c52ce6be27a3
4
- data.tar.gz: 50a05466bec28bdfe6292805aa58c869d4483307
3
+ metadata.gz: 8e0d8d4cd57bd9d17d16d9a5515e915a6980b259
4
+ data.tar.gz: 3896bc65175f47a9f021339b46045d608e7543d2
5
5
  SHA512:
6
- metadata.gz: 7ba02a53aa3793766099f2390eb848ca31469e64fabfd5842b6c96f4a9a68ad0221d99a5f824960d4164f5df0bc184ee114fec6cbcf5467bca59dc205e008cf9
7
- data.tar.gz: 62137cafec167091f124504d6d21f96a0d35ad387ed741802ca1323af9217308075437742c2fade508bcb0b25debb8eef33c04c6d153ce26160c207dbbc52fd3
6
+ metadata.gz: 95cc9bd82c7c0c092f62da009b6a929c0a2d2bc471752a5c20c5962156ab839ff434a1be965c20439ffcb3179f39eddd34e0ce0eb5b263fc8a01bde2c49f4bb3
7
+ data.tar.gz: fb7cf89a555213779480d4d2aedef2d6c6ae0b2b641120b70e4b23872d821aaa78665ebdea8cb46db215ecf0fb1a04cf5f21ccf4245533bdc94607a2873c93ab
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Guard::Fig
2
2
 
3
- Guard::Fig helps you develop docker containers faster using [fig](http://fig.sh/)
3
+ Guard::Fig helps you develop docker containers faster using [fig](http://fig.sh/) and [docker-compose](https://github.com/docker/compose)
4
4
 
5
5
  ## Installation
6
6
 
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
  Add the following to your Guardfile
24
24
 
25
25
  ```
26
- guard :fig, boot2docker_start: true, build_on_start: true do
26
+ guard :fig, boot2docker_start: true, build_on_start: true, command: 'fig' do
27
27
  ignore %r{\.#}
28
28
  watch %r{.*}
29
29
  end
@@ -5,10 +5,12 @@ require "guard/fig/version"
5
5
 
6
6
  module ::Guard
7
7
  class Fig < Plugin
8
+ CONFIG_NAMES = ['fig.yml', 'fig.yaml', 'docker-compose.yml', 'docker-compose.yaml']
9
+
8
10
  def initialize(options = {})
9
11
  super(options)
10
- @config = YAML.load_file('fig.yml')
11
- @fig = FigProxy.new
12
+ @config = load_config
13
+ @fig = FigProxy.new(options)
12
14
  end
13
15
 
14
16
  def start
@@ -28,7 +30,7 @@ module ::Guard
28
30
  def run_on_changes(paths)
29
31
  debug paths.inspect
30
32
 
31
- if paths.any? { |x| x =~ /fig\.yml/ }
33
+ if paths.any? { |x| x =~ Regexp.new(Regexp.escape(CONFIG_NAMES.join("|"))) }
32
34
  @fig.up
33
35
  else
34
36
  restart_services(paths)
@@ -78,6 +80,20 @@ module ::Guard
78
80
  def debug(msg)
79
81
  puts msg if ENV['DEBUG']
80
82
  end
83
+
84
+ def load_config
85
+ config_file = CONFIG_NAMES.find do |file|
86
+ File.exist?(file)
87
+ end
88
+
89
+ if config_file
90
+ YAML.load_file(config_file)
91
+ else
92
+ puts "No file found with any name: #{CONFIG_NAMES.join(', ')}"
93
+ exit 1
94
+ end
95
+
96
+ end
81
97
  end
82
98
  end
83
99
 
@@ -0,0 +1,4 @@
1
+ 2015-04-27 Jorge Dias <jorge@mrdias.com>
2
+
3
+ * Version 0.1.1
4
+ * Configurable command
@@ -3,12 +3,18 @@ require 'guard/plugin'
3
3
  module Guard
4
4
  class Fig < Plugin
5
5
  class FigProxy
6
+ attr_reader :command
7
+
8
+ def initialize(options)
9
+ @command = options.fetch(:command, 'fig')
10
+ end
11
+
6
12
  def build(service = nil)
7
- system "fig build #{service}"
13
+ system "#{command} build #{service}"
8
14
  end
9
15
 
10
16
  def up recreate: true
11
- cmd = "fig up -d"
17
+ cmd = "#{command} up -d"
12
18
  unless recreate
13
19
  cmd << " --no-recreate"
14
20
  end
@@ -16,11 +22,11 @@ module Guard
16
22
  end
17
23
 
18
24
  def stop(service = nil)
19
- system "fig stop #{service}"
25
+ system "#{command} stop #{service}"
20
26
  end
21
27
 
22
28
  def remove(service)
23
- system "fig rm --force #{service}"
29
+ system "#{command} rm --force #{service}"
24
30
  end
25
31
  end
26
32
  end
@@ -2,6 +2,6 @@ require 'guard/plugin'
2
2
 
3
3
  module Guard
4
4
  class Fig < Plugin
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-fig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Dias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-18 00:00:00.000000000 Z
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,7 @@ files:
52
52
  - Rakefile
53
53
  - guard-fig.gemspec
54
54
  - lib/guard/fig.rb
55
+ - lib/guard/fig/ChangeLog
55
56
  - lib/guard/fig/fig_proxy.rb
56
57
  - lib/guard/fig/version.rb
57
58
  homepage: https://rubygems.org/gems/guard-fig