docker_compose_ruby 0.1.2 → 0.1.3

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: 3a5aa7efb88888fb71c440c24735b690bb6abc2a
4
- data.tar.gz: 773637b89e5bbd43aba2c4a9ec33357536ad95f0
3
+ metadata.gz: bdc079e7c3844e1cd2ae057f63e32a50aa435897
4
+ data.tar.gz: e63b53363102127136f982252db24c632f56a5a9
5
5
  SHA512:
6
- metadata.gz: d84097612293674ff6b76a2862a7710f2aac538a584934109849e840618d95fdbab1891e0eecfcb85fe742e318fc1314e6ad53f4d71925133994944a2d0a610a
7
- data.tar.gz: de68eee54ba569cc39220e07fbc9ccc83c28e3252b9d6b695ee1f2208ce2f7347cacb6eee447f62400546af6f54e43be2d9f242aeeb4bd270d98f27e03ba7027
6
+ metadata.gz: 125f9a63063488d2ab8d14052bb544eca6b072e64dc33929e37117297dc71e5128bdcef9d0dcf28dfb3bece9d3210f3ff1c4fe0e74aa2f9bbf2e50680f7f6ce3
7
+ data.tar.gz: f955e5aa40920c714cd59dc3c098de6490fe287673b874a6cc5be03130b6f7f2e10c58896fcb1f822870e4f33e237d1525d41550d488f6145029f93924a0cdbb
data/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # DockerComposeRuby
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/docker_compose_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Simple Ruby wrapper for the docker compose cli
4
4
 
5
5
  TODO: Delete this and the text above, and describe your gem
6
6
 
7
7
  ## Installation
8
8
 
9
+ You need to have the docker compose cli installed.
10
+
9
11
  Add this line to your application's Gemfile:
10
12
 
11
13
  ```ruby
@@ -22,13 +24,33 @@ Or install it yourself as:
22
24
 
23
25
  ## Usage
24
26
 
25
- TODO: Write usage instructions here
27
+ Set the path to your docker file.
26
28
 
27
- ## Development
29
+ $ DockerCompose.set_yaml_path('/path/to/docker-compose.yml')
30
+
31
+ Set the project name (if no name is set it will be tthe name of the compose file's directory).
32
+
33
+ $ DockerCompose.set_project_name('test_project')
34
+
35
+ Up the compose project containers.
36
+
37
+ $ DockerCompose.up
38
+
39
+ Delete the compose project containers.
28
40
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
41
+ $ DockerCompose.delete
42
+
43
+ Stop the compose project containers.
44
+
45
+ $ DockerCompose.stop
46
+
47
+ Start the compose project containers.
48
+
49
+ $ DockerCompose.start
50
+
51
+ ## Development
30
52
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
53
+ I wanted something to use in a project I'm building, and there really wasn't anything out there that gives me the simplicity of the cli, but without having to repeat myself.
32
54
 
33
55
  ## Contributing
34
56
 
@@ -1,3 +1,3 @@
1
1
  module DockerComposeRuby
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -7,36 +7,91 @@ module DockerCompose
7
7
  class << self
8
8
  attr_accessor :project_name, :yaml_path, :yaml
9
9
 
10
+
11
+ # Set Path to Docker Compose Yaml File.
12
+ #
13
+ # @param path [String]
14
+ # @return [String]
15
+ #
16
+ # @example
17
+ # DockerCompose.set_yaml_path('/Users/test/projects/docker-compose.yml')
10
18
  def set_yaml_path(path)
11
19
  @yaml_path = "-f #{path}"
12
20
  @yaml = YAML.load_file(path)
13
21
  end
14
22
 
23
+ # Set Specific compose project name.
24
+ #
25
+ # @param name [String]
26
+ # @return [String]
27
+ #
28
+ # @example
29
+ # DockerCompose.set_project_name('test_project')
15
30
  def set_project_name(name)
16
31
  @project_name = "-p #{name}"
17
32
  name
18
33
  end
19
34
 
35
+ # Ups the set of containers listed in your compose file.
36
+ #
37
+ # @param options [Hash]
38
+ # @return [String]
39
+ #
40
+ # @example
41
+ # DockerCompose.up
20
42
  def up(options = {})
21
43
  options = nil if options.empty?
22
44
  compose('up',options)
23
45
  end
24
46
 
47
+ # Deletes the set of containers listed in your compose file.
48
+ #
49
+ # @param options [Hash]
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # DockerCompose.delete
25
54
  def delete(options = {})
26
55
  options = nil if options.empty?
27
56
  compose('delete',options)
28
57
  end
29
58
 
59
+ # Stops the set of containers listed in your compose file.
60
+ #
61
+ # @param options [Hash]
62
+ # @return [String]
63
+ #
64
+ # @example
65
+ # DockerCompose.stop
30
66
  def stop(options = {})
31
67
  options = nil if options.empty?
32
68
  compose('stop', options)
33
69
  end
34
70
 
71
+ # Starts the set of containers listed in your compose file.
72
+ #
73
+ # @param options [Hash]
74
+ # @return [String]
75
+ #
76
+ # @example
77
+ # DockerCompose.up
35
78
  def start(options = {})
36
79
  options = nil if options.empty?
37
80
  compose('start', options)
38
81
  end
39
82
 
83
+ # Displays the current version of Docker compose
84
+ #
85
+ # @param options [Hash]
86
+ # @return [String]
87
+ #
88
+ # @example
89
+ # DockerCompose.version
90
+ def version
91
+ compose('-v')
92
+ end
93
+
94
+ private
40
95
  def compose(command, options)
41
96
  case command
42
97
  when 'up'
@@ -44,13 +99,9 @@ module DockerCompose
44
99
  when 'delete'
45
100
  `docker-compose #{options} #{@yaml_path} #{@project_name} kill`
46
101
  `docker-compose #{options} #{@yaml_path} #{@project_name} rm -f`
47
- when 'stop', 'start'
102
+ when 'stop', 'start', 'version'
48
103
  `docker-compose #{options} #{@yaml_path} #{@project_name} #{command}`
49
104
  end
50
105
  end
51
-
52
- def version
53
- compose('-v')
54
- end
55
106
  end
56
107
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_compose_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitch Eaton