capistrano-goenv 0.0.2
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 +1 -0
- data/Gemfile +4 -0
- data/README.md +42 -0
- data/Rakefile +1 -0
- data/capistrano-goenv.gemspec +26 -0
- data/lib/capistrano/goenv.rb +1 -0
- data/lib/capistrano/tasks/goenv.rake +59 -0
- data/lib/capistrano-goenv/version.rb +3 -0
- data/lib/capistrano-goenv.rb +0 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 543b744046c0e01e7e2b60781457c1fceb9781697636b8fcfde5675bd9727bfc
|
4
|
+
data.tar.gz: 706e203cdbd958a8c119cbf5e3a811b85edd2d9211587c4956a4fc063489e553
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e6f256200d3eb0cdceba99bbd06ca8d874302b8829fc920383ab8a8a4a8bcac6a2cd01a65e2a3f3766efd3f99efaa7c0008397c0b6a9b51b883e8e76e86930b7
|
7
|
+
data.tar.gz: c64f43590c094110826d7050c65b3fe8e76140766b75b7b3525d76187d1c951607dee3218a415172c98363ca6fe2610b8380fdc7e96f29bbee38d0b26bd883f8
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/Gemfile.lock
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Capistrano::goenv
|
2
|
+
|
3
|
+
[goenv](https://github.com/creationix/goenv) support for Capistrano 3.x
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'capistrano', '~> 3.1'
|
11
|
+
gem 'capistrano-goenv', require: false
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle install
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
Require in `Capfile` to use the default task:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
require 'capistrano/goenv'
|
24
|
+
```
|
25
|
+
|
26
|
+
Configurable options:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
set :goenv_type, :user # or :system, depends on your goenv setup
|
30
|
+
set :goenv_go_version, '1.14.0'
|
31
|
+
set :goenv_map_bins, %w{go}
|
32
|
+
```
|
33
|
+
|
34
|
+
If your goenv is located in some custom path, you can use `goenv_custom_path` to set it.
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'capistrano-goenv/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'capistrano-goenv'
|
9
|
+
spec.version = CapistranoGoenv::VERSION
|
10
|
+
spec.authors = ['Koen Punt', 'Danil Pismenny']
|
11
|
+
spec.email = ['me@koen.pt', 'danil@brandymint.ru']
|
12
|
+
spec.description = %q{goenv support for Capistrano 3.x}
|
13
|
+
spec.summary = %q{goenv support for Capistrano 3.x}
|
14
|
+
spec.homepage = 'https://github.com/dapi/capistrano-goenv'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
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_dependency 'capistrano', '~> 3.1'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'rake'
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/goenv.rake", __FILE__)
|
@@ -0,0 +1,59 @@
|
|
1
|
+
namespace :goenv do
|
2
|
+
task validate: :'goenv:wrapper' do
|
3
|
+
on release_roles(fetch(:goenv_roles)) do
|
4
|
+
goenv_go_version = fetch(:goenv_go_version)
|
5
|
+
if goenv_go_version.nil?
|
6
|
+
error "goenv: goenv_go_version is not set"
|
7
|
+
exit 1
|
8
|
+
end
|
9
|
+
|
10
|
+
goenv_version_path = fetch(:goenv_version_path)
|
11
|
+
goenv_version_path = [goenv_version_path] unless goenv_version_path.is_a?(Array)
|
12
|
+
|
13
|
+
unless test(goenv_version_path.map {|p| "[ -d #{p} ]" }.join(" || "))
|
14
|
+
error "goenv: #{goenv_go_version} is not installed or not found in any of #{goenv_version_path.join(" ")}"
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
task :map_bins do
|
21
|
+
SSHKit.config.default_env.merge!({ node_version: "#{fetch(:goenv_go_version)}" })
|
22
|
+
goenv_prefix = fetch(:goenv_prefix, -> { "#{fetch(:tmp_dir)}/#{fetch(:application)}/goenv-exec.sh" } )
|
23
|
+
fetch(:goenv_map_bins).each do |command|
|
24
|
+
SSHKit.config.command_map.prefix[command.to_sym].unshift(goenv_prefix)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
task :wrapper do
|
29
|
+
on release_roles(fetch(:goenv_roles)) do
|
30
|
+
execute :mkdir, "-p", "#{fetch(:tmp_dir)}/#{fetch(:application)}/"
|
31
|
+
# upload! StringIO.new("#!/bin/bash -e\nsource \"#{fetch(:goenv_path)}/goenv.sh\"\ngoenv use $GO_VERSION\nexec \"$@\""), "#{fetch(:tmp_dir)}/#{fetch(:application)}/goenv-exec.sh"
|
32
|
+
upload! StringIO.new("#!/bin/bash -e\nexport GOENV_ROOT=\"$HOME/.goenv\";\nexport PATH=\"$GOENV_ROOT/bin:$PATH\"\neval \"$(goenv init -)\"\ngoenv local $GO_VERSION\nexec \"$@\""), "#{fetch(:tmp_dir)}/#{fetch(:application)}/goenv-exec.sh"
|
33
|
+
execute :chmod, "+x", "#{fetch(:tmp_dir)}/#{fetch(:application)}/goenv-exec.sh"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Capistrano::DSL.stages.each do |stage|
|
39
|
+
after stage, 'goenv:validate'
|
40
|
+
after stage, 'goenv:map_bins'
|
41
|
+
end
|
42
|
+
|
43
|
+
namespace :load do
|
44
|
+
task :defaults do
|
45
|
+
|
46
|
+
set :goenv_path, -> {
|
47
|
+
goenv_path = fetch(:goenv_custom_path)
|
48
|
+
goenv_path ||= if fetch(:goenv_type, :user) == :system
|
49
|
+
"/usr/local/goenv"
|
50
|
+
else
|
51
|
+
"$HOME/.goenv"
|
52
|
+
end
|
53
|
+
}
|
54
|
+
|
55
|
+
set :goenv_roles, fetch(:goenv_roles, :all)
|
56
|
+
set :goenv_version_path, -> { ["#{fetch(:goenv_path)}/versions/#{fetch(:goenv_go_version)}"] }
|
57
|
+
set :goenv_map_bins, %w{go}
|
58
|
+
end
|
59
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-goenv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Koen Punt
|
8
|
+
- Danil Pismenny
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2021-08-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: capistrano
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3.1'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.3'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.3'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
description: goenv support for Capistrano 3.x
|
57
|
+
email:
|
58
|
+
- me@koen.pt
|
59
|
+
- danil@brandymint.ru
|
60
|
+
executables: []
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ".gitignore"
|
65
|
+
- Gemfile
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- capistrano-goenv.gemspec
|
69
|
+
- lib/capistrano-goenv.rb
|
70
|
+
- lib/capistrano-goenv/version.rb
|
71
|
+
- lib/capistrano/goenv.rb
|
72
|
+
- lib/capistrano/tasks/goenv.rake
|
73
|
+
homepage: https://github.com/dapi/capistrano-goenv
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubygems_version: 3.0.3
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: goenv support for Capistrano 3.x
|
96
|
+
test_files: []
|