capistrano-nodebrew 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ Vagrantfile
2
+ .vagrant/
3
+ pkg/
4
+ *.gem
5
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-nodebrew.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Yuki Kodama
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # Capistrano::nodebrew
2
+
3
+ nodebrew support for Capistrano 3.x
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'capistrano', '~> 3.1'
10
+ gem 'capistrano-nodebrew'
11
+
12
+ And then execute:
13
+
14
+ $ bundle install
15
+
16
+ ## Usage
17
+
18
+ # Capfile
19
+ require 'capistrano/nodebrew'
20
+
21
+ # config/deploy.rb
22
+ set :nodebrew_type, :user # or :system, depends on your nodebrew setup
23
+ set :nodebrew_node, 'io@v2.5.0'
24
+
25
+ set :nodebrew_map_bins, %w{npm node iojs} # default values
26
+ set :nodebrew_roles, :all # default value
27
+
28
+ If your nodebrew is located in some custom path, you can use `nodebrew_custom_path` to set it.
29
+
30
+ ## Acknowledgment
31
+
32
+ Thanks a lot to [Capistrano::rbenv](https://github.com/capistrano/rbenv).
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,21 @@
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-nodebrew"
7
+ gem.version = "0.0.2"
8
+ gem.authors = ["Yuki Kodama"]
9
+ gem.email = ["endflow.net@gmail.com"]
10
+ gem.description = %q{nodebrew integration for Capistrano}
11
+ gem.summary = %q{nodebrew integration for Capistrano}
12
+ gem.homepage = "https://github.com/kuy/capistrano-nodebrew"
13
+ gem.license = "MIT"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+
19
+ gem.add_dependency 'capistrano', '~> 3.1'
20
+ gem.add_dependency 'sshkit', '~> 1.3'
21
+ end
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/nodebrew.rake", __FILE__)
@@ -0,0 +1,57 @@
1
+ namespace :nodebrew do
2
+ task :validate do
3
+ on release_roles(fetch(:nodebrew_roles)) do
4
+ nodebrew_bin = fetch(:nodebrew_bin)
5
+ unless test "[ -e #{nodebrew_bin} ]"
6
+ error "nodebrew: command not found"
7
+ exit 1
8
+ end
9
+
10
+ nodebrew_node = fetch(:nodebrew_node)
11
+ if nodebrew_node.nil?
12
+ error "nodebrew: 'nodebrew_node' is not set"
13
+ exit 1
14
+ end
15
+
16
+ versions = capture("#{nodebrew_bin} ls").lines.map{|l| l.strip}.reject{|l| l.empty?}
17
+ unless versions.include? nodebrew_node
18
+ error "nodebrew: #{nodebrew_node} is not installed"
19
+ exit 1
20
+ end
21
+ end
22
+ end
23
+
24
+ task :map_bins do
25
+ nodebrew_bin = fetch(:nodebrew_bin)
26
+
27
+ SSHKit.config.default_env.merge!({ path: "#{fetch(:nodebrew_path)}/current/bin:$PATH" })
28
+ nodebrew_prefix = fetch(:nodebrew_prefix, proc { "#{fetch(:nodebrew_bin)} exec #{fetch(:nodebrew_node)}" })
29
+ SSHKit.config.command_map[:nodebrew] = fetch(:nodebrew_bin)
30
+
31
+ fetch(:nodebrew_map_bins).each do |command|
32
+ SSHKit.config.command_map.prefix[command.to_sym].unshift(nodebrew_prefix)
33
+ end
34
+ end
35
+ end
36
+
37
+ Capistrano::DSL.stages.each do |stage|
38
+ after stage, 'nodebrew:validate'
39
+ after stage, 'nodebrew:map_bins'
40
+ end
41
+
42
+ namespace :load do
43
+ task :defaults do
44
+ set :nodebrew_path, -> {
45
+ nodebrew_path = fetch(:nodebrew_custom_path)
46
+ nodebrew_path ||= if fetch(:nodebrew_type, :user) == :system
47
+ "/usr/local/nodebrew"
48
+ else
49
+ "~/.nodebrew"
50
+ end
51
+ }
52
+
53
+ set :nodebrew_bin, "#{fetch(:nodebrew_path)}/current/bin/nodebrew"
54
+ set :nodebrew_roles, fetch(:nodebrew_roles, :all)
55
+ set :nodebrew_map_bins, %w{npm node iojs}
56
+ end
57
+ end
File without changes
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-nodebrew
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Yuki Kodama
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-09-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: sshkit
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.3'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.3'
46
+ description: nodebrew integration for Capistrano
47
+ email:
48
+ - endflow.net@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - capistrano-nodebrew.gemspec
59
+ - lib/capistrano-nodebrew.rb
60
+ - lib/capistrano/nodebrew.rb
61
+ - lib/capistrano/tasks/nodebrew.rake
62
+ homepage: https://github.com/kuy/capistrano-nodebrew
63
+ licenses:
64
+ - MIT
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ segments:
76
+ - 0
77
+ hash: -1888025464079153244
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ segments:
85
+ - 0
86
+ hash: -1888025464079153244
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 1.8.23.2
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: nodebrew integration for Capistrano
93
+ test_files: []