mina-git-submodules 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +1 -0
- data/lib/mina/git-submodules/version.rb +5 -0
- data/lib/mina/git-submodules.rb +63 -0
- data/mina_git_submodules.gemspec +24 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 51c62b384f30f57ef317c92cc87f8262f933e763
|
4
|
+
data.tar.gz: 6f55142042acedaf388df2db69f4b50517a63568
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ab77ba5ec48615298ee665a314d564fe65e8856a78d5bb7c7f77d9d7a82dedeb6441527fd2de056382a41aea27e50b438daf9af5e86e07d194459d168122b002
|
7
|
+
data.tar.gz: b1dbd6345d9ab4a3d0fb0ce26cda13479deebcdc203da6fc42241ed312eb932141ee3993baaf9507e13e8945e28aba5935e052bc7e3813d3d780807df8d99450
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Chris Stephan
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Mina::GitSubmodules
|
2
|
+
|
3
|
+
Plugin for Mina that adds caching for git submodules when deploying
|
4
|
+
|
5
|
+
## Installation & Usage
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```rb
|
10
|
+
gem 'mina-git-submodules', require: false
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```shell
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```shell
|
22
|
+
$ gem install mina-git-submodules
|
23
|
+
```
|
24
|
+
|
25
|
+
replace `mina/git` with `mina/git-submodules` in your `config/deploy.rb`:
|
26
|
+
|
27
|
+
```rb
|
28
|
+
require 'mina/bundler'
|
29
|
+
require 'mina/rails'
|
30
|
+
require 'mina/git-submodules'
|
31
|
+
...
|
32
|
+
|
33
|
+
task setup: :environment do
|
34
|
+
...
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Deploys the current version to the server.'
|
38
|
+
task deploy: :environment do
|
39
|
+
...
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
For existing deploys remove the existing 'scm' folder.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'mina/default'
|
2
|
+
|
3
|
+
set :branch, 'master'
|
4
|
+
set :remove_git_dir, true
|
5
|
+
set :remote, 'origin'
|
6
|
+
set :git_not_pushed_message, -> { "Your branch #{fetch(:branch)} needs to be pushed to #{fetch(:remote)} before deploying" }
|
7
|
+
|
8
|
+
namespace :git do
|
9
|
+
desc 'Clones the Git repository to the release path.'
|
10
|
+
task :clone do
|
11
|
+
ensure!(:repository)
|
12
|
+
ensure!(:deploy_to)
|
13
|
+
ensure!(:branch)
|
14
|
+
if set?(:commit)
|
15
|
+
comment %{Using git commit \\"#{fetch(:commit)}\\"}
|
16
|
+
command %{git clone "#{fetch(:repository)}" . --recursive}
|
17
|
+
command %{git checkout -b current_release "#{fetch(:commit)}" --force}
|
18
|
+
else
|
19
|
+
command %{
|
20
|
+
if [ ! -d "#{fetch(:deploy_to)}/scm" ]; then
|
21
|
+
echo "-----> Cloning the Git repository"
|
22
|
+
#{echo_cmd %[git clone "#{fetch(:repository)}" "#{fetch(:deploy_to)}/scm" --recursive && (cd "#{fetch(:deploy_to)}/scm" && git checkout -b deploy #{fetch(:branch)})]}
|
23
|
+
else
|
24
|
+
echo "-----> Fetching new git commits"
|
25
|
+
#{echo_cmd %[(cd "#{fetch(:deploy_to)}/scm" && git fetch "#{fetch(:repository)}" "#{fetch(:branch)}:#{fetch(:branch)}" --force && git reset --hard #{fetch(:branch)})]}
|
26
|
+
fi &&
|
27
|
+
echo "-----> Updating git submodules" &&
|
28
|
+
#{echo_cmd %[(cd "#{fetch(:deploy_to)}/scm" && git submodule init && git submodule sync && git submodule update --init --recursive)]} &&
|
29
|
+
echo "-----> Copying to release path (branch: '#{fetch(:branch)}')" &&
|
30
|
+
#{echo_cmd %[rsync -lrpt "#{fetch(:deploy_to)}/scm/" .]}
|
31
|
+
}, quiet: true
|
32
|
+
end
|
33
|
+
|
34
|
+
comment %{Using this git commit}
|
35
|
+
command %{git rev-parse HEAD > .mina_git_revision}
|
36
|
+
command %{git --no-pager log --format="%aN (%h):%n> %s" -n 1}
|
37
|
+
if fetch(:remove_git_dir)
|
38
|
+
command %{rm -rf .git}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
task :remove_cache do
|
43
|
+
comment "Removing git scm directory"
|
44
|
+
command %{rm -rf "#{fetch(:deploy_to)}/scm" }
|
45
|
+
end
|
46
|
+
|
47
|
+
task :revision do
|
48
|
+
ensure!(:deploy_to)
|
49
|
+
command %{cat #{fetch(:current_path)}/.mina_git_revision}
|
50
|
+
end
|
51
|
+
|
52
|
+
task :ensure_pushed do
|
53
|
+
run :local do
|
54
|
+
comment %{Ensuring everyting is pushed to git}
|
55
|
+
command %{
|
56
|
+
if [ $(git log #{fetch(:remote)}/#{fetch(:branch)}..#{fetch(:branch)} | wc -l) -ne 0 ]; then
|
57
|
+
echo "! #{fetch(:git_not_pushed_message)}"
|
58
|
+
exit 1
|
59
|
+
fi
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mina/git-submodules/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mina-git-submodules"
|
8
|
+
spec.version = Mina::GitSubmodules::VERSION
|
9
|
+
spec.authors = ["Cameron Taylor"]
|
10
|
+
spec.email = ["camerontaylor@gmail.com"]
|
11
|
+
spec.description = %q{Caching for git submodules when deploying with Mina}
|
12
|
+
spec.summary = %q{Caching for git submodules when deploying with Mina}
|
13
|
+
spec.homepage = "http://camerontaylor.github.io/mina-git-submodules/"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'mina', '>= 0.2.1'
|
22
|
+
spec.add_development_dependency 'bundler', '>= 1.3.5'
|
23
|
+
spec.add_development_dependency 'rake'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mina-git-submodules
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Cameron Taylor
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mina
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.5
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.5
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
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
|
+
description: Caching for git submodules when deploying with Mina
|
56
|
+
email:
|
57
|
+
- camerontaylor@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/mina/git-submodules.rb
|
68
|
+
- lib/mina/git-submodules/version.rb
|
69
|
+
- mina_git_submodules.gemspec
|
70
|
+
homepage: http://camerontaylor.github.io/mina-git-submodules/
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.5.1
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: Caching for git submodules when deploying with Mina
|
94
|
+
test_files: []
|