capistrano-gitlab-artifact 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e416e4624c339a405f6f5b12beb2c1ab93af378ade4ef89f1a00eade3185459f
4
+ data.tar.gz: b47965c0220c989dfe5df3162ed4785e8fe2768981b25f8d75760d6a5aa64379
5
+ SHA512:
6
+ metadata.gz: 813f9af9f4caf2faa38835ddd68b760b3457c236d28a5932838a84856d8041a76d76b873d838ad6ecf2c79df56fbc70357850be097951077f307ba6087fffdfe
7
+ data.tar.gz: 9fc7ec3229769b645b1de639886d5a20b9fd4b6ef51eaa7233f30ab1d182472c63576b959c1c26b76ba5f12bf5d6767f77ec5030173c4c5e23a76a07f8217671
@@ -0,0 +1,16 @@
1
+ ruby = docker run --rm -it -v `pwd`:/usr/src/app -w /usr/src/app ruby:2.4
2
+
3
+ .DEFAULT_GOAL := help
4
+ .PHONY: help go
5
+
6
+ help:
7
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
8
+
9
+ go: ## Jump to ruby container
10
+ $(ruby) /bin/bash
11
+
12
+ build: ## Build gem file
13
+ $(ruby) gem build capistrano-gitlab-artifact.gemspec
14
+
15
+ push: ## Push gem file into rubygems.org
16
+ $(ruby) gem push capistrano-gitlab-artifact-0.0.2.gem
@@ -0,0 +1,30 @@
1
+ # Capistrano::GitlabArtifact
2
+
3
+ Gitlab Artifact is a [Custom SCM Plugin](http://capistranorb.com/documentation/advanced-features/custom-scm/) for Capistrano v3
4
+
5
+
6
+ ## Installation
7
+
8
+ ```
9
+ # Gemfile
10
+ gem 'capistrano-gitlab-artifact', '0.0.2'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Require capistrano-gitlab-artifact in your Capfile
16
+
17
+ ```
18
+ # Capfile
19
+ require "capistrano/scm/gitlab-artifact"
20
+ install_plugin Capistrano::SCM::GitlabArtifact
21
+ ```
22
+
23
+
24
+ ### Settings
25
+
26
+ ```ruby
27
+ # Custom "Gitlab Artifact" SCM configuration
28
+ set :gitlab_artifact_url, 'https://your.gitlab.com/your-namespace/your-repository/-/jobs/artifacts/gitlab-ci/download?job=build'
29
+ set :gitlab_artifact_private_token, 'your-private-token'
30
+ ```
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "capistrano-gitlab-artifact"
7
+ gem.version = '0.0.2'
8
+ gem.authors = ["Johann Brocail"]
9
+ gem.summary = %q{Capistrano Gitlab Artifact - Deploy artifact from Gitlab build}
10
+ gem.homepage = "http://github.com/L0rD59/capistrano-gitlab-artifact"
11
+
12
+ gem.files = `git ls-files`.split($/)
13
+ gem.require_paths = ["lib"]
14
+
15
+ gem.licenses = ['MIT']
16
+
17
+ gem.add_dependency 'capistrano', '~> 3.1'
18
+ end
@@ -0,0 +1,25 @@
1
+ require "capistrano/scm/plugin"
2
+
3
+ class Capistrano::SCM::GitlabArtifact < Capistrano::SCM::Plugin
4
+ def set_defaults
5
+ set_if_empty :gitlab_artifact_url, ''
6
+ set_if_empty :gitlab_artifact_private_token, ''
7
+ end
8
+
9
+ def define_tasks
10
+ eval_rakefile File.expand_path("../tasks/gitlab_artifact.rake", __FILE__)
11
+ end
12
+
13
+ def register_hooks
14
+ after "deploy:new_release_path", "gitlab_artifact:create_release"
15
+ end
16
+
17
+ def create_release
18
+ on release_roles :all do
19
+ execute :mkdir, "-p", release_path
20
+ execute :wget, "-q -O #{repo_path}/artifact.zip --header=\"PRIVATE-TOKEN: #{fetch(:gitlab_artifact_private_token)}\" #{fetch(:gitlab_artifact_url)}"
21
+ execute :unzip, "-q #{repo_path}/artifact.zip -d #{fetch(:release_path)}/"
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,15 @@
1
+ # This trick lets us access the Git plugin within `on` blocks.
2
+ gitlab_artifact_plugin = self
3
+
4
+ # The namespace can be whatever you want, but its best
5
+ # to choose a name that matches your plugin name.
6
+ namespace :gitlab_artifact do
7
+
8
+ desc "Create release"
9
+ task :create_release do
10
+ on release_roles :all do
11
+ gitlab_artifact_plugin.create_release
12
+ end
13
+ end
14
+
15
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-gitlab-artifact
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Johann Brocail
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ description:
28
+ email:
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - Makefile
34
+ - README.md
35
+ - capistrano-gitlab-artifact.gemspec
36
+ - lib/capistrano/scm/gitlab-artifact.rb
37
+ - lib/capistrano/scm/tasks/gitlab_artifact.rake
38
+ homepage: http://github.com/L0rD59/capistrano-gitlab-artifact
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.7.3
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Capistrano Gitlab Artifact - Deploy artifact from Gitlab build
62
+ test_files: []