capistrano-n 0.0.10
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/Gemfile +4 -0
- data/README.md +43 -0
- data/Rakefile +1 -0
- data/capistrano-n.gemspec +26 -0
- data/lib/capistrano/n.rb +1 -0
- data/lib/capistrano/tasks/n.cap +51 -0
- data/lib/capistrano-n/version.rb +3 -0
- data/lib/capistrano-n.rb +0 -0
- metadata +94 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: a8bd9f3e5732a78d3e051a0f49fa561dfb44214e
|
|
4
|
+
data.tar.gz: 737e4d1b6ed5ddb409ac729a1cd01af4f481531e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: cba8656afdcd47400013566b572885be22d9809408074a8c81fab229e3db4adc5ba5d7bf81752e8c26aeaf5b6001aa9e7c7a28cbb3ac2d44302e92b5c10c2cbf
|
|
7
|
+
data.tar.gz: c9602d7d2cacb402a6c251d72eb0808e6f09c3515ac6dc25d619ec032b47da74d673287570ad3ca8bad27007fbf05cf105cec5d8b4eefe74a77b23c857ce4a12
|
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Capistrano::n
|
|
2
|
+
|
|
3
|
+
[n](https://github.com/tj/n) support for Capistrano 3.x. This project is a fork
|
|
4
|
+
of the [Capistrano::nvm](https://github.com/koenpunt/capistrano-nvm) package.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'capistrano', '~> 3.1'
|
|
12
|
+
gem 'capistrano-n', require: false
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle install
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Require in `Capfile` to use the default task:
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
require 'capistrano/n'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Configurable options:
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
set :n_type, :user # or :system, depends on your n setup
|
|
31
|
+
set :n_node, 'v0.12.14'
|
|
32
|
+
set :n_map_bins, %w{node npm}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If your n is located in some custom path, you can use `n_custom_path` to set it.
|
|
36
|
+
|
|
37
|
+
## Contributing
|
|
38
|
+
|
|
39
|
+
1. Fork it
|
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
43
|
+
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-n/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = 'capistrano-n'
|
|
9
|
+
spec.version = CapistranoN::VERSION
|
|
10
|
+
spec.authors = ['Cyril Mizzi']
|
|
11
|
+
spec.email = ['cyril@lesiteimmo.com']
|
|
12
|
+
spec.description = %q{n support for Capistrano 3.x}
|
|
13
|
+
spec.summary = %q{n support for Capistrano 3.x}
|
|
14
|
+
spec.homepage = 'https://github.com/studio-net/capistrano-n'
|
|
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
|
data/lib/capistrano/n.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
load File.expand_path("../tasks/n.cap", __FILE__)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
namespace :n do
|
|
2
|
+
task validate: :"n:wrapper" do
|
|
3
|
+
on release_roles(fetch(:n_roles)) do
|
|
4
|
+
n_node = fetch(:n_node)
|
|
5
|
+
if n_node.nil?
|
|
6
|
+
error "n: n_node is not set"
|
|
7
|
+
exit 1
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
task :map_bins do
|
|
13
|
+
SSHKit.config.default_env.merge!({ node_version: fetch(:n_node), N_PREFIX: fetch(:n_env_prefix), PATH: "#{fetch(:n_env_prefix)}/bin:$PATH" })
|
|
14
|
+
|
|
15
|
+
n_prefix = fetch(:n_prefix, -> { "#{fetch(:tmp_dir)}/#{fetch(:application)}/n-exec.sh" } )
|
|
16
|
+
fetch(:n_map_bins).each do |command|
|
|
17
|
+
SSHKit.config.command_map.prefix[command.to_sym].unshift(n_prefix)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
task :wrapper do
|
|
22
|
+
on release_roles(fetch(:n_roles)) do
|
|
23
|
+
execute :mkdir, "-p", "#{fetch(:tmp_dir)}/#{fetch(:application)}/"
|
|
24
|
+
upload! StringIO.new("#!/bin/bash -e\n#{fetch(:n_path)}/bin/n #{fetch(:n_flags)} $NODE_VERSION\nexec \"$@\""), "#{fetch(:tmp_dir)}/#{fetch(:application)}/n-exec.sh"
|
|
25
|
+
execute :chmod, "+x", "#{fetch(:tmp_dir)}/#{fetch(:application)}/n-exec.sh"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
Capistrano::DSL.stages.each do |stage|
|
|
31
|
+
after stage, "n:validate"
|
|
32
|
+
after stage, "n:map_bins"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
namespace :load do
|
|
36
|
+
task :defaults do
|
|
37
|
+
set :n_path, -> {
|
|
38
|
+
n_path = fetch(:n_custom_path)
|
|
39
|
+
n_path ||= if fetch(:n_type, :user) == :system
|
|
40
|
+
"/usr/local/n"
|
|
41
|
+
else
|
|
42
|
+
"$HOME/n"
|
|
43
|
+
end
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
set :n_roles, fetch(:n_roles, :all)
|
|
47
|
+
set :n_map_bins, %w{node npm}
|
|
48
|
+
set :n_env_prefix, -> { shared_path }
|
|
49
|
+
set :n_flags, "--quiet"
|
|
50
|
+
end
|
|
51
|
+
end
|
data/lib/capistrano-n.rb
ADDED
|
File without changes
|
metadata
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: capistrano-n
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.10
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Cyril Mizzi
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-05-17 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
|
+
- !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'
|
|
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'
|
|
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: n support for Capistrano 3.x
|
|
56
|
+
email:
|
|
57
|
+
- cyril@lesiteimmo.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- Gemfile
|
|
63
|
+
- README.md
|
|
64
|
+
- Rakefile
|
|
65
|
+
- capistrano-n.gemspec
|
|
66
|
+
- lib/capistrano-n.rb
|
|
67
|
+
- lib/capistrano-n/version.rb
|
|
68
|
+
- lib/capistrano/n.rb
|
|
69
|
+
- lib/capistrano/tasks/n.cap
|
|
70
|
+
homepage: https://github.com/studio-net/capistrano-n
|
|
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: n support for Capistrano 3.x
|
|
94
|
+
test_files: []
|