mina-lock 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a64d7dfbc919d8ef24131b9ddcd3d6efe7d759e
4
+ data.tar.gz: e98ee0bcc392b45a2f1069903c74f14a9cca7658
5
+ SHA512:
6
+ metadata.gz: a5d51eb7480179dec9190cf65c5e3c0134f2da8933aba13fef418eeac38a4d0206c0393490a9391b16bf7d93241cd7750f9805b5064f2a79f36a8dbfc789c795
7
+ data.tar.gz: 9b9d31925427000fb4ec1bfa5e455b149ea52b52e9db2a9db21d2f2f9764b67bba50b8c09b2bf40b31eb4a511120ca4ac96b162fc0943f4d718264e026f5d2b2
@@ -0,0 +1,4 @@
1
+ pkg
2
+ .ruby-version
3
+ .bundle
4
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2017 Lorenzo Sinisi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,50 @@
1
+ # Mina Lock
2
+
3
+ Lock the deployment of your app using mina.
4
+
5
+ Quite often I found myself in need to ask other developers to not deploy a specific app for some time. Usually I have used slack or other chat channels for that purpose but it is not efficient and you need to read updates from the channel in order to know if it is 'ok' to deploy or not.
6
+
7
+ This gems adds 2 task to manually 'lock' and 'unlock' the deployment of mina creating a file called 'deployment.lock' that should be checked before each deployment, using the task 'fail:when_locked'.
8
+
9
+ ## Installation
10
+
11
+ Via Bundler:
12
+
13
+ ```ruby
14
+ # Gemfile
15
+ gem 'mina-lock', require: false
16
+ ```
17
+
18
+
19
+ ## Usage example
20
+
21
+ ```ruby
22
+ # config/deploy.rb
23
+
24
+ require 'mina/lock'
25
+
26
+ ... other options
27
+
28
+ task deploy: :environment do
29
+ deploy do
30
+ invoke 'fail:when_locked' # should be the first thing you want to check
31
+ invoke 'git:clone'
32
+ ...
33
+ end
34
+ end
35
+ ```
36
+
37
+ ## Tasks
38
+
39
+ ```
40
+ mina lock:deployment # Locks the deployment
41
+ mina unlock:deployment # Unlocks the deployment
42
+ ```
43
+
44
+ ## TODOs
45
+
46
+ - write in the lock file the name of the user who locked the deployment (reading it from the context)
47
+
48
+ ## Contributing
49
+
50
+ Feel free to contribute!
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+
@@ -0,0 +1,2 @@
1
+ require 'mina/lock/version'
2
+ require 'mina/lock/tasks'
@@ -0,0 +1,32 @@
1
+ require 'mina/bundler'
2
+
3
+ namespace :lock do
4
+ desc 'Lock deployment'
5
+ task deployment: :environment do
6
+ queue %[echo '-----> Locking deployment (manually)']
7
+ queue! "touch #{deploy_to}/#{current_path}/deployment.lock"
8
+ end
9
+ end
10
+
11
+ namespace :unlock do
12
+ desc 'Unlock deployment'
13
+ task deployment: :environment do
14
+ queue %[echo '-----> Unlock deployment (manually)']
15
+ queue! "rm -f #{deploy_to}/#{current_path}/deployment.lock"
16
+ end
17
+ end
18
+
19
+ namespace :fail do
20
+ desc 'Check if the deployment is permitted'
21
+ task when_locked: :environment do
22
+ queue %[echo '-----> Check that the deployment is not manually locked']
23
+ queue! %[
24
+ FILE=#{deploy_to}/#{current_path}/deployment.lock
25
+ if [ -f "$FILE" ];
26
+ then
27
+ echo "The deployment of this project is currently locked. File $FILE exist."
28
+ exit 17
29
+ fi
30
+ ]
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ module Mina
2
+ module Lock
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'mina/lock/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'mina-lock'
9
+ spec.version = Mina::Lock::VERSION
10
+ spec.authors = ['Lorenzo Sinisi']
11
+ spec.email = ['info@lorenzosinisi.com']
12
+ spec.summary = 'Lock the deplyment with mina'
13
+ spec.description = ''
14
+ spec.homepage = 'https://github.com/lorenzosinisi/mina-lock'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.6'
23
+ spec.add_development_dependency 'rake'
24
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-lock
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Lorenzo Sinisi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-21 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.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: ''
42
+ email:
43
+ - info@lorenzosinisi.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/mina/lock.rb
54
+ - lib/mina/lock/tasks.rb
55
+ - lib/mina/lock/version.rb
56
+ - mina-lock.gemspec
57
+ homepage: https://github.com/lorenzosinisi/mina-lock
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.2.2
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Lock the deplyment with mina
81
+ test_files: []