Skip to content
This repository was archived by the owner on Jan 30, 2024. It is now read-only.

Commit a53c51a

Browse files
committed
initial release of dkdeploy-test_environment v1.0.0
0 parents  commit a53c51a

22 files changed

+761
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Gemfile.lock

.rubocop.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AllCops:
2+
Exclude:
3+
- 'tmp/**/*'
4+
- 'spec/fixtures/application/htdocs/stylesheets/**/config.rb'
5+
- 'Vagrantfile'
6+
- 'config/**/*'
7+
GlobalVars:
8+
AllowedVariables: []
9+
MethodLength:
10+
Max: 25
11+
LineLength:
12+
Max: 200
13+
SpecialGlobalVars:
14+
Enabled: false
15+
BracesAroundHashParameters:
16+
Enabled: false
17+
CyclomaticComplexity:
18+
Max: 10

CONTRIBUTORS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# dkdeploy CONTRIBUTORS
2+
3+
The dkdeploy core maintainers would like to recognize following contributors (in alphabetic order):
4+
5+
- Sascha Egerer
6+
- Christoph Gerold
7+
- Johannes Goslar
8+
- Kieran Hayes
9+
- Wilfried Irßlinger
10+
- Thomas Jahnke
11+
- Gleb Levitin
12+
- Luka Lüdicke
13+
- Nicolai Reuschling
14+
- Lars Tode
15+
- Timo Webler
16+
- Mike Zaschka

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in dkdeploy-test_environment.gemspec
4+
gemspec

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright (c) 2014-2016 dkd Internet Service GmbH, Frankfurt am Main (Germany), https://dkd.de/
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Dkdeploy::Test
2+
3+
[![Gem Version](https://badge.fury.io/rb/dkdeploy-test_environment.svg)](https://badge.fury.io/rb/dkdeploy-test_environment)
4+
5+
## Description
6+
7+
This Rubygem `dkdeploy-test_environment` contains shared testing functionality between other dkdeploy-* gems.
8+
9+
## Contributing
10+
11+
1. Install [git flow](https://github.com/nvie/gitflow)
12+
2. Install [Homebrew](http://brew.sh/) and run `brew install mysql-connector-c`
13+
3. If project is not checked out already do git clone `git clone https://github.com/dkdeploy/dkdeploy-test_environment.git`
14+
4. Checkout origin develop branch (`git checkout --track -b develop origin/develop`)
15+
5. Git flow initialze `git flow init -d`
16+
6. Installing gems `bundle install`
17+
7. Create new feature branch (`git flow feature start my-new-feature`)
18+
8. Run tests (README.md Testing)
19+
9. Commit your changes (`git commit -am 'Add some feature'`)

Rakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
task default: :spec
2+
require 'bundler/gem_tasks'
3+
4+
require 'rspec/core/rake_task'
5+
RSpec::Core::RakeTask.new

dkdeploy-test_enviroment.gemspec

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# coding: utf-8
2+
lib = File.expand_path('../lib', __FILE__)
3+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4+
require 'dkdeploy/test_environment/version'
5+
6+
Gem::Specification.new do |spec|
7+
spec.name = 'dkdeploy-test_environment'
8+
spec.version = Dkdeploy::TestEnvironment::Version
9+
spec.license = 'MIT'
10+
spec.authors = ['Lars Tode', 'Timo Webler', 'Kieran Hayes', 'Nicolai Reuschling', 'Johannes Goslar']
11+
spec.email = ['lars.tode@dkd.de', 'timo.webler@dkd.de', 'kieran.hayes@dkd.de', 'nicolai.reuschling@dkd.de', 'johannes.goslar@dkd.de']
12+
spec.description = 'test infrastructure for dkdeploy'
13+
spec.summary = 'dkdeploy-test_environment provides a test application for dkdeploy'
14+
spec.homepage = 'https://github.com/dkdeploy/dkdeploy-test_environment'
15+
16+
spec.files = `git ls-files`.split($/)
17+
spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
18+
spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
19+
spec.require_paths = ['lib']
20+
21+
spec.add_dependency 'bundler', '~> 1.12.5'
22+
spec.add_dependency 'rake', '~> 11.2'
23+
spec.add_dependency 'rspec', '~> 3.4'
24+
spec.add_dependency 'cucumber', '~> 2.3'
25+
spec.add_dependency 'rubocop', '~> 0.40'
26+
spec.add_dependency 'aruba', '~> 0.14'
27+
spec.add_dependency 'mysql2', '~> 0.3.21'
28+
spec.add_dependency 'pry', '~> 0.10.1'
29+
spec.add_dependency 'sshkit', '~> 1.10.0'
30+
end

lib/dkdeploy/test_environment.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require 'dkdeploy/test_environment/version'
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
require 'fileutils'
2+
require 'pathname'
3+
require_relative 'constants'
4+
require_relative 'remote'
5+
require_relative 'steps'
6+
require_relative 'env'
7+
require_relative 'mysql'
8+
require_relative 'path'
9+
10+
module Dkdeploy
11+
module TestEnvironment
12+
# Test application for capistrano with vagrant
13+
#
14+
# @!attribute [r] remote
15+
# @return [Dkdeploy::TestEnvironment::Remote]
16+
class Application
17+
include Dkdeploy::TestEnvironment::Constants
18+
19+
attr_reader :remote
20+
attr_accessor :mysql_connection_settings
21+
22+
def initialize(base, hostname, ssh_config = {})
23+
Dkdeploy::TestEnvironment::Constants.class_variable_set :@@root, base
24+
@remote = Dkdeploy::TestEnvironment::Remote.new hostname, ssh_config
25+
@mysql_connection_settings = {}
26+
end
27+
28+
# Install test environment
29+
#
30+
def install
31+
create_clean_test_application
32+
initialize_environment
33+
end
34+
35+
# Copy test application to temporary dirctory
36+
#
37+
def create_clean_test_application
38+
# Clean old test app path
39+
FileUtils.rm_rf test_app_path
40+
# Create test app path parent directory, if not exists
41+
FileUtils.mkdir_p tmp_path
42+
# Copy test app to new location
43+
FileUtils.cp_r template_path, test_app_path
44+
end
45+
46+
# Initialize rvm and bundler environment
47+
#
48+
def initialize_environment
49+
# Call command at test bundler environment. Not with gem bundler environment
50+
Bundler.with_clean_env do
51+
cd test_app_path do
52+
# Install necessary gems
53+
`bundle check || bundle install`
54+
raise "Error running 'bundle install'" unless $?.success?
55+
end
56+
end
57+
end
58+
end
59+
end
60+
end

0 commit comments

Comments
 (0)