contur 0.0.5 → 0.0.6
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 +4 -4
- data/.travis.yml +12 -2
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/Rakefile +4 -2
- data/bin/contur +39 -1
- data/contur.gemspec +2 -0
- data/features/init.feature +45 -0
- data/features/step_definitions/init_steps.rb +30 -0
- data/features/step_definitions/version_steps.rb +9 -0
- data/features/support/env.rb +18 -0
- data/features/version.feature +6 -0
- data/lib/contur/constants.rb +12 -0
- data/lib/contur/controller.rb +4 -0
- data/lib/contur/version.rb +1 -1
- metadata +35 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb042d44aa1e032867e8ad81a95008b22af3e7a9
|
4
|
+
data.tar.gz: ac23835185b14d92a970b2e37a6cea8e34196456
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa56d0229238a88a2c70787f2ac777be7532c5800f1e882fc8944355b6267e6bce1266f3b6aafc2afb03b41431fea2bd5dd36eb791f0b460b113d5d393e80371
|
7
|
+
data.tar.gz: ddad66d481f938304a1ea36c74918b64e45bcc7d4fd3c6b46e3169488ed69c61c86fa85e9872ff303223cd6dfd290f9167735cec55c57c202a243cb18f995c57
|
data/.travis.yml
CHANGED
@@ -1,5 +1,15 @@
|
|
1
|
+
sudo: required
|
1
2
|
language: ruby
|
2
3
|
cache: bundler
|
4
|
+
services:
|
5
|
+
- docker
|
3
6
|
rvm:
|
4
|
-
|
5
|
-
|
7
|
+
- 2.3.1
|
8
|
+
before_install:
|
9
|
+
- gem install bundler -v '~> 1.13'
|
10
|
+
script:
|
11
|
+
- bundle exec rake install
|
12
|
+
- bundle exec rake
|
13
|
+
notifications:
|
14
|
+
slack:
|
15
|
+
secure: evx296qoaGI0URwE8uPixel9z0SEW0nKHb2v5YS2GeCGsyRTS8/p4io9mKByy5iepz4q4vfZuDGIZKPFSxoss0zZ3YR9hJuyxhhzO1PsEYeGitFjdXj4JQ6ENrltyUFybIs90mVCNcxOMTIPDjlbu38KMEEAAWS7Lqz0moppZxowfruWH90ZxF3GbGbotKDNY9sIV3IWvI3louTn834o4NhBK9vP6uS9V7Utyo9uad/ehWKAg8Z4C1mTbhLOjk+v8BJg7X8/4co/A7WoQTY1H7pi+Xs/ZGPYDVTyeQ4lyy1we5/fRiVf67x6S3DrAAMuaknHD8zbZ1E2VxbEvi3XKWPtjqz/QvCgsbNnyKdXiBbeybe1HXX6sWBNBrxKv4nMQ7D5cZy2CpkKAmpbPgrjKYL3gcHD2M6f7LOMZeWQiyZqG9T0rCtqLqLphFbUflnoyhKBk5elm/hNeRw2i81NuYW4ErFAmjyjWg6K0kazFf6EPPLuMUh5ZJ9ERg4mlK4rkCWc+yy8UEyMRVnvAdP4oAXfPHYQNub1vRBHKx9Vx/JFjSglU9olVNl9uJQLTjvdzZs1tAVEUz4DuMKoYZKOpUJovG3KpX8D6VhHe0CwnFfoMHeVuJ4hs9fUzFD+8L/VGmblVYWvoMF1hlknVK9Wo8L4UZfFWUPB/UTJvuBajVc=
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This CHANGELOG follows [Keep a CHANGELOG](http://keepachangelog.com/).
|
4
4
|
|
5
|
+
## [0.0.6] - 2017-01-05
|
6
|
+
### Added
|
7
|
+
- `contur init` command
|
8
|
+
- `contur zsh-comp` command
|
9
|
+
|
5
10
|
## [0.0.5] - 2016-11-21
|
6
11
|
### Fixed
|
7
12
|
- Typo after successful image build fixed
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Contur is an open-source command line application simplifying your local web dev
|
|
5
5
|
|
6
6
|
[](https://badge.fury.io/rb/contur)
|
7
7
|
[](https://travis-ci.org/Cheppers/contur)
|
8
|
-
[](https://coveralls.io/github/Cheppers/contur)
|
8
|
+
[](https://coveralls.io/github/Cheppers/contur?branch=master)
|
9
9
|
|
10
10
|
## Requirements
|
11
11
|
* Ruby 2.3.0+ (recommended installation method [via rvm](https://rvm.io/rvm/install))
|
data/Rakefile
CHANGED
@@ -2,8 +2,10 @@
|
|
2
2
|
require 'bundler/gem_tasks'
|
3
3
|
require 'rspec/core/rake_task'
|
4
4
|
require 'rubocop/rake_task'
|
5
|
+
require 'cucumber/rake/task'
|
5
6
|
|
6
|
-
RuboCop::RakeTask.new(:rubocop) { |
|
7
|
+
RuboCop::RakeTask.new(:rubocop) { |t| t.options << '-D' }
|
7
8
|
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
Cucumber::Rake::Task.new(:features) { |t| t.cucumber_opts = '--format pretty' }
|
8
10
|
|
9
|
-
task default: [:rubocop, :spec]
|
11
|
+
task default: [:rubocop, :spec, :features]
|
data/bin/contur
CHANGED
@@ -3,8 +3,10 @@
|
|
3
3
|
|
4
4
|
require 'contur'
|
5
5
|
require 'colorize'
|
6
|
+
require 'fileutils'
|
6
7
|
require 'pp'
|
7
8
|
require 'thor'
|
9
|
+
require 'thor/zsh_completion'
|
8
10
|
|
9
11
|
# rubocop:disable Metrics/AbcSize, Metrics/ClassLength
|
10
12
|
# Contur CLI
|
@@ -137,7 +139,7 @@ class ConturCLI < Thor
|
|
137
139
|
desc 'validate', 'Validate build definition file'
|
138
140
|
method_option :path,
|
139
141
|
aliases: '-p',
|
140
|
-
default: File.join(Dir.pwd, Dir['.contur.y*ml'].first),
|
142
|
+
default: File.join(Dir.pwd, Dir['.contur.y*ml'].first || ''),
|
141
143
|
desc: 'Build definition file path'
|
142
144
|
def validate
|
143
145
|
begin
|
@@ -167,6 +169,42 @@ class ConturCLI < Thor
|
|
167
169
|
end
|
168
170
|
exit 1
|
169
171
|
end
|
172
|
+
|
173
|
+
desc 'init', 'Initialize .contur.yml file'
|
174
|
+
method_option :'dry-run',
|
175
|
+
aliases: '-d',
|
176
|
+
type: :boolean,
|
177
|
+
default: false,
|
178
|
+
desc: "Don't create the file but print the output"
|
179
|
+
def init
|
180
|
+
if File.exist?('.contur.yml') && !options[:'dry-run']
|
181
|
+
puts '.contur.yml already exists'.red
|
182
|
+
exit 11
|
183
|
+
end
|
184
|
+
yml = Contur::Controller.default_yaml
|
185
|
+
IO.write('.contur.yml', yml) unless options[:'dry-run']
|
186
|
+
puts '.contur.yml initialized'.green unless options[:'dry-run']
|
187
|
+
puts yml if options[:'dry-run']
|
188
|
+
end
|
189
|
+
|
190
|
+
desc 'zsh-comp', 'Install zsh completion'
|
191
|
+
def zsh_comp
|
192
|
+
contur_dir = File.join(ENV['HOME'], '.contur')
|
193
|
+
zshrc = File.join(ENV['HOME'], '.zshrc')
|
194
|
+
contur_comp_file = File.join(contur_dir, 'zsh_completion.sh')
|
195
|
+
|
196
|
+
FileUtils.mkdir(contur_dir) unless Dir.exist?(contur_dir)
|
197
|
+
|
198
|
+
puts "Writing completion to #{contur_comp_file}..."
|
199
|
+
File.write(contur_comp_file, Thor::ZshCompletion::Generator.new(ConturCLI, 'contur').generate)
|
200
|
+
|
201
|
+
script_line = "[ -f #{contur_comp_file} ] && source #{contur_comp_file}"
|
202
|
+
unless File.readlines(zshrc).grep(/zsh_completion.sh/).any?
|
203
|
+
File.open(zshrc, 'a+') { |f| f.write("\n#{script_line}\n") }
|
204
|
+
end
|
205
|
+
|
206
|
+
puts "The changes will take effect after you restart your terminal or do a `source #{zshrc}`"
|
207
|
+
end
|
170
208
|
end
|
171
209
|
|
172
210
|
ConturCLI.start(ARGV)
|
data/contur.gemspec
CHANGED
@@ -31,12 +31,14 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency 'excon', '~> 0.46', '>= 0.46'
|
32
32
|
spec.add_dependency 'docker-api', '~> 1.31', '>= 1.31'
|
33
33
|
spec.add_dependency 'thor', '~> 0.19'
|
34
|
+
spec.add_dependency 'thor-zsh_completion', '~> 0.1.1'
|
34
35
|
|
35
36
|
spec.add_development_dependency 'bundler', '~> 1.13'
|
36
37
|
spec.add_development_dependency 'pry', '~> 0.10'
|
37
38
|
spec.add_development_dependency 'rake', '~> 10.0'
|
38
39
|
spec.add_development_dependency 'rubocop', '~> 0.44'
|
39
40
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
41
|
+
spec.add_development_dependency 'cucumber', '~> 2.4'
|
40
42
|
spec.add_development_dependency 'coveralls'
|
41
43
|
spec.add_development_dependency 'simplecov', '~> 0.12'
|
42
44
|
spec.add_development_dependency 'simplecov-console', '~> 0.3'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: init command
|
2
|
+
As a developer
|
3
|
+
The 'contur init' command should initialize a new .contur.yml
|
4
|
+
So I don't have to write it manually at first
|
5
|
+
|
6
|
+
Scenario: No previous .contur.yml in the directory
|
7
|
+
Given I have an empty directory
|
8
|
+
When I run "contur init" in the directory
|
9
|
+
Then I have a new .contur.yml
|
10
|
+
And it contains:
|
11
|
+
"""
|
12
|
+
---
|
13
|
+
version: 1.0
|
14
|
+
php: '5.6'
|
15
|
+
mysql: latest
|
16
|
+
env:
|
17
|
+
CONTUR: true
|
18
|
+
before:
|
19
|
+
- composer install
|
20
|
+
"""
|
21
|
+
|
22
|
+
Scenario: Existing .contur.yml in the directory
|
23
|
+
Given I have a directory with .contur.yml
|
24
|
+
When I run "contur init" in the directory
|
25
|
+
Then the CLI returns exit code 11
|
26
|
+
And it prints to the console:
|
27
|
+
"""
|
28
|
+
.contur.yml already exists
|
29
|
+
"""
|
30
|
+
|
31
|
+
Scenario: Execute a "contur init --dry-run"
|
32
|
+
Given I have an empty directory
|
33
|
+
When I run "contur init --dry-run" in the directory
|
34
|
+
Then I have an empty directory
|
35
|
+
And it prints to the console:
|
36
|
+
"""
|
37
|
+
---
|
38
|
+
version: 1.0
|
39
|
+
php: '5.6'
|
40
|
+
mysql: latest
|
41
|
+
env:
|
42
|
+
CONTUR: true
|
43
|
+
before:
|
44
|
+
- composer install
|
45
|
+
"""
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
Given(/^I have an empty directory$/) do
|
3
|
+
expect(Dir.entries(@tmpdir).size).to eq 2
|
4
|
+
end
|
5
|
+
|
6
|
+
When(/^I run "([^"]*)" in the directory$/) do |command|
|
7
|
+
resp = `cd #{@tmpdir} && #{command}`
|
8
|
+
@response = resp.gsub(/\e\[(\d+)(;\d+)*m/, '').chomp
|
9
|
+
end
|
10
|
+
|
11
|
+
Then(/^I have a new \.contur\.yml$/) do
|
12
|
+
expect(File.exist?(File.join(@tmpdir, '.contur.yml'))).to be true
|
13
|
+
end
|
14
|
+
|
15
|
+
Then(/^it contains:$/) do |string|
|
16
|
+
expect(string).to eq IO.read(File.join(@tmpdir, '.contur.yml')).chomp
|
17
|
+
end
|
18
|
+
|
19
|
+
Given(/^I have a directory with \.contur\.yml$/) do
|
20
|
+
IO.write(File.join(@tmpdir, '.contur.yml'), '')
|
21
|
+
expect(File.exist?(File.join(@tmpdir, '.contur.yml'))).to be true
|
22
|
+
end
|
23
|
+
|
24
|
+
Then(/^the CLI returns exit code (\d+)$/) do |exit_code|
|
25
|
+
expect($CHILD_STATUS.exitstatus).to eq exit_code.to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
Then(/^it prints to the console:$/) do |output|
|
29
|
+
expect(@response).to eq output
|
30
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'fileutils'
|
3
|
+
require 'rspec'
|
4
|
+
require 'English'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.expect_with :rspec do |c|
|
8
|
+
c.syntax = :expect
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
Before do
|
13
|
+
@tmpdir = Dir.mktmpdir
|
14
|
+
end
|
15
|
+
|
16
|
+
After do
|
17
|
+
FileUtils.remove_entry_secure @tmpdir
|
18
|
+
end
|
data/lib/contur/constants.rb
CHANGED
@@ -22,4 +22,16 @@ module Contur
|
|
22
22
|
php_max_post: '100M',
|
23
23
|
extra_files: Contur::TEMPLATE_DIR
|
24
24
|
}.freeze
|
25
|
+
|
26
|
+
DEFAULT_YAML ||= {
|
27
|
+
'version' => 1.0,
|
28
|
+
'php' => Contur::DEFAULT_PHP_VERSION,
|
29
|
+
'mysql' => Contur::DEFAULT_MYSQL_VERSION,
|
30
|
+
'env' => {
|
31
|
+
'CONTUR' => true
|
32
|
+
},
|
33
|
+
'before' => [
|
34
|
+
'composer install'
|
35
|
+
]
|
36
|
+
}.freeze
|
25
37
|
end
|
data/lib/contur/controller.rb
CHANGED
@@ -186,6 +186,10 @@ module Contur
|
|
186
186
|
mysql_containers.select { |c| !c.info['Image'].end_with?(except) }.each(&:stop)
|
187
187
|
end
|
188
188
|
|
189
|
+
def self.default_yaml
|
190
|
+
Contur::DEFAULT_YAML.to_yaml
|
191
|
+
end
|
192
|
+
|
189
193
|
private_class_method
|
190
194
|
|
191
195
|
def self.load_docker_template(template_name, opts = {})
|
data/lib/contur/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cheppers Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -78,6 +78,20 @@ dependencies:
|
|
78
78
|
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0.19'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: thor-zsh_completion
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.1.1
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 0.1.1
|
81
95
|
- !ruby/object:Gem::Dependency
|
82
96
|
name: bundler
|
83
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,6 +162,20 @@ dependencies:
|
|
148
162
|
- - "~>"
|
149
163
|
- !ruby/object:Gem::Version
|
150
164
|
version: '3.0'
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: cucumber
|
167
|
+
requirement: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - "~>"
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '2.4'
|
172
|
+
type: :development
|
173
|
+
prerelease: false
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - "~>"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '2.4'
|
151
179
|
- !ruby/object:Gem::Dependency
|
152
180
|
name: coveralls
|
153
181
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,6 +244,11 @@ files:
|
|
216
244
|
- bin/setup
|
217
245
|
- contur-logo.png
|
218
246
|
- contur.gemspec
|
247
|
+
- features/init.feature
|
248
|
+
- features/step_definitions/init_steps.rb
|
249
|
+
- features/step_definitions/version_steps.rb
|
250
|
+
- features/support/env.rb
|
251
|
+
- features/version.feature
|
219
252
|
- lib/contur.rb
|
220
253
|
- lib/contur/bindable_hash.rb
|
221
254
|
- lib/contur/config.rb
|