mina-proteus 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +16 -9
- data/lib/mina/proteus.rb +13 -7
- data/lib/mina/proteus/version.rb +2 -2
- data/mina_proteus.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 919c886601e153876d057aa6a73162ecea6dfe5dc3deec3ad662df23cb7f0988
|
4
|
+
data.tar.gz: a0d2da436e1840c9f500e6481b68e49f23a5736924eb2684769e05cec33c4c0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de1870b85fcaebd04ea8d408416c81b1984676f7ceaa25b28eedd282b67beb69e64df2a946fa6db21db662eebe160f202cc1e7af235fd568176ab734eed42533
|
7
|
+
data.tar.gz: 46e41a8eb2c826386461263255b50f6b6929d11d6028b245ba73ad237529a102aed973f29b5c7887a436430fe592fa8b2544531d80ce118d062ceffd59df7626
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/mina-
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/mina-proteus.svg)](https://badge.fury.io/rb/mina-proteus) ![Gem](https://img.shields.io/gem/dt/mina-proteus.svg?color=brightgreen)
|
2
2
|
|
3
3
|
# Mina::Proteus
|
4
4
|
|
5
|
-
Plugin for Mina that adds support for multiple stages and multiple apps to Mina, specifically built for Hanami ruby framework.
|
5
|
+
Plugin for Mina that adds support for multiple stages and multiple apps to Mina, specifically built for [Hanami ruby framework](https://hanamirb.org/).
|
6
6
|
This gem is based on [endoze's mina-multistage gem](https://github.com/endoze/mina-multistage), huge thanks to him!
|
7
7
|
|
8
8
|
## Installation & Usage
|
@@ -28,6 +28,8 @@ $ gem install mina-proteus
|
|
28
28
|
Require `mina/proteus` in your `config/deploy.rb`:
|
29
29
|
|
30
30
|
```rb
|
31
|
+
# config/deploy.rb
|
32
|
+
|
31
33
|
require 'mina/proteus'
|
32
34
|
require 'mina/bundler'
|
33
35
|
require 'mina/git'
|
@@ -46,6 +48,8 @@ end
|
|
46
48
|
You then need to specify your hanami apps like this:
|
47
49
|
|
48
50
|
```rb
|
51
|
+
# config/deploy.rb
|
52
|
+
|
49
53
|
set :hanami_apps, %w(app1 app2 app3)
|
50
54
|
```
|
51
55
|
|
@@ -54,12 +58,14 @@ That's the only required parameter, optional parameters are:
|
|
54
58
|
```rb
|
55
59
|
# config/deploy.rb
|
56
60
|
|
57
|
-
set :stages, %w(staging production)
|
58
|
-
set :stages_dir, 'config/deploy'
|
59
|
-
set :default_stage, 'staging'
|
61
|
+
set :stages, %w(staging production) #specify your stages
|
62
|
+
set :stages_dir, 'config/deploy' #specify which directory will have all the configurations files
|
63
|
+
set :default_stage, 'staging' #specify your default stage
|
60
64
|
|
61
|
-
|
65
|
+
#this is used to deploy a single application in a specific environment
|
66
|
+
set :bundle_prefix, -> { %{HANAMI_ENV="#{fetch(:current_stage)}" HANAMI_APPS="#{fetch(:current_app)}" #{fetch(:bundle_bin)} exec} }
|
62
67
|
```
|
68
|
+
Note that `current_stage` and `current_app` are respectively the stage and the application being called.
|
63
69
|
|
64
70
|
Then to create every file run:
|
65
71
|
|
@@ -74,7 +80,7 @@ Use them to define stage and app specific configuration.
|
|
74
80
|
Now you can deploy the default stage with:
|
75
81
|
|
76
82
|
```shell
|
77
|
-
$ mina <APP-NAME> deploy # this deploys
|
83
|
+
$ mina <APP-NAME> deploy # this deploys to :default_stage
|
78
84
|
```
|
79
85
|
|
80
86
|
Or specify a stage explicitly:
|
@@ -84,5 +90,6 @@ $ mina staging <APP-NAME> deploy
|
|
84
90
|
$ mina production <APP-NAME> deploy
|
85
91
|
```
|
86
92
|
|
87
|
-
|
88
|
-
I'll be
|
93
|
+
# Maintenance and Contribution
|
94
|
+
I'll be rarely maintaining this source code due to lack of time, but i will do as much as i can to resolve any open issues.
|
95
|
+
If you want to contribute, feel free to fork it, branch it and to create a pull request.
|
data/lib/mina/proteus.rb
CHANGED
@@ -55,6 +55,10 @@ def _argument_included_in_stages?(arg)
|
|
55
55
|
fetch(:all_stages).include?(arg)
|
56
56
|
end
|
57
57
|
|
58
|
+
def _argument_included_in_apps?(arg)
|
59
|
+
fetch(:all_apps).include?(arg)
|
60
|
+
end
|
61
|
+
|
58
62
|
set :all_stages, _get_all_stages if _all_stages_empty?
|
59
63
|
set :all_apps, _get_all_apps if _apps_empty?
|
60
64
|
|
@@ -65,14 +69,14 @@ fetch(:all_stages).each do |stage_name|
|
|
65
69
|
file = "#{_stages_dir}/#{fetch(:current_stage)}.rb"
|
66
70
|
load file
|
67
71
|
end
|
72
|
+
end
|
68
73
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
74
|
+
fetch(:all_apps).each do |app_name|
|
75
|
+
desc "Set the target app to '#{app_name}'."
|
76
|
+
task(app_name) do
|
77
|
+
set :current_app, app_name
|
78
|
+
file = "#{_stages_dir}/#{fetch(:current_stage)}/#{fetch(:current_app)}.rb"
|
79
|
+
load file
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
@@ -80,8 +84,10 @@ _potential_stage = ARGV.first
|
|
80
84
|
|
81
85
|
if _stage_file_exists?(_potential_stage) && _argument_included_in_stages?(_potential_stage)
|
82
86
|
invoke _potential_stage
|
87
|
+
invoke ARGV[1] if _app_file_in_stage_exists?(_potential_stage, ARGV[1]) && _argument_included_in_apps?(ARGV[1])
|
83
88
|
elsif _stage_file_exists?(_default_stage)
|
84
89
|
invoke _default_stage
|
90
|
+
invoke ARGV[0] if _app_file_in_stage_exists?(_default_stage, ARGV[0]) && _argument_included_in_apps?(ARGV[0])
|
85
91
|
end
|
86
92
|
|
87
93
|
namespace :proteus do
|
data/lib/mina/proteus/version.rb
CHANGED
data/mina_proteus.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'mina/proteus/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "mina-proteus"
|
8
|
-
spec.version = Mina::
|
8
|
+
spec.version = Mina::Proteus::VERSION
|
9
9
|
spec.authors = ["apontini"]
|
10
10
|
spec.email = ["alberto.pontini@gmail.com"]
|
11
11
|
spec.description = %q{Adds multistage and multiapps capabilities to Mina, specifically built for Hanami ruby framework}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mina-proteus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- apontini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mina
|