whally 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Dockerfile +3 -0
- data/Gemfile +9 -0
- data/Gemfile2 +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +6 -0
- data/bin/whales +4 -0
- data/development-entrypoint.sh +5 -0
- data/docker-compose.yml +19 -0
- data/example/Dockerfile +6 -0
- data/example/Gemfile +15 -0
- data/example/docker-compose.yml +27 -0
- data/lib/whales/builder.rb +84 -0
- data/lib/whales/calves/docker_compose/default.calf +4 -0
- data/lib/whales/calves/entrypoint/rails.calf +17 -0
- data/lib/whales/calves/postgresql/postgis.calf +18 -0
- data/lib/whales/calves/postgresql/postgresql.calf +18 -0
- data/lib/whales/dockerfiler.rb +41 -0
- data/lib/whales/gemline.rb +19 -0
- data/lib/whales/gems_extractor.rb +27 -0
- data/lib/whales/service_decomposer.rb +36 -0
- data/lib/whales/version.rb +3 -0
- data/lib/whales/volume_decomposer.rb +34 -0
- data/lib/whales.rb +7 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/whales_spec.rb +30 -0
- data/whales.gemspec +41 -0
- metadata +190 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c327bb23b4188d107fc9c00b19f1aaec6bdeba2d
|
4
|
+
data.tar.gz: db0d81ef887f94b4e31cdc43feff1d4cf98ad36a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 07abaea371fbcbd8856f8e0d0cec9526ad277fdfd89a1d81d5ca445dbd1c2a8f1a2696e0b509717efade212de2f808f0cce7ca5c10767381f30f77db68d3f78f
|
7
|
+
data.tar.gz: 91adad27cdd65fba01006f68ceb64977e21c40dd2f24587f7cc99cbfb76148d262aa2490e20f27cc7599c755bfbe3aab8fe8bbcf4fd1c48c05f8017d122bbc89
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers 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. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Dockerfile
ADDED
data/Gemfile
ADDED
data/Gemfile2
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Abraham Kuri
|
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,67 @@
|
|
1
|
+
# [Whales](https://github.com/IcaliaLabs/whales)
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/repos/571a34d6c0558e4075003682/badges/99957175ce0f89b74157/gpa.svg)](https://codeclimate.com/repos/571a34d6c0558e4075003682/feed)
|
4
|
+
[![Issue Count](https://codeclimate.com/repos/571a34d6c0558e4075003682/badges/99957175ce0f89b74157/issue_count.svg)](https://codeclimate.com/repos/571a34d6c0558e4075003682/feed)
|
5
|
+
[![Test Coverage](https://codeclimate.com/repos/571a34d6c0558e4075003682/badges/99957175ce0f89b74157/coverage.svg)](https://codeclimate.com/repos/571a34d6c0558e4075003682/coverage)
|
6
|
+
|
7
|
+
**Whales** is a command with the intention to automatically dockerize rails app.
|
8
|
+
|
9
|
+
|
10
|
+
## Table of contents
|
11
|
+
- [Installation](#installation)
|
12
|
+
- [Usage](#usage)
|
13
|
+
- [What it actually do?](#what-it-actually-do)
|
14
|
+
- [Contributing](#contributing)
|
15
|
+
- [Credits](#credits)
|
16
|
+
|
17
|
+
## Quick start
|
18
|
+
|
19
|
+
To install the gem you can just run the following command:
|
20
|
+
|
21
|
+
```console
|
22
|
+
% gem install whales
|
23
|
+
```
|
24
|
+
|
25
|
+
You now have access to the `whales` command through the CLI.
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
To dockerize a rails app, just use the whales command:
|
30
|
+
|
31
|
+
```console
|
32
|
+
% whales dockerize
|
33
|
+
```
|
34
|
+
|
35
|
+
|
36
|
+
## What it actually do?
|
37
|
+
|
38
|
+
It will create the `dockerfile` and `docker-compose.yml` that your app needs based on your Gemfile.
|
39
|
+
|
40
|
+
It will scan your gemfile and call [WhalesAPI](http://github.com/icalialabs/whaleapi) and send it an array of all the gems.
|
41
|
+
It will receive all gems dependencies that will go straight to `dockerfile` and all gems services that will go straight to `docker-compose.yml`
|
42
|
+
|
43
|
+
After that you can just run `docker-compose up -d` and start working on your newly dockerized app!
|
44
|
+
|
45
|
+
|
46
|
+
It will also:
|
47
|
+
|
48
|
+
1. Run `docker-compose up -d` to start your container when `whales dockerize` is called.
|
49
|
+
|
50
|
+
|
51
|
+
## Bug tracker & feature request
|
52
|
+
|
53
|
+
For bugs and feature request, head to the [issues](https://github.com/IcaliaLabs/whales/issues) section and if necessary create one.
|
54
|
+
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
Everyone is freely to collaborate and submit pull request if needed.
|
59
|
+
|
60
|
+
|
61
|
+
## Credits
|
62
|
+
|
63
|
+
Thank you [contributors](https://github.com/IcaliaLabs/whales/graphs/contributors)!
|
64
|
+
|
65
|
+
![Icalia Labs](https://raw.githubusercontent.com/IcaliaLabs/kaishi/master/logo.png)
|
66
|
+
|
67
|
+
WhalesAPI is maintained by [Icalia Labs](http://www.icalialabs.com/team).
|
data/Rakefile
ADDED
data/bin/whales
ADDED
data/docker-compose.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
version: "2"
|
2
|
+
|
3
|
+
volumes:
|
4
|
+
gems:
|
5
|
+
driver: local
|
6
|
+
services:
|
7
|
+
whales:
|
8
|
+
image: ruby:2.3.0
|
9
|
+
entrypoint: /usr/src/whales/development-entrypoint.sh
|
10
|
+
command: bash
|
11
|
+
volumes:
|
12
|
+
- .:/usr/src/whales
|
13
|
+
- gems:/usr/local/bundle
|
14
|
+
- ../datoz-master:/usr/src/whales/datoz
|
15
|
+
working_dir: /usr/src/whales
|
16
|
+
tty: true
|
17
|
+
stdin_open: true
|
18
|
+
environment:
|
19
|
+
CODECLIMATE_REPO_TOKEN: 1d8bb56c61c6eb5348dd41a22131125ab6bf1328f62b06d36e88275da9e10b7a
|
data/example/Dockerfile
ADDED
data/example/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Codeclimate
|
4
|
+
gem 'codeclimate-test-reporter', group: :test, require: nil
|
5
|
+
|
6
|
+
# gem "coderclimate-test-reporter", group: :test, require: nil
|
7
|
+
gem 'nokogiri'
|
8
|
+
|
9
|
+
gem 'rest-client'
|
10
|
+
|
11
|
+
gem 'pg'
|
12
|
+
|
13
|
+
gem 'rails'
|
14
|
+
|
15
|
+
gemspec
|
@@ -0,0 +1,27 @@
|
|
1
|
+
version: '2'
|
2
|
+
volumes:
|
3
|
+
postgresdata:
|
4
|
+
driver: local
|
5
|
+
|
6
|
+
gems:
|
7
|
+
driver: local
|
8
|
+
|
9
|
+
services:
|
10
|
+
db:
|
11
|
+
image: postgres:9.5.3
|
12
|
+
ports:
|
13
|
+
- 5442:5432
|
14
|
+
volumes:
|
15
|
+
- postgres-data:/var/lib/postgresql/data
|
16
|
+
web:
|
17
|
+
tty: 'true'
|
18
|
+
image: ruby:2.3
|
19
|
+
links:
|
20
|
+
- db
|
21
|
+
ports: - 3000:3000
|
22
|
+
command: rails server -b 0.0.0.0 -p 3000 -P /tmp/rails.pid
|
23
|
+
volumes:
|
24
|
+
- gems:/usr/local/bundle
|
25
|
+
- .:/app/user
|
26
|
+
stdin_open: 'true'
|
27
|
+
working_dir: /usr/src/app
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'pry'
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'rest-client'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
module Whales
|
8
|
+
URL = 'http://whales-api.herokuapp.com'.freeze
|
9
|
+
|
10
|
+
# Whales Commandline App
|
11
|
+
class Builder < Thor
|
12
|
+
include Whales
|
13
|
+
include Thor::Actions
|
14
|
+
|
15
|
+
def initialize(args = [], local_options = {}, config = {})
|
16
|
+
super
|
17
|
+
@gems = []
|
18
|
+
@pathfile = ''
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'dockerize', 'It dockerize the app'
|
22
|
+
def dockerize(pathfile)
|
23
|
+
@pathfile = pathfile.gsub('Gemfile', '')
|
24
|
+
scan_gems
|
25
|
+
response = return_packages
|
26
|
+
Whales::Dockerfiler.new(response, @pathfile).dockerfiles
|
27
|
+
if @gems.include?('rails')
|
28
|
+
add_development_files
|
29
|
+
end
|
30
|
+
build_container
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def write_on(file: '', mode: 'a')
|
36
|
+
if block_given?
|
37
|
+
File.open(file, mode) do |file_|
|
38
|
+
file_.write yield
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def add_development_files
|
44
|
+
add_entrypoint
|
45
|
+
add_env_file
|
46
|
+
end
|
47
|
+
|
48
|
+
def add_entrypoint
|
49
|
+
write_on file: "#{@pathfile}/dev-entrypoint.sh", mode: 'w' do
|
50
|
+
"set -e\nbundle check || bundle\nbin/check-or-setup-db\nif [ -z \"$1\" ]; then set -- rails server -p 3000 -b 0.0.0.0 \"$@\"; fi\nif [[ \"$1\" = \"rails\" && (\"$2\" = \"s\" || \"$2\" = \"server\") ]]; then set -- \"$@\" -P /tmp/server.pid; fi\nrake db:migrate\nexec \"$@\""
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_env_file
|
55
|
+
write_on file: "#{@pathfile}/dev.env.example", mode: 'w' do
|
56
|
+
"SECRET_KEY_BASE=\"1234567890\"\nSECRET_TOKEN=\"1234567890\"\nWEB_CONSOLE_WHITELISTED_IPS=192.168.99.100"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def scan_gems
|
61
|
+
@gems = Whales::GemsExtractor.new(@pathfile).collect
|
62
|
+
end
|
63
|
+
|
64
|
+
def return_packages
|
65
|
+
jewels = {
|
66
|
+
jewels: @gems
|
67
|
+
}
|
68
|
+
response = RestClient.post "#{URL}/dockerfiles", jewels
|
69
|
+
JSON.parse(response)
|
70
|
+
end
|
71
|
+
|
72
|
+
def download_calf(name)
|
73
|
+
run("curl -o docker-compose-2.yml #{URL}/master/#{name}")
|
74
|
+
end
|
75
|
+
|
76
|
+
def create_docker_compose_file
|
77
|
+
create_file 'docker-compose.yml' unless File.exist?('docker-compose.yml')
|
78
|
+
end
|
79
|
+
|
80
|
+
def build_container
|
81
|
+
run("COMPOSE_HTTP_TIMEOUT=18000 docker-compose up")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# The Docker App Container's development entrypoint.
|
2
|
+
# This is a script used by the project's Docker development environment to
|
3
|
+
# setup the app containers and databases upon runnning.
|
4
|
+
|
5
|
+
set -e
|
6
|
+
|
7
|
+
: ${APP_PATH:="/app"}
|
8
|
+
: ${APP_TEMP_PATH:="$APP_PATH/tmp"}
|
9
|
+
|
10
|
+
# In case of a bad reset, delete pid file
|
11
|
+
if [ -e /$APP_TEMP_PATH/tmp/pids/server.pid ]
|
12
|
+
then rm /$APP_TEMP_PATH/pids/server.pid
|
13
|
+
fi
|
14
|
+
|
15
|
+
# Check gems
|
16
|
+
bundle
|
17
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
volumes:
|
2
|
+
postgres-data:
|
3
|
+
driver: local
|
4
|
+
db:
|
5
|
+
image: mdillon/postgis:9.5
|
6
|
+
ports:
|
7
|
+
- 5432:5432
|
8
|
+
volumes:
|
9
|
+
- postgres-data:/var/lib/postgresql/data
|
10
|
+
environment:
|
11
|
+
POSTGRES_PASSWORD: 12341234
|
12
|
+
|
13
|
+
services:
|
14
|
+
services_name:
|
15
|
+
links:
|
16
|
+
- db
|
17
|
+
environment:
|
18
|
+
DATABASE_URL: postgis://postgres:12341234@db:5432/db_development
|
@@ -0,0 +1,18 @@
|
|
1
|
+
volumes:
|
2
|
+
postgres-data:
|
3
|
+
driver: local
|
4
|
+
|
5
|
+
services:
|
6
|
+
db:
|
7
|
+
image: postgres:9.5
|
8
|
+
ports:
|
9
|
+
- 5432:5432
|
10
|
+
volumes:
|
11
|
+
- postgres-data:/var/lib/postgresql/data
|
12
|
+
environment:
|
13
|
+
POSTGRES_PASSWORD: 12341234
|
14
|
+
services_name:
|
15
|
+
links:
|
16
|
+
- db
|
17
|
+
environment:
|
18
|
+
DATABASE_URL: postgres://postgres:12341234@db:5432/taptofund_db_development
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'yaml'
|
3
|
+
module Whales
|
4
|
+
# Get dependencies from Whales API
|
5
|
+
class Dockerfiler
|
6
|
+
def initialize(response, pathfile)
|
7
|
+
@dockerfile = response['dockerfile']
|
8
|
+
@docker_compose = response['docker_compose']
|
9
|
+
@pathfile = pathfile
|
10
|
+
end
|
11
|
+
|
12
|
+
def dockerfiles
|
13
|
+
dockerfile_content = "FROM ruby:2.3.0\nMAINTAINER <whales@icalialabs.com>\nRUN apt-get update && apt-get install #{@dockerfile}"
|
14
|
+
create_dockerfile(dockerfile_content)
|
15
|
+
docker_compose_content = "version: \"2\" \n\nvolumes:#{VolumeDecomposer.new(@docker_compose).textify}\n\nservices:\n#{ServiceDecomposer.new(@docker_compose).textify}"
|
16
|
+
create_docker_compose(docker_compose_content)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def create_dockerfile(content)
|
22
|
+
write_on file: "#{@pathfile}/Dockerfile", mode: 'w' do
|
23
|
+
content
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_docker_compose(content)
|
28
|
+
write_on file: "#{@pathfile}/docker-compose.yml", mode: 'w' do
|
29
|
+
content
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def write_on(file: '', mode: 'a')
|
34
|
+
if block_given?
|
35
|
+
File.open(file, mode) do |file_|
|
36
|
+
file_.write yield
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Whales
|
2
|
+
# Manages a text line where gem is defined to be installed
|
3
|
+
class Gemline
|
4
|
+
def initialize(line)
|
5
|
+
@line_elements = line.split(' ')
|
6
|
+
end
|
7
|
+
|
8
|
+
def gem?
|
9
|
+
@line_elements[0] == 'gem'
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_gem
|
13
|
+
return unless gem?
|
14
|
+
jewel = @line_elements[1].delete(',').chop
|
15
|
+
jewel[0] = ''
|
16
|
+
jewel
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Whales
|
2
|
+
# Extract gems from a gemfile
|
3
|
+
class GemsExtractor
|
4
|
+
attr_reader :collect
|
5
|
+
|
6
|
+
def initialize(pathfile)
|
7
|
+
@pathfile = pathfile
|
8
|
+
@collect = []
|
9
|
+
|
10
|
+
gems
|
11
|
+
end
|
12
|
+
|
13
|
+
def gems
|
14
|
+
normalize_pathfile
|
15
|
+
|
16
|
+
file = File.open(@pathfile, 'r')
|
17
|
+
|
18
|
+
file.each_line do |line|
|
19
|
+
@collect << Whales::Gemline.new(line).to_gem
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def normalize_pathfile
|
24
|
+
@pathfile += '/Gemfile' unless @pathfile.include? 'Gemfile'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Whales
|
2
|
+
# Decompose response from WhalesAPI
|
3
|
+
class ServiceDecomposer
|
4
|
+
def initialize(response)
|
5
|
+
@services = []
|
6
|
+
response.each do |service|
|
7
|
+
@services << service['content']
|
8
|
+
end
|
9
|
+
@services.flatten!
|
10
|
+
end
|
11
|
+
|
12
|
+
def textify
|
13
|
+
modified_service = ''
|
14
|
+
@services.map do |service|
|
15
|
+
index = 0
|
16
|
+
modified_service = service.to_yaml.gsub("---\n", " ").delete('"')
|
17
|
+
modified_service = modified_service.delete("'")
|
18
|
+
modified_service.each_char do |character|
|
19
|
+
if character == "\n"
|
20
|
+
modified_service.insert(index+1, " ")
|
21
|
+
index += 2
|
22
|
+
end
|
23
|
+
|
24
|
+
if character == '-' && modified_service[index+1] == ' '
|
25
|
+
modified_service.insert(index-1, " ")
|
26
|
+
index += 2
|
27
|
+
end
|
28
|
+
|
29
|
+
index += 1
|
30
|
+
end
|
31
|
+
modified_service[modified_service.length-1] = ''
|
32
|
+
modified_service
|
33
|
+
end.join
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Whales
|
2
|
+
# Decompose response from WhalesAPI
|
3
|
+
class VolumeDecomposer
|
4
|
+
def initialize(response)
|
5
|
+
@volumes = []
|
6
|
+
response.each do |service|
|
7
|
+
@volumes << service['volumes']
|
8
|
+
end
|
9
|
+
@volumes.flatten!
|
10
|
+
end
|
11
|
+
|
12
|
+
def textify
|
13
|
+
volumes.map do |volume|
|
14
|
+
volume_yaml = volume.to_yaml
|
15
|
+
volume_yaml[0..2] = ''
|
16
|
+
volume_yaml.insert(1, " ")
|
17
|
+
volume_yaml.insert(volume_yaml.index(":")+2, " ")
|
18
|
+
volume_yaml[volume_yaml.size-1] = ''
|
19
|
+
volume_yaml
|
20
|
+
end.join
|
21
|
+
end
|
22
|
+
|
23
|
+
def volumes
|
24
|
+
volume_hash = []
|
25
|
+
@volumes.map do |volume|
|
26
|
+
volume_key = volume['name']
|
27
|
+
if volume_key != '.'
|
28
|
+
volume_hash << { volume_key.to_s => { 'driver' => volume['driver'] } }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
volume_hash
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/whales.rb
ADDED
data/spec/spec_helper.rb
ADDED
data/spec/whales_spec.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'thor'
|
3
|
+
require './lib/whales/builder.rb'
|
4
|
+
require 'pry'
|
5
|
+
|
6
|
+
describe Whales::Builder do
|
7
|
+
let(:whales) { Whales::Builder.new }
|
8
|
+
let(:nude_pathfile) { 'example' }
|
9
|
+
let(:pathfile) { 'example/Gemfile' }
|
10
|
+
after(:each) do
|
11
|
+
File.delete("#{nude_pathfile}/Dockerfile")
|
12
|
+
File.delete("#{nude_pathfile}/docker-compose.yml")
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#dockerize' do
|
16
|
+
context 'with different pathfiles' do
|
17
|
+
it 'Doesnt contain the word Gemfile' do
|
18
|
+
whales.dockerize nude_pathfile
|
19
|
+
expect(File.exist?("#{nude_pathfile}/Dockerfile")).to eql(true)
|
20
|
+
expect(File.exist?("#{nude_pathfile}/docker-compose.yml")).to eql(true)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'Contains the word Gemfile' do
|
24
|
+
whales.dockerize pathfile
|
25
|
+
expect(File.exist?('example/Dockerfile')).to eql(true)
|
26
|
+
expect(File.exist?('example/docker-compose.yml')).to eql(true)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/whales.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'whales/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'whally'
|
8
|
+
spec.version = Whales::VERSION
|
9
|
+
spec.authors = ['Abraham Kuri']
|
10
|
+
spec.email = ['kurenn@icalialabs.com']
|
11
|
+
|
12
|
+
spec.summary = 'A ruby gem to dockerize applications'
|
13
|
+
spec.description = 'A ruby gem to set any application on a nice whale'
|
14
|
+
spec.homepage = 'https://github.com/IcaliaLabs/whales'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
#else
|
22
|
+
# raise 'RubyGems 2.0 or newer is required to \
|
23
|
+
# protect against public gem pushes.'
|
24
|
+
#end
|
25
|
+
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0")
|
28
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
29
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
33
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
34
|
+
spec.add_development_dependency 'rspec'
|
35
|
+
spec.add_development_dependency 'pry'
|
36
|
+
spec.add_development_dependency 'rubocop'
|
37
|
+
spec.add_development_dependency 'reek'
|
38
|
+
|
39
|
+
spec.add_dependency 'rest-client'
|
40
|
+
spec.add_dependency 'thor'
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: whally
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Abraham Kuri
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-25 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.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: reek
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rest-client
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: thor
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: A ruby gem to set any application on a nice whale
|
126
|
+
email:
|
127
|
+
- kurenn@icalialabs.com
|
128
|
+
executables:
|
129
|
+
- whales
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".travis.yml"
|
136
|
+
- CODE_OF_CONDUCT.md
|
137
|
+
- Dockerfile
|
138
|
+
- Gemfile
|
139
|
+
- Gemfile2
|
140
|
+
- LICENSE.txt
|
141
|
+
- README.md
|
142
|
+
- Rakefile
|
143
|
+
- bin/whales
|
144
|
+
- development-entrypoint.sh
|
145
|
+
- docker-compose.yml
|
146
|
+
- example/Dockerfile
|
147
|
+
- example/Gemfile
|
148
|
+
- example/docker-compose.yml
|
149
|
+
- lib/whales.rb
|
150
|
+
- lib/whales/builder.rb
|
151
|
+
- lib/whales/calves/docker_compose/default.calf
|
152
|
+
- lib/whales/calves/entrypoint/rails.calf
|
153
|
+
- lib/whales/calves/postgresql/postgis.calf
|
154
|
+
- lib/whales/calves/postgresql/postgresql.calf
|
155
|
+
- lib/whales/dockerfiler.rb
|
156
|
+
- lib/whales/gemline.rb
|
157
|
+
- lib/whales/gems_extractor.rb
|
158
|
+
- lib/whales/service_decomposer.rb
|
159
|
+
- lib/whales/version.rb
|
160
|
+
- lib/whales/volume_decomposer.rb
|
161
|
+
- spec/spec_helper.rb
|
162
|
+
- spec/whales_spec.rb
|
163
|
+
- whales.gemspec
|
164
|
+
homepage: https://github.com/IcaliaLabs/whales
|
165
|
+
licenses:
|
166
|
+
- MIT
|
167
|
+
metadata: {}
|
168
|
+
post_install_message:
|
169
|
+
rdoc_options: []
|
170
|
+
require_paths:
|
171
|
+
- lib
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
requirements: []
|
183
|
+
rubyforge_project:
|
184
|
+
rubygems_version: 2.6.3
|
185
|
+
signing_key:
|
186
|
+
specification_version: 4
|
187
|
+
summary: A ruby gem to dockerize applications
|
188
|
+
test_files:
|
189
|
+
- spec/spec_helper.rb
|
190
|
+
- spec/whales_spec.rb
|