cirun 0.1.0
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 +7 -0
- data/.gitignore +9 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/bin/cirun +6 -0
- data/cirun.gemspec +28 -0
- data/lib/cirun/cli.rb +87 -0
- data/lib/cirun/runner.rb +13 -0
- data/lib/cirun/variants.rb +7 -0
- data/lib/cirun/version.rb +3 -0
- data/lib/cirun.rb +3 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cd5837a9806514ed02852031a3448d67647a3141
|
4
|
+
data.tar.gz: 0552a2423de4a91fc6ababa99b64d343c4aaa574
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ffa214de7f68a48b4444a84cd12621758f5b5de613fc2f85d31018139583d51548532f5320fd3d777f444a9af22676dcb3ef89225929ca9489032a7ef1f3c089
|
7
|
+
data.tar.gz: a9e810ed6b32c53c170e2750b873d21f8d43e80ccf255bae4ce27dfa3738cdea203a590b3b054a51edb333812c594aadb02a336f607e3abe42c0b7395b438c80
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Andrei Malyshev
|
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,43 @@
|
|
1
|
+
# Cirun
|
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/cirun`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'cirun'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install cirun
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cirun. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Cirun project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/cirun/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/cirun
ADDED
data/cirun.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "cirun/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cirun"
|
8
|
+
spec.version = Cirun::VERSION
|
9
|
+
spec.authors = ["Andrei Malyshev"]
|
10
|
+
spec.email = ["Andrei.Malyshev@kodep.ru"]
|
11
|
+
|
12
|
+
spec.summary = %q{This gem allows fast launch tests against specific redmine/ruby/db combo}
|
13
|
+
spec.homepage = "https://redmineup.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
|
+
f.match(%r{^(test|spec|features)/})
|
21
|
+
end
|
22
|
+
spec.bindir = "bin"
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
end
|
data/lib/cirun/cli.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'optparse'
|
3
|
+
require 'ostruct'
|
4
|
+
|
5
|
+
require_relative './variants'
|
6
|
+
|
7
|
+
module Cirun
|
8
|
+
class CLI
|
9
|
+
def initialize
|
10
|
+
@options = OpenStruct.new
|
11
|
+
@options.database = ''
|
12
|
+
@options.redmine = ''
|
13
|
+
@options.ruby = ''
|
14
|
+
@options.plugin = ''
|
15
|
+
@options.dependent = ''
|
16
|
+
end
|
17
|
+
|
18
|
+
def parse
|
19
|
+
OptionParser.new do |opts|
|
20
|
+
opts.banner = 'Usage: cirun [options]'
|
21
|
+
opts.on('-d', '--database DATABASE', "Specify database #{database_list}") do |db|
|
22
|
+
@options.database = db
|
23
|
+
end
|
24
|
+
opts.on('-m', '--redmine REDMINE', "Specify redmine #{redmine_list}") do |redmine|
|
25
|
+
@options.redmine = redmine
|
26
|
+
end
|
27
|
+
opts.on('-r', '--ruby RUBY', "Specify ruby #{ruby_list}") do |ruby|
|
28
|
+
@options.ruby = ruby
|
29
|
+
end
|
30
|
+
opts.on('-p', '--plugin PLUGIN', "Specify plugin (will try to guess from pwd)") do |plugin|
|
31
|
+
@options.plugin = plugin
|
32
|
+
end
|
33
|
+
opts.on('-e', '--dependent DEPENDENT', "Specify plugin dependency") do |dependent|
|
34
|
+
@options.dependent = dependent
|
35
|
+
end
|
36
|
+
end.parse!
|
37
|
+
|
38
|
+
validate_options || abort_due_to_lack_of_options
|
39
|
+
enhance_options
|
40
|
+
@options
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def validate_options
|
46
|
+
validate_database &&
|
47
|
+
validate_ruby &&
|
48
|
+
validate_redmine
|
49
|
+
end
|
50
|
+
|
51
|
+
def validate_database
|
52
|
+
@options.database.size > 0 && Cirun::Variants::DATABASES.include?(@options.database)
|
53
|
+
end
|
54
|
+
|
55
|
+
def validate_ruby
|
56
|
+
@options.ruby.size > 0 && Cirun::Variants::RUBIES.include?(@options.ruby)
|
57
|
+
end
|
58
|
+
|
59
|
+
def validate_redmine
|
60
|
+
@options.redmine.size > 0 && Cirun::Variants::REDMINES.include?(@options.redmine)
|
61
|
+
end
|
62
|
+
|
63
|
+
def abort_due_to_lack_of_options
|
64
|
+
puts "Database should be given and be one of #{database_list}" unless validate_database
|
65
|
+
puts "Ruby should be given and be one of #{ruby_list}" unless validate_ruby
|
66
|
+
puts "Redmine should be given and be one of #{redmine_list}" unless validate_redmine
|
67
|
+
exit -1
|
68
|
+
end
|
69
|
+
|
70
|
+
def enhance_options
|
71
|
+
return if @options.plugin.size > 0
|
72
|
+
@options.plugin = Dir.pwd.split('/').last
|
73
|
+
end
|
74
|
+
|
75
|
+
def database_list
|
76
|
+
Cirun::Variants::DATABASES.join('|')
|
77
|
+
end
|
78
|
+
|
79
|
+
def redmine_list
|
80
|
+
Cirun::Variants::REDMINES.join('|')
|
81
|
+
end
|
82
|
+
|
83
|
+
def ruby_list
|
84
|
+
Cirun::Variants::RUBIES.join('|')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
data/lib/cirun/runner.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Cirun
|
2
|
+
class Runner
|
3
|
+
def initialize(opts)
|
4
|
+
@opts = opts
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
cmd = "docker run -t -i --env RUBY=#{@opts.ruby} --env DB=#{@opts.db} --env REDMINE=#{@opts.redmine} --env PLUGIN=#{@opts.plugin} --env DEPENDENT=#{@opts.dependent} --env CODEPATH=#{`pwd`.chomp} redmineup/#{@opts.plugin} /root/run_for.sh"
|
9
|
+
puts "Running:\n#{cmd}"
|
10
|
+
%x[ #{cmd} ]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/cirun.rb
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cirun
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrei Malyshev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- Andrei.Malyshev@kodep.ru
|
44
|
+
executables:
|
45
|
+
- cirun
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/cirun
|
55
|
+
- cirun.gemspec
|
56
|
+
- lib/cirun.rb
|
57
|
+
- lib/cirun/cli.rb
|
58
|
+
- lib/cirun/runner.rb
|
59
|
+
- lib/cirun/variants.rb
|
60
|
+
- lib/cirun/version.rb
|
61
|
+
homepage: https://redmineup.com
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.6.11
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: This gem allows fast launch tests against specific redmine/ruby/db combo
|
85
|
+
test_files: []
|