locum 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/locum/cap.rb +41 -0
- data/lib/locum/cli.rb +6 -0
- data/lib/locum/version.rb +1 -1
- data/templates/capfile.erb +13 -0
- data/templates/deploy.erb +80 -0
- data/templates/locum.erb +2 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a3da1fb46de18e1153f6f9040d9ed40d61e07bf
|
4
|
+
data.tar.gz: 14eae528ba552220935163b141906b3ef74ff624
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47306a6157dd4298ea2f93eaada805b13e31537821e238834590bd4323e4a4422267f9fd07f597b68de5754a60df76a0693608acf1b1defad5ea3c746a9a8dea
|
7
|
+
data.tar.gz: f35214bd30fa4a23be0a6ad244043e2b6f9d5762fc4d7e56ed504cf228271a8f9d90418664da20b8338686c5959eb8d8de9e2c135ec5ca8599e73656046c349c
|
data/lib/locum/cap.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module Locum
|
4
|
+
class Cap < Thor::Group
|
5
|
+
include Thor::Actions
|
6
|
+
|
7
|
+
def self.source_root
|
8
|
+
File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
9
|
+
end
|
10
|
+
|
11
|
+
def arguments
|
12
|
+
hu = Locum::HostingUnit.get
|
13
|
+
ping = Locum::Ping.new
|
14
|
+
|
15
|
+
ping.call
|
16
|
+
|
17
|
+
@login = ping.login
|
18
|
+
@project = File.basename(Dir.pwd)
|
19
|
+
@user = hu.login
|
20
|
+
@server = hu.server
|
21
|
+
|
22
|
+
@cap_version = Gem::Specification.find_by_name('capistrano').version.to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
def capfile
|
26
|
+
template('templates/capfile.erb', 'Capfile')
|
27
|
+
end
|
28
|
+
|
29
|
+
def deploy_rb
|
30
|
+
template('templates/deploy.erb', 'config/deploy.rb')
|
31
|
+
end
|
32
|
+
|
33
|
+
def locum_stage
|
34
|
+
template('templates/locum.erb', 'config/deploy/locum.rb')
|
35
|
+
end
|
36
|
+
|
37
|
+
def ssh_key
|
38
|
+
Locum::CLI.start(['ssh_key', 'add'])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/locum/cli.rb
CHANGED
@@ -85,6 +85,12 @@ EOFBLOCK
|
|
85
85
|
projects.projects.each { |p| say(" * #{p['name']} (##{p['id']} #{p['type']})") }
|
86
86
|
end
|
87
87
|
|
88
|
+
desc 'cap', 'Настройка проекта для работы с Capistrano'
|
89
|
+
|
90
|
+
def cap
|
91
|
+
Locum::Cap.start
|
92
|
+
end
|
93
|
+
|
88
94
|
desc 'ssh_key', 'Работа с ключами'
|
89
95
|
subcommand 'ssh_key', SshKey
|
90
96
|
end
|
data/lib/locum/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Load DSL and set up stages
|
2
|
+
require 'capistrano/setup'
|
3
|
+
|
4
|
+
# Include default deployment tasks
|
5
|
+
require 'capistrano/deploy'
|
6
|
+
|
7
|
+
require 'capistrano/rvm'
|
8
|
+
require 'capistrano/bundler'
|
9
|
+
require 'capistrano/rails/assets'
|
10
|
+
require 'capistrano/rails/migrations'
|
11
|
+
|
12
|
+
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
13
|
+
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# config valid only for Capistrano 3
|
3
|
+
lock '<%= @cap_version %>'
|
4
|
+
|
5
|
+
# Project configuration options
|
6
|
+
# ------------------------------
|
7
|
+
|
8
|
+
set :application, '<%= @project %>'
|
9
|
+
set :login, '<%= @login %>'
|
10
|
+
set :user, '<%= @user %>'
|
11
|
+
|
12
|
+
set :deploy_to, "/home/#{fetch(:user)}/projects/#{fetch(:application)}"
|
13
|
+
set :unicorn_conf, "/etc/unicorn/#{fetch(:application)}.#{fetch(:login)}.rb"
|
14
|
+
set :unicorn_pid, "/var/run/unicorn/#{fetch(:user)}/" \
|
15
|
+
"#{fetch(:application)}.#{fetch(:login)}.pid"
|
16
|
+
set :bundle_without, [:development, :test]
|
17
|
+
set :use_sudo, false
|
18
|
+
|
19
|
+
set :repo_url, "#{fetch(:user)}@<%= @server %>:" \
|
20
|
+
"git/#{fetch(:application)}.git"
|
21
|
+
|
22
|
+
# Default branch is :master
|
23
|
+
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
|
24
|
+
|
25
|
+
set :scm, :git
|
26
|
+
set :format, :pretty
|
27
|
+
set :pty, true
|
28
|
+
|
29
|
+
# Change the verbosity level
|
30
|
+
set :log_level, :info
|
31
|
+
|
32
|
+
# Default value for :linked_files is []
|
33
|
+
# set :linked_files, %w{config/database.yml}
|
34
|
+
|
35
|
+
# Default value for linked_dirs is []
|
36
|
+
set :linked_dirs, %w(bin log tmp/cache vendor/bundle public/system)
|
37
|
+
|
38
|
+
# Default value for keep_releases is 5
|
39
|
+
# set :keep_releases, 5
|
40
|
+
|
41
|
+
# You unlikely have to change below this line
|
42
|
+
# -----------------------------------------------------------------------------
|
43
|
+
|
44
|
+
# Configure RVM
|
45
|
+
set :rvm_ruby_version, '2.1.5'
|
46
|
+
set :rake, "rvm use #{fetch(:rvm_ruby_version)} do bundle exec rake"
|
47
|
+
set :bundle_cmd, "rvm use #{fetch(:rvm_ruby_version)} do bundle"
|
48
|
+
|
49
|
+
set :unicorn_start_cmd,
|
50
|
+
"(cd #{fetch(:deploy_to)}/current; rvm use #{fetch(:rvm_ruby_version)} " \
|
51
|
+
"do bundle exec unicorn_rails -Dc #{fetch(:unicorn_conf)})"
|
52
|
+
|
53
|
+
# - for unicorn - #
|
54
|
+
namespace :deploy do
|
55
|
+
desc 'Start application'
|
56
|
+
task :start do
|
57
|
+
on roles(:app) do
|
58
|
+
execute unicorn_start_cmd
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
desc 'Stop application'
|
63
|
+
task :stop do
|
64
|
+
on roles(:app) do
|
65
|
+
execute "[ -f #{fetch(:unicorn_pid)} ] && " \
|
66
|
+
"kill -QUIT `cat #{fetch(:unicorn_pid)}`"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
after :publishing, :restart
|
71
|
+
|
72
|
+
desc 'Restart Application'
|
73
|
+
task :restart do
|
74
|
+
on roles(:app) do
|
75
|
+
execute "[ -f #{fetch(:unicorn_pid)} ] && " \
|
76
|
+
"kill -USR2 `cat #{fetch(:unicorn_pid)}` || " \
|
77
|
+
"#{fetch(:unicorn_start_cmd)}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/templates/locum.erb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Shmelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- lib/locum/api.rb
|
127
127
|
- lib/locum/api_error.rb
|
128
128
|
- lib/locum/auth.rb
|
129
|
+
- lib/locum/cap.rb
|
129
130
|
- lib/locum/cli.rb
|
130
131
|
- lib/locum/config.rb
|
131
132
|
- lib/locum/config_builder.rb
|
@@ -135,6 +136,9 @@ files:
|
|
135
136
|
- lib/locum/ssh.rb
|
136
137
|
- lib/locum/version.rb
|
137
138
|
- locum.gemspec
|
139
|
+
- templates/capfile.erb
|
140
|
+
- templates/deploy.erb
|
141
|
+
- templates/locum.erb
|
138
142
|
homepage: https://github.com/locumru/locum
|
139
143
|
licenses:
|
140
144
|
- MIT
|
@@ -155,9 +159,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
159
|
version: '0'
|
156
160
|
requirements: []
|
157
161
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.
|
162
|
+
rubygems_version: 2.4.8
|
159
163
|
signing_key:
|
160
164
|
specification_version: 4
|
161
165
|
summary: Locum.ru maintenance interface
|
162
166
|
test_files: []
|
163
|
-
has_rdoc:
|