compose_env 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b1bf18f7a179e46428c95da43b104a329ad6baaee09417dd7ddb5762569dbe1e
4
+ data.tar.gz: 5650f2d56eb29c9b210221d84bda6cee3e787cf56ef26cc3e9c485e4d88f7391
5
+ SHA512:
6
+ metadata.gz: 413f3a347d870dc00ee8d79960d45d25aa56e4fa505bccd3e86049a5c1788160cfa870f63814e93dfd4e654559bc7ecbddeb6b0763e1fd3274ea7767ff4d1439
7
+ data.tar.gz: aba36b1196d817c832c7a947bdbef4e16ab4909abb4c13bed98554ddad3ccca45af2b17d717107b6ca40628dab09586baafc7e95d52aa29e0f28a40178d4be4d
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2021-06-20
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at vanyazin@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in compose_env.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.7"
data/Gemfile.lock ADDED
@@ -0,0 +1,61 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ compose_env (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ coderay (1.1.3)
11
+ diff-lcs (1.4.4)
12
+ method_source (1.0.0)
13
+ parallel (1.20.1)
14
+ parser (3.0.1.1)
15
+ ast (~> 2.4.1)
16
+ pry (0.14.1)
17
+ coderay (~> 1.1)
18
+ method_source (~> 1.0)
19
+ rainbow (3.0.0)
20
+ rake (13.0.3)
21
+ regexp_parser (2.1.1)
22
+ rexml (3.2.5)
23
+ rspec (3.10.0)
24
+ rspec-core (~> 3.10.0)
25
+ rspec-expectations (~> 3.10.0)
26
+ rspec-mocks (~> 3.10.0)
27
+ rspec-core (3.10.1)
28
+ rspec-support (~> 3.10.0)
29
+ rspec-expectations (3.10.1)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.10.0)
32
+ rspec-mocks (3.10.2)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.10.0)
35
+ rspec-support (3.10.2)
36
+ rubocop (1.17.0)
37
+ parallel (~> 1.10)
38
+ parser (>= 3.0.0.0)
39
+ rainbow (>= 2.2.2, < 4.0)
40
+ regexp_parser (>= 1.8, < 3.0)
41
+ rexml
42
+ rubocop-ast (>= 1.7.0, < 2.0)
43
+ ruby-progressbar (~> 1.7)
44
+ unicode-display_width (>= 1.4.0, < 3.0)
45
+ rubocop-ast (1.7.0)
46
+ parser (>= 3.0.1.1)
47
+ ruby-progressbar (1.11.0)
48
+ unicode-display_width (2.0.0)
49
+
50
+ PLATFORMS
51
+ x86_64-linux
52
+
53
+ DEPENDENCIES
54
+ compose_env!
55
+ pry
56
+ rake (~> 13.0)
57
+ rspec (~> 3.0)
58
+ rubocop (~> 1.7)
59
+
60
+ BUNDLED WITH
61
+ 2.2.20
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Ivan Zinovyev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # Compose Env
2
+
3
+ Compile docker-compose files for different environments using an ERB template.
4
+
5
+ The proposed approach might differ from the canonical way of handling multiple docker-compose environments and
6
+ extending the services for specific cases. So it might worth it to check the official documentation describing how to
7
+ [extend services](https://docs.docker.com/compose/extends/#multiple-compose-files) and also how to
8
+ [add and override configuration](https://docs.docker.com/compose/extends/#adding-and-overriding-configuration).
9
+
10
+ Anyway I find it sometimes easier to have the
11
+ [Puppet-like ERB template](https://puppet.com/docs/puppet/6/lang_template_erb.html#lang_template_erb) which describes
12
+ all the services in one place when building a small MVP application without a lot of dependencies.
13
+
14
+ Usually I used a couple of Makefile instructions before, but it is just much simpler to have these several steps defined
15
+ in one gem and be available as one executable command from the console. You can use boths: `compose_env` or
16
+ `compose-env` that's up to you, both commands are equal.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ gem install 'compose_env'
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ $ compose-env --help
27
+
28
+ Or:
29
+
30
+ $ compose_env --help
31
+
32
+ ## Example
33
+
34
+ Create a `docker-compose.yml.erb` file with the following content inside of your project directory:
35
+
36
+ ```yaml
37
+ version: "3.9"
38
+ services:
39
+ db:
40
+ image: postgres
41
+ volumes:
42
+ - ./tmp/db:/var/lib/postgresql/data
43
+ environment:
44
+ POSTGRES_PASSWORD: <%= !development? ? 'strong123password' : 'password' %>
45
+ web:
46
+ <% if env.production? %>
47
+ image: my_app:v0.1
48
+ <% else %>
49
+ build: .
50
+ <% end %>
51
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
52
+ volumes:
53
+ - .:/myapp
54
+ environment:
55
+ RAILS_ENV: <%= current_env %>
56
+ ports:
57
+ <% development do %>
58
+ - "3000:3000"
59
+ <% end %>
60
+ - "80:3000"
61
+ depends_on:
62
+ - db
63
+ ```
64
+
65
+ Now execute the command:
66
+
67
+ ```bash
68
+ compose-env -f docker-compose.yml.erb -e production, development
69
+ ```
70
+
71
+ The result will be the following:
72
+
73
+ **docker-compose.development.yml**
74
+
75
+ ```yaml
76
+ ---
77
+ version: '3.9'
78
+ services:
79
+ db:
80
+ image: postgres
81
+ volumes:
82
+ - "./tmp/db:/var/lib/postgresql/data"
83
+ environment:
84
+ POSTGRES_PASSWORD: password
85
+ web:
86
+ build: "."
87
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b
88
+ '0.0.0.0'"
89
+ volumes:
90
+ - ".:/myapp"
91
+ environment:
92
+ RAILS_ENV: development
93
+ ports:
94
+ - 3000:3000
95
+ - 80:3000
96
+ depends_on:
97
+ - db
98
+ ```
99
+
100
+ **docker-compose.production.yml**
101
+
102
+ ```yaml
103
+ ---
104
+ version: '3.9'
105
+ services:
106
+ db:
107
+ image: postgres
108
+ volumes:
109
+ - "./tmp/db:/var/lib/postgresql/data"
110
+ environment:
111
+ POSTGRES_PASSWORD: strong123password
112
+ web:
113
+ image: my_app:v0.1
114
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b
115
+ '0.0.0.0'"
116
+ volumes:
117
+ - ".:/myapp"
118
+ environment:
119
+ RAILS_ENV: production
120
+ ports:
121
+ - 80:3000
122
+ depends_on:
123
+ - db
124
+ ```
125
+
126
+ As you can see the command provides you a couple of helper methods to pick out the proper configuration for
127
+ each environment based on the environments passed to the `--envs` (or `-e`) option:
128
+
129
+ `environment?` returns a boolean value for the particular environment and can be used with `if/else` operators.
130
+
131
+ Which can be also used as a block of code. The code will be executed only if current environment statisfies the check.
132
+ ```
133
+ <% environment do %>
134
+ # environment specific code here...
135
+ <% end %>
136
+ ```
137
+
138
+ ## License
139
+
140
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
141
+
142
+ ## Code of Conduct
143
+
144
+ Everyone interacting in the ComposeEnv project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/compose_env/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/compose-env ADDED
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env ruby
2
+ require File.expand_path('./compose_env.rb', __dir__)
data/bin/compose_env ADDED
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env ruby
2
+ require File.expand_path('./compose_env.rb', __dir__)
@@ -0,0 +1,3 @@
1
+ require File.expand_path('../lib/compose_env.rb', __dir__)
2
+
3
+ ComposeEnv.run(ARGV)
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/compose_env/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'compose_env'
7
+ spec.version = ComposeEnv::VERSION
8
+ spec.authors = ["Ivan Zinovyev"]
9
+ spec.email = ["ivan@zinovyev.net"]
10
+
11
+ spec.summary = 'Prepare docker-compose files for different environments from the ERB template.'
12
+ spec.description = 'Prepare docker-compose files for different environments from the ERB template.'
13
+ spec.homepage = 'https://github.com/zinovyev/compose_env'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 2.4.0'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
25
+ end
26
+ spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ # Uncomment to register a new dependency of your gem
30
+ # spec.add_dependency "example-gem", "~> 1.0"
31
+ spec.add_development_dependency 'pry'
32
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+ require 'optparse'
5
+ require 'erb'
6
+ require 'yaml'
7
+ require 'pry'
8
+ require_relative "compose_env/version"
9
+ require_relative "compose_env/input_parser"
10
+ require_relative "compose_env/context"
11
+ require_relative "compose_env/builder"
12
+
13
+ module ComposeEnv
14
+ extend self
15
+
16
+ def run(argv)
17
+ options = InputParser.parse(argv)
18
+ Builder.new(options).build_compose_files!
19
+ end
20
+ end
@@ -0,0 +1,49 @@
1
+ module ComposeEnv
2
+ class Builder
3
+ attr_reader :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def build_compose_files
10
+ parse_all do |current_env, raw_yaml|
11
+ File.write(environment_file_name(current_env), raw_yaml)
12
+ end
13
+ end
14
+ alias build_compose_files! build_compose_files
15
+
16
+ def parse_all
17
+ options.envs.map do |current_env|
18
+ result = [current_env, parse_file(current_env)]
19
+ yield(*result) if block_given?
20
+
21
+ result
22
+ end.to_h
23
+ end
24
+
25
+ private
26
+
27
+ def environment_file_name(current_env)
28
+ Pathname.new(dirname).join("#{basename}.#{current_env}.yml").to_s
29
+ end
30
+
31
+ def basename
32
+ @basename ||= File.basename(options.file).split('.').first
33
+ end
34
+
35
+ def dirname
36
+ @dirname ||= File.dirname(options.file)
37
+ end
38
+
39
+ def parse_file(current_env)
40
+ env_context = Context.new(options, current_env).get_binding
41
+ raw_yaml = erb_template.result(env_context)
42
+ ::YAML.load(raw_yaml).to_yaml
43
+ end
44
+
45
+ def erb_template
46
+ @erb_template ||= ::ERB.new(File.read(options.file))
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,73 @@
1
+ require 'pry'
2
+ module ComposeEnv
3
+ class Context
4
+ attr_reader :options, :current_env
5
+
6
+ def initialize(options, current_env)
7
+ @options = options
8
+ @current_env = current_env
9
+ end
10
+
11
+ def method_missing(name, *args, &block)
12
+ method_name = name.to_sym
13
+ return handle_test_method(method_name) if test_method?(method_name)
14
+ return handle_restriction_method(method_name, &block) if restriction_method?(method_name)
15
+
16
+ super
17
+ end
18
+
19
+ def env
20
+ self
21
+ end
22
+
23
+ def env?(*env_names, &block)
24
+ return unless block_given?
25
+
26
+ first_env = env_names.first
27
+ env_names = first_env.is_a?(Array) ? first_env : env_names
28
+ return unless env_names.map(&:to_sym).include?(current_env)
29
+
30
+ block.call(self)
31
+ end
32
+
33
+ def get_binding
34
+ binding
35
+ end
36
+
37
+ def handle_test_method(method_name)
38
+ return method_name == "#{current_env}?".to_sym
39
+ end
40
+
41
+ def handle_restriction_method(method_name, &block)
42
+ return unless block_given? && method_name == current_env
43
+
44
+ block.call(self)
45
+ end
46
+
47
+ def test_method?(method_name)
48
+ test_methods.include?(method_name)
49
+ end
50
+
51
+ def restriction_method?(method_name)
52
+ restriction_methods.include?(method_name)
53
+ end
54
+
55
+ def test_methods
56
+ @test_methods ||= env_methods[:test]
57
+ end
58
+
59
+ def restriction_methods
60
+ @restriction_methods ||= env_methods[:restriction]
61
+ end
62
+
63
+ def env_methods
64
+ return @env_methods unless @env_methods.nil?
65
+
66
+ options.envs.each_with_object({test: [], restriction: []}) do |env, acc|
67
+ test_method = "#{env}?".to_sym
68
+ acc[:test] << test_method
69
+ acc[:restriction] << env
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,58 @@
1
+ module ComposeEnv
2
+ # Parse input options.
3
+ # Prepare the options for being pipelined to the follow-up processors.
4
+ class InputParser
5
+ DEFAULT_ENVS = %i[development staging production].freeze
6
+ DEFAULT_FILE = 'docker-compose.yml.erb'.freeze
7
+
8
+ Options = Struct.new(:envs, :file)
9
+
10
+ def self.parse(options)
11
+ new.parse(options)
12
+ end
13
+
14
+ def parse(options)
15
+ prepared_options = prepare(options)
16
+ option_parser.parse!(prepared_options)
17
+ return args
18
+ end
19
+
20
+ private
21
+
22
+ def option_parser
23
+ OptionParser.new do |opts|
24
+ opts.banner = "Usage: compose-env [options]"
25
+
26
+ opts.on("-eENVIROMENTS", "--envs=ENVIRONMENTS", "List of environments") do |envs|
27
+ args.envs = normalize_envs(envs)
28
+ end
29
+
30
+ opts.on("-fFILE", "--file=FILE", "The name of a template file to parse") do |file|
31
+ args.file = normalize_file(file)
32
+ end
33
+
34
+ opts.on("-h", "--help", "Prints this help") do
35
+ puts opts
36
+ exit
37
+ end
38
+ end
39
+ end
40
+
41
+ def args
42
+ @args ||= Options.new(DEFAULT_ENVS, normalize_file(DEFAULT_FILE))
43
+ end
44
+
45
+ def normalize_envs(envs)
46
+ envs.split(',').map(&:strip).map(&:to_sym)
47
+ end
48
+
49
+ def normalize_file(file)
50
+ Pathname.new(Dir.pwd).join(file).to_s
51
+ end
52
+
53
+ # Prepare a comma separated string to be parsed as one argument even with whitespaces in it
54
+ def prepare(options)
55
+ options.join(' ').gsub(/\s*,\s*/, ',').split(' ')
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ComposeEnv
4
+ VERSION = "0.1.0"
5
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: compose_env
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Zinovyev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-06-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Prepare docker-compose files for different environments from the ERB
28
+ template.
29
+ email:
30
+ - ivan@zinovyev.net
31
+ executables:
32
+ - compose-env
33
+ - compose_env
34
+ - compose_env.rb
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - ".gitignore"
39
+ - ".rspec"
40
+ - ".rubocop.yml"
41
+ - CHANGELOG.md
42
+ - CODE_OF_CONDUCT.md
43
+ - Gemfile
44
+ - Gemfile.lock
45
+ - LICENSE.txt
46
+ - README.md
47
+ - Rakefile
48
+ - bin/compose-env
49
+ - bin/compose_env
50
+ - bin/compose_env.rb
51
+ - compose_env.gemspec
52
+ - lib/compose_env.rb
53
+ - lib/compose_env/builder.rb
54
+ - lib/compose_env/context.rb
55
+ - lib/compose_env/input_parser.rb
56
+ - lib/compose_env/version.rb
57
+ homepage: https://github.com/zinovyev/compose_env
58
+ licenses:
59
+ - MIT
60
+ metadata:
61
+ homepage_uri: https://github.com/zinovyev/compose_env
62
+ source_code_uri: https://github.com/zinovyev/compose_env
63
+ changelog_uri: https://github.com/zinovyev/compose_env/CHANGELOG.md
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 2.4.0
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubygems_version: 3.1.4
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Prepare docker-compose files for different environments from the ERB template.
83
+ test_files: []