mina 1.0.0.beta5 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/deploy.rb +6 -3
- data/docs/faq.md +14 -2
- data/docs/writing_your_own_tasks.md +2 -0
- data/lib/mina/commands.rb +3 -1
- data/lib/mina/dsl.rb +2 -1
- data/lib/mina/helpers/internal.rb +8 -0
- data/lib/mina/helpers/output.rb +5 -1
- data/lib/mina/version.rb +1 -1
- data/spec/lib/mina/backend/remote_spec.rb +2 -2
- data/spec/lib/mina/commands_spec.rb +1 -0
- data/spec/support/outputs/rvm_use.txt +1 -1
- data/spec/support/outputs/ssh_keyscan_repo.txt +3 -0
- data/spec/tasks/default_spec.rb +2 -2
- data/tasks/mina/bundler.rb +1 -1
- data/tasks/mina/chruby.rb +4 -2
- data/tasks/mina/default.rb +25 -10
- data/tasks/mina/deploy.rb +7 -13
- data/tasks/mina/git.rb +13 -9
- data/tasks/mina/rails.rb +14 -10
- data/tasks/mina/rbenv.rb +4 -2
- data/tasks/mina/rvm.rb +13 -9
- data/tasks/mina/ry.rb +8 -4
- data/test_env/config/deploy.rb +11 -3
- metadata +3 -3
- data/spec/support/outputs/ssh_keyscan.txt +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a7c410dc64508ec92e7da848bb91e20a0babf27
|
4
|
+
data.tar.gz: ba50cfea30e84ea35ef63a73ec56d333b7337017
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e980ae3ca911da9856e7cb0bb91601fb2a92f040a2b9238af5b8374df59d6189c06f56d1a8c32278caaeb78a8204610bd6351dbb68070b10f9e8471d4d8e3427
|
7
|
+
data.tar.gz: b34b69d72b963c00779e976b3d8711d51977f1e333b506c66dda63ed395260dbda17d46a747a4813b291e11cc53a649f1c4441b90adc4e81041743b14ba67f2d
|
data/data/deploy.rb
CHANGED
@@ -23,7 +23,7 @@ set :branch, 'master'
|
|
23
23
|
# set :shared_dirs, fetch(:shared_dirs, []).push('config')
|
24
24
|
# set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/secrets.yml')
|
25
25
|
|
26
|
-
# This task is the environment that is loaded
|
26
|
+
# This task is the environment that is loaded all remote run commands, such as
|
27
27
|
# `mina deploy` or `mina rake`.
|
28
28
|
task :environment do
|
29
29
|
# If you're using rbenv, use this to load the rbenv environment.
|
@@ -36,12 +36,12 @@ end
|
|
36
36
|
|
37
37
|
# Put any custom commands you need to run at setup
|
38
38
|
# All paths in `shared_dirs` and `shared_paths` will be created on their own.
|
39
|
-
task setup
|
39
|
+
task :setup do
|
40
40
|
# command %{rbenv install 2.3.0}
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "Deploys the current version to the server."
|
44
|
-
task deploy
|
44
|
+
task :deploy do
|
45
45
|
# uncomment this line to make sure you pushed your local branch to the remote origin
|
46
46
|
# invoke :'git:ensure_pushed'
|
47
47
|
deploy do
|
@@ -61,6 +61,9 @@ task deploy: :environment do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
# you can use `run :local` to run tasks on local machine before of after the deploy scripts
|
66
|
+
# run :local { say 'done' }
|
64
67
|
end
|
65
68
|
|
66
69
|
# For help in making your deploy script, see the Mina documentation:
|
data/docs/faq.md
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
Frequently Asked Questions
|
2
2
|
--------------------
|
3
3
|
|
4
|
-
|
4
|
+
## - `command not found: bundle`
|
5
5
|
|
6
|
-
You need to setup your server correctly [getting_started.md#step-0-configure-server
|
6
|
+
You need to setup your server correctly [getting started](getting_started.md#step-0-configure-server), then install bundler.
|
7
7
|
|
8
8
|
gem install bundler
|
9
9
|
|
10
|
+
## - ruby version not found, but is already installed
|
10
11
|
|
12
|
+
Mina is running in a non-interactive ssh mode. That means that your full profile will not be loaded: ![ssh](http://capistranorb.com/images/BashStartupFiles1.png)
|
13
|
+
|
14
|
+
if you setup your server correctly and you are using a ruby environment manager please ensure that:
|
15
|
+
- you are using a mina plugin for that manager or
|
16
|
+
- the lines that load up your manager are at the top of your .bashrc file: http://stackoverflow.com/a/216204/1339894
|
17
|
+
|
18
|
+
## - Mina hangs after i type my password in
|
19
|
+
|
20
|
+
Mina assumes that you have set up the communication with your server though public/private keys, not password. If you want to use password you will have to change execution mode:
|
21
|
+
|
22
|
+
set :execution_mode, :system
|
11
23
|
|
12
24
|
# WIP
|
@@ -46,6 +46,8 @@ Adds a command to the command queue.
|
|
46
46
|
|
47
47
|
This queues code to be run on the current queue name (defaults to `:default`).
|
48
48
|
|
49
|
+
By default, whitespace is stripped from the beginning and end of the command.
|
50
|
+
|
49
51
|
``` ruby
|
50
52
|
command 'ls -al' # => [ls -al]
|
51
53
|
```
|
data/lib/mina/commands.rb
CHANGED
@@ -12,7 +12,8 @@ module Mina
|
|
12
12
|
@queue = Hash.new { |hash, key| hash[key] = [] }
|
13
13
|
end
|
14
14
|
|
15
|
-
def command(code, quiet: false, indent: nil)
|
15
|
+
def command(code, strip: true, quiet: false, indent: nil)
|
16
|
+
code = unindent(code) if strip
|
16
17
|
code = indent(indent, code) if indent
|
17
18
|
queue[stage] << (quiet ? code : echo_cmd(code))
|
18
19
|
end
|
@@ -39,6 +40,7 @@ module Mina
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def run(backend)
|
43
|
+
return if queue.empty?
|
42
44
|
report_time do
|
43
45
|
status = Mina::Runner.new(process, backend).run
|
44
46
|
error! 'Run Error' unless status
|
data/lib/mina/dsl.rb
CHANGED
data/lib/mina/helpers/output.rb
CHANGED
data/lib/mina/version.rb
CHANGED
@@ -7,12 +7,12 @@ describe Mina::Backend::Remote do
|
|
7
7
|
|
8
8
|
describe '#prepare' do
|
9
9
|
it 'escpaces shellwords' do
|
10
|
-
expect(backend.prepare).to eq("ssh localhost -tt -- \\[\\\"ls\\ -al\\\"\\]")
|
10
|
+
expect(backend.prepare).to eq("ssh localhost -p 22 -tt -- \\[\\\"ls\\ -al\\\"\\]")
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'adds debug if simualte' do
|
14
14
|
Mina::Configuration.instance.set(:simulate, true)
|
15
|
-
expect(backend.prepare).to eq("#!/usr/bin/env bash\n# Executing the following via 'ssh localhost -tt':\n#\nls -al\n ")
|
15
|
+
expect(backend.prepare).to eq("#!/usr/bin/env bash\n# Executing the following via 'ssh localhost -p 22 -tt':\n#\nls -al\n ")
|
16
16
|
Mina::Configuration.instance.remove(:simulate)
|
17
17
|
end
|
18
18
|
end
|
@@ -1 +1 @@
|
|
1
|
-
echo\ "\-\-\-\-\->\ Using\ RVM\ environment\ \\\"123\\\"\"\s*if\ \[\[\ !\ \-s\ "\$HOME/\.rvm/scripts/rvm"\ \]\];\ then\s*echo\ "!\ Ruby\ Version\ Manager\ not\ found"\s*echo\ "!\ If\ RVM\ is\ installed,\ check\ your\ :
|
1
|
+
echo\ "\-\-\-\-\->\ Using\ RVM\ environment\ \\\"123\\\"\"\s*if\ \[\[\ !\ \-s\ "\$HOME/\.rvm/scripts/rvm"\ \]\];\ then\s*echo\ "!\ Ruby\ Version\ Manager\ not\ found"\s*echo\ "!\ If\ RVM\ is\ installed,\ check\ your\ :rvm_use_path\ setting\."\s*exit 1\s*fi\s*source\ \$HOME/\.rvm/scripts/rvm\n\s*echo\ \"\-\-\-\-\-\>\ rvm\ use\ \\\"123\\\"\ \-\-create\"
|
data/spec/tasks/default_spec.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe 'default', type: :rake do
|
4
|
-
describe '
|
4
|
+
describe 'ssh_keyscan_repo' do
|
5
5
|
it 'scans ssh' do
|
6
|
-
expect { invoke_all }.to output(output_file('
|
6
|
+
expect { invoke_all }.to output(output_file('ssh_keyscan_repo')).to_stdout
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
data/tasks/mina/bundler.rb
CHANGED
@@ -8,7 +8,7 @@ set :shared_dirs, fetch(:shared_dirs, []).push(fetch(:bundle_path))
|
|
8
8
|
|
9
9
|
namespace :bundle do
|
10
10
|
desc 'Install gem dependencies using Bundler.'
|
11
|
-
task install
|
11
|
+
task :install do
|
12
12
|
comment %{Installing gem dependencies using Bundler}
|
13
13
|
command %{#{fetch(:bundle_bin)} install #{fetch(:bundle_options)}}
|
14
14
|
end
|
data/tasks/mina/chruby.rb
CHANGED
@@ -8,10 +8,12 @@ task :chruby, :env do |_, args|
|
|
8
8
|
end
|
9
9
|
|
10
10
|
comment %{chruby to version: \\"#{args[:env]}\\"}
|
11
|
-
command %{
|
11
|
+
command %{
|
12
|
+
if [[ ! -s "#{fetch(:chruby_path)}" ]]; then
|
12
13
|
echo "! chruby.sh init file not found"
|
13
14
|
exit 1
|
14
|
-
fi
|
15
|
+
fi
|
16
|
+
}
|
15
17
|
command %{source #{fetch(:chruby_path)}}
|
16
18
|
command %{chruby "#{args[:env]}" || exit 1}
|
17
19
|
end
|
data/tasks/mina/default.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
+
set :port, 22
|
2
|
+
|
1
3
|
task :environment do
|
2
4
|
end
|
3
5
|
|
4
|
-
task run_commands
|
5
|
-
commands.run(:remote)
|
6
|
+
task :run_commands do
|
7
|
+
commands.run(:remote)
|
6
8
|
end
|
7
9
|
|
8
10
|
task :reset! do
|
9
11
|
reset!
|
10
12
|
end
|
11
13
|
|
12
|
-
task debug_configuration_variables
|
14
|
+
task :debug_configuration_variables do
|
13
15
|
if fetch(:debug_configuration_variables)
|
14
16
|
puts
|
15
17
|
puts '------- Printing current config variables -------'
|
@@ -20,20 +22,33 @@ task debug_configuration_variables: :environment do
|
|
20
22
|
end
|
21
23
|
|
22
24
|
desc 'Adds current repo host to the known hosts'
|
23
|
-
task :
|
25
|
+
task :ssh_keyscan_repo do
|
24
26
|
ensure!(:repository)
|
25
27
|
repo_host = fetch(:repository).split(%r{@|://}).last.split(%r{:|\/}).first
|
26
28
|
repo_port = /:([0-9]+)/.match(fetch(:repository)) && /:([0-9]+)/.match(fetch(:repository))[1] || '22'
|
27
29
|
|
28
|
-
command %
|
29
|
-
if ! ssh-keygen -H
|
30
|
+
command %{
|
31
|
+
if ! ssh-keygen -H -F #{repo_host} &>/dev/null; then
|
30
32
|
ssh-keyscan -t rsa -p #{repo_port} -H #{repo_host} >> ~/.ssh/known_hosts
|
31
33
|
fi
|
32
|
-
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Adds domain known hosts'
|
38
|
+
task :ssh_keyscan_domain do
|
39
|
+
ensure!(:domain)
|
40
|
+
ensure!(:port)
|
41
|
+
run :local do
|
42
|
+
command %{
|
43
|
+
if ! ssh-keygen -H -F #{fetch(:domain)} &>/dev/null; then
|
44
|
+
ssh-keyscan -t rsa -p #{fetch(:port)} -H #{fetch(:domain)} >> ~/.ssh/known_hosts
|
45
|
+
fi
|
46
|
+
}
|
47
|
+
end
|
33
48
|
end
|
34
49
|
|
35
50
|
desc 'Runs a command in the server.'
|
36
|
-
task :run, [:command]
|
51
|
+
task :run, [:command] do |_, args|
|
37
52
|
ensure!(:deploy_to)
|
38
53
|
command = args[:command]
|
39
54
|
|
@@ -48,6 +63,6 @@ task :run, [:command] => [:environment] do |_, args|
|
|
48
63
|
end
|
49
64
|
|
50
65
|
desc 'Open an ssh session to the server and cd to deploy_to folder'
|
51
|
-
task ssh
|
52
|
-
exec Mina::Backend::Remote.new(nil).ssh
|
66
|
+
task :ssh do
|
67
|
+
exec %{#{Mina::Backend::Remote.new(nil).ssh} 'cd #{fetch(:deploy_to)} && exec $SHELL'}
|
53
68
|
end
|
data/tasks/mina/deploy.rb
CHANGED
@@ -11,13 +11,13 @@ set :execution_mode, :pretty
|
|
11
11
|
|
12
12
|
namespace :deploy do
|
13
13
|
desc 'Forces a deploy unlock.'
|
14
|
-
task force_unlock
|
14
|
+
task :force_unlock do
|
15
15
|
comment %{Unlocking}
|
16
16
|
command %{rm -f "#{fetch(:deploy_to)}/#{fetch(:lock_file)}"}
|
17
17
|
end
|
18
18
|
|
19
19
|
desc 'Links paths set in :shared_dirs and :shared_files.'
|
20
|
-
task link_shared_paths
|
20
|
+
task :link_shared_paths do
|
21
21
|
comment %{Symlinking shared paths}
|
22
22
|
|
23
23
|
fetch(:shared_dirs, []).each do |linked_dir|
|
@@ -32,7 +32,7 @@ namespace :deploy do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
desc 'Clean up old releases.'
|
35
|
-
task cleanup
|
35
|
+
task :cleanup do
|
36
36
|
ensure!(:keep_releases)
|
37
37
|
ensure!(:deploy_to)
|
38
38
|
|
@@ -46,7 +46,7 @@ namespace :deploy do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
desc 'Rollbacks the latest release'
|
49
|
-
task rollback
|
49
|
+
task :rollback do
|
50
50
|
comment %{Rolling back to previous release}
|
51
51
|
|
52
52
|
in_path "#{fetch(:releases_path)}" do
|
@@ -61,30 +61,24 @@ task rollback: :environment do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
desc 'Sets up a site.'
|
64
|
-
task setup
|
64
|
+
task :setup do
|
65
65
|
ensure!(:deploy_to)
|
66
66
|
|
67
67
|
comment %{Setting up #{fetch(:deploy_to)}}
|
68
68
|
command %{mkdir -p "#{fetch(:deploy_to)}"}
|
69
|
-
command %{chown -R $(whoami) "#{fetch(:deploy_to)}"}
|
70
|
-
command %{chmod g+rx,u+rwx "#{fetch(:deploy_to)}"}
|
71
69
|
command %{mkdir -p "#{fetch(:releases_path)}"}
|
72
|
-
command %{chmod g+rx,u+rwx "#{fetch(:releases_path)}"}
|
73
70
|
command %{mkdir -p "#{fetch(:shared_path)}"}
|
74
|
-
command %{chmod g+rx,u+rwx "#{fetch(:shared_path)}"}
|
75
71
|
|
76
72
|
in_path "#{fetch(:shared_path)}" do
|
77
73
|
fetch(:shared_dirs, []).each do |linked_dir|
|
78
74
|
command %{mkdir -p "#{linked_dir}"}
|
79
|
-
command %{chmod g+rx,u+rwx "#{linked_dir}"}
|
80
75
|
end
|
81
76
|
fetch(:shared_paths, []).each do |linked_path|
|
82
77
|
command %{mkdir -p "#{File.dirname(linked_path)}"}
|
83
|
-
command %{chmod g+rx,u+rwx "#{File.dirname(linked_path)}"}
|
84
78
|
end
|
85
79
|
end
|
86
80
|
|
87
|
-
command %{tree "#{fetch(:deploy_to)}"
|
81
|
+
command %{if [ -x "$(command -v tree)" ]; then tree -d -L 2 "#{fetch(:deploy_to)}"; else ls -al "#{fetch(:deploy_to)}"; fi}
|
88
82
|
|
89
|
-
invoke :
|
83
|
+
invoke :ssh_keyscan_repo
|
90
84
|
end
|
data/tasks/mina/git.rb
CHANGED
@@ -7,7 +7,7 @@ set :git_not_pushed_message, -> { "Your branch #{fetch(:branch)} needs to be pus
|
|
7
7
|
|
8
8
|
namespace :git do
|
9
9
|
desc 'Clones the Git repository to the release path.'
|
10
|
-
task clone
|
10
|
+
task :clone do
|
11
11
|
ensure!(:repository)
|
12
12
|
ensure!(:deploy_to)
|
13
13
|
if set?(:commit)
|
@@ -15,7 +15,8 @@ namespace :git do
|
|
15
15
|
command %{git clone "#{fetch(:repository)}" . --recursive}
|
16
16
|
command %{git checkout -b current_release "#{fetch(:commit)}" --force}
|
17
17
|
else
|
18
|
-
command %{
|
18
|
+
command %{
|
19
|
+
if [ ! -d "#{fetch(:deploy_to)}/scm/objects" ]; then
|
19
20
|
echo "-----> Cloning the Git repository"
|
20
21
|
#{echo_cmd %[git clone "#{fetch(:repository)}" "#{fetch(:deploy_to)}/scm" --bare]}
|
21
22
|
else
|
@@ -23,7 +24,8 @@ namespace :git do
|
|
23
24
|
#{echo_cmd %[(cd "#{fetch(:deploy_to)}/scm" && git fetch "#{fetch(:repository)}" "#{fetch(:branch)}:#{fetch(:branch)}" --force)]}
|
24
25
|
fi &&
|
25
26
|
echo "-----> Using git branch '#{fetch(:branch)}'" &&
|
26
|
-
#{echo_cmd %[git clone "#{fetch(:deploy_to)}/scm" . --recursive --branch "#{fetch(:branch)}"]}
|
27
|
+
#{echo_cmd %[git clone "#{fetch(:deploy_to)}/scm" . --recursive --branch "#{fetch(:branch)}"]}
|
28
|
+
}, quiet: true
|
27
29
|
end
|
28
30
|
|
29
31
|
comment %{Using this git commit}
|
@@ -34,18 +36,20 @@ namespace :git do
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
task revision
|
39
|
+
task :revision do
|
38
40
|
ensure!(:deploy_to)
|
39
41
|
command %{cat #{fetch(:current_path)}/.mina_git_revision}
|
40
42
|
end
|
41
43
|
|
42
|
-
task ensure_pushed
|
44
|
+
task :ensure_pushed do
|
43
45
|
run :local do
|
44
46
|
comment %{Ensuring everyting is pushed to git}
|
45
|
-
command %{
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
command %{
|
48
|
+
if [ $(git log #{fetch(:remote)}/#{fetch(:branch)}..#{fetch(:branch)} | wc -l) -ne 0 ]; then
|
49
|
+
echo "! #{fetch(:git_not_pushed_message)}"
|
50
|
+
exit 1
|
51
|
+
fi
|
52
|
+
}
|
49
53
|
end
|
50
54
|
end
|
51
55
|
end
|
data/tasks/mina/rails.rb
CHANGED
@@ -12,7 +12,7 @@ set :migration_dirs, ['db/migrate']
|
|
12
12
|
set :shared_dirs, fetch(:shared_dirs, []).push('log', 'tmp/cache', fetch(:compiled_asset_path))
|
13
13
|
|
14
14
|
desc 'Starts an interactive console.'
|
15
|
-
task console
|
15
|
+
task :console do
|
16
16
|
set :execution_mode, :exec
|
17
17
|
in_path "#{fetch(:current_path)}" do
|
18
18
|
command %{#{fetch(:rails)} console}
|
@@ -20,7 +20,7 @@ task console: :environment do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
desc 'Tail log from server'
|
23
|
-
task log
|
23
|
+
task :log do
|
24
24
|
set :execution_mode, :exec
|
25
25
|
in_path "#{fetch(:shared_path)}/log" do
|
26
26
|
command %{tail -f #{fetch(:rails_env)}.log}
|
@@ -29,7 +29,7 @@ end
|
|
29
29
|
|
30
30
|
namespace :rails do
|
31
31
|
desc 'Migrate database'
|
32
|
-
task db_migrate
|
32
|
+
task :db_migrate do
|
33
33
|
if fetch(:force_migrate)
|
34
34
|
comment %{Migrating database}
|
35
35
|
command %{#{fetch(:rake)} db:migrate}
|
@@ -44,19 +44,19 @@ namespace :rails do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
desc 'Create database'
|
47
|
-
task db_create
|
47
|
+
task :db_create do
|
48
48
|
comment %{Creating database}
|
49
49
|
command %{#{fetch(:rake)} db:create}
|
50
50
|
end
|
51
51
|
|
52
52
|
desc 'Rollback database'
|
53
|
-
task db_rollback
|
53
|
+
task :db_rollback do
|
54
54
|
comment %{Rollbacking database}
|
55
55
|
command %{#{fetch(:rake)} db:rollback}
|
56
56
|
end
|
57
57
|
|
58
58
|
desc 'Precompiles assets (skips if nothing has changed since the last release).'
|
59
|
-
task assets_precompile
|
59
|
+
task :assets_precompile do
|
60
60
|
if fetch(:force_asset_precompile)
|
61
61
|
comment %{Precompiling asset files}
|
62
62
|
command %{#{fetch(:rake)} assets:precompile}
|
@@ -76,17 +76,19 @@ def check_for_changes_script(options)
|
|
76
76
|
%{diff -qrN "#{fetch(:current_path)}/#{path}" "./#{path}" 2>/dev/null}
|
77
77
|
end.join(' && ')
|
78
78
|
|
79
|
-
%{
|
79
|
+
%{
|
80
|
+
if #{diffs}
|
80
81
|
then
|
81
82
|
#{options[:skip]}
|
82
83
|
else
|
83
84
|
#{options[:changed]}
|
84
|
-
fi
|
85
|
+
fi
|
86
|
+
}
|
85
87
|
end
|
86
88
|
|
87
89
|
# Macro used later by :rails, :rake, etc
|
88
90
|
make_run_task = lambda { |name, example|
|
89
|
-
task name, [:arguments]
|
91
|
+
task name, [:arguments] do |_, args|
|
90
92
|
set :execution_mode, :exec
|
91
93
|
|
92
94
|
arguments = args[:arguments]
|
@@ -94,7 +96,9 @@ make_run_task = lambda { |name, example|
|
|
94
96
|
puts %{You need to provide arguments. Try: mina "#{name}[#{example}]"}
|
95
97
|
exit 1
|
96
98
|
end
|
97
|
-
|
99
|
+
in_path "#{fetch(:current_path)}" do
|
100
|
+
command %(#{fetch(name)} #{arguments})
|
101
|
+
end
|
98
102
|
end
|
99
103
|
}
|
100
104
|
|
data/tasks/mina/rbenv.rb
CHANGED
@@ -4,10 +4,12 @@ task :'rbenv:load' do
|
|
4
4
|
comment %{Loading rbenv}
|
5
5
|
command %{export RBENV_ROOT="#{fetch(:rbenv_path)}"}
|
6
6
|
command %{export PATH="#{fetch(:rbenv_path)}/bin:$PATH"}
|
7
|
-
command %{
|
7
|
+
command %{
|
8
|
+
if ! which rbenv >/dev/null; then
|
8
9
|
echo "! rbenv not found"
|
9
10
|
echo "! If rbenv is installed, check your :rbenv_path setting."
|
10
11
|
exit 1
|
11
|
-
fi
|
12
|
+
fi
|
13
|
+
}
|
12
14
|
command %{eval "$(rbenv init -)"}
|
13
15
|
end
|
data/tasks/mina/rvm.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
set :
|
1
|
+
set :rvm_use_path, '$HOME/.rvm/scripts/rvm'
|
2
2
|
|
3
3
|
task :'rvm:use', :env do |_, args|
|
4
4
|
unless args[:env]
|
@@ -8,12 +8,14 @@ task :'rvm:use', :env do |_, args|
|
|
8
8
|
end
|
9
9
|
|
10
10
|
comment %{Using RVM environment \\\"#{args[:env]}\\\"}
|
11
|
-
command %{
|
11
|
+
command %{
|
12
|
+
if [[ ! -s "#{fetch(:rvm_use_path)}" ]]; then
|
12
13
|
echo "! Ruby Version Manager not found"
|
13
|
-
echo "! If RVM is installed, check your :
|
14
|
+
echo "! If RVM is installed, check your :rvm_use_path setting."
|
14
15
|
exit 1
|
15
|
-
fi
|
16
|
-
|
16
|
+
fi
|
17
|
+
}
|
18
|
+
command %{source #{fetch(:rvm_use_path)}}
|
17
19
|
comment %{rvm use \\"#{args[:env]}\\" --create}
|
18
20
|
end
|
19
21
|
|
@@ -25,11 +27,13 @@ task :'rvm:wrapper', :env, :name, :bin do |_, args|
|
|
25
27
|
end
|
26
28
|
|
27
29
|
comment %{creating RVM wrapper "#{args[:name]}_#{args[:bin]}" using \\"#{args[:env]}\\"}
|
28
|
-
command %{
|
30
|
+
command %{
|
31
|
+
if [[ ! -s "#{fetch(:rvm_use_path)}" ]]; then
|
29
32
|
echo "! Ruby Version Manager not found"
|
30
|
-
echo "! If RVM is installed, check your :
|
33
|
+
echo "! If RVM is installed, check your :rvm_use_path setting."
|
31
34
|
exit 1
|
32
|
-
fi
|
33
|
-
|
35
|
+
fi
|
36
|
+
}
|
37
|
+
command %{source #{fetch(:rvm_use_path)}}
|
34
38
|
command %{rvm wrapper #{args[:env]} #{args[:name]} #{args[:bin]} || exit 1}
|
35
39
|
end
|
data/tasks/mina/ry.rb
CHANGED
@@ -8,15 +8,19 @@ task :ry, :env do |_, args|
|
|
8
8
|
comment %{ry to version: \\"#{args[:env] || '**not specified**'}\\"}
|
9
9
|
comment %{Loading ry}
|
10
10
|
|
11
|
-
command %{
|
11
|
+
command %{
|
12
|
+
if [[ ! -e "#{fetch(:ry_path)}/bin" ]]; then
|
12
13
|
echo "! ry not found"
|
13
14
|
echo "! If ry is installed, check your :ry_path setting."
|
14
15
|
exit 1
|
15
|
-
fi
|
16
|
+
fi
|
17
|
+
}
|
16
18
|
command %{export PATH="#{fetch(:ry_path)}/bin:$PATH"}
|
17
19
|
command %{eval "$(ry setup)"}
|
18
20
|
command %{RY_RUBY="#{args[:env]}"}
|
19
|
-
command %{
|
21
|
+
command %{
|
22
|
+
if [ -n "$RY_RUBY" ]; then
|
20
23
|
#{echo_cmd 'ry use $RY_RUBY'} || exit 1
|
21
|
-
fi
|
24
|
+
fi
|
25
|
+
}
|
22
26
|
end
|
data/test_env/config/deploy.rb
CHANGED
@@ -19,7 +19,10 @@
|
|
19
19
|
|
20
20
|
require 'mina/git'
|
21
21
|
require 'mina/rails'
|
22
|
-
|
22
|
+
require 'mina/rvm'
|
23
|
+
require 'mina/rbenv'
|
24
|
+
require 'mina/chruby'
|
25
|
+
require 'pry'
|
23
26
|
#
|
24
27
|
|
25
28
|
set :domain, 'localhost'
|
@@ -29,11 +32,16 @@ set :shared_paths, ['config/database.yml', 'log']
|
|
29
32
|
set :keep_releases, 2
|
30
33
|
|
31
34
|
task :environment do
|
32
|
-
|
35
|
+
invoke :'rbenv:load'
|
36
|
+
invoke :'rvm:use', '123'
|
33
37
|
end
|
34
38
|
#
|
35
39
|
# desc "Deploys."
|
36
|
-
task deploy
|
40
|
+
task :deploy do
|
41
|
+
run :local do
|
42
|
+
puts 'buja'
|
43
|
+
end
|
44
|
+
|
37
45
|
deploy do
|
38
46
|
invoke :'git:clone'
|
39
47
|
invoke :'deploy:link_shared_paths'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stjepan Hadjić
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -177,7 +177,7 @@ files:
|
|
177
177
|
- spec/support/outputs/rvm_use.txt
|
178
178
|
- spec/support/outputs/ry.txt
|
179
179
|
- spec/support/outputs/setup.txt
|
180
|
-
- spec/support/outputs/
|
180
|
+
- spec/support/outputs/ssh_keyscan_repo.txt
|
181
181
|
- spec/support/rake_example_group.rb
|
182
182
|
- spec/tasks/bundler_spec.rb
|
183
183
|
- spec/tasks/default_spec.rb
|