capistrano-node 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ gem 'term-ansicolor'
4
4
  gem 'capistrano', '>= 2.11'
5
5
 
6
6
  group :development do
7
- gem 'rspec', '~> 2.8.0'
7
+ gem 'rspec', '~> 2.9'
8
8
  gem 'yard', '~> 0.7'
9
9
  gem 'rdoc', '~> 3.12'
10
10
  gem 'bundler', '~> 1.1'
data/Readme.md CHANGED
@@ -6,7 +6,7 @@ Capistrano tasks for deploying Node projects.
6
6
 
7
7
  * Skips migrations
8
8
  * Installs NPM packages on deploy
9
- * Manages multiple node versions
9
+ * Manages multiple node versions using package.json
10
10
 
11
11
  ## Usage
12
12
 
@@ -21,7 +21,33 @@ set :node_dir, '/opt/nodejs/versions' # Node dirs
21
21
  set :version_prefix, 'v'
22
22
  ```
23
23
 
24
+ ## Node Version Management
25
+
26
+ `capistrano-node` can manage multiple Node versions when `multi_node` variable
27
+ is set to `true`. In this case, it assumes that `node_dir` contains compiled
28
+ Node binaries for multiple versions each. For example, the directory could
29
+ contain files in following structure (assuming version prefix `'v'`):
30
+
31
+ $NODE_DIR
32
+ - v0.6.10
33
+ - bin
34
+ - node
35
+ - node-waf
36
+ - npm
37
+ - npm_g
38
+ - npm-g
39
+ - v0.6.9
40
+ - bin
41
+ - node
42
+ etc..
43
+
44
+ If multiple Node versions are used, `capistrano-node` reads used Node version
45
+ from `package.json`:
46
+
47
+ "engines": {
48
+ "node": ">= 0.6.14"
49
+ }
50
+
24
51
  ## Copyright
25
52
 
26
- Copyright (c) 2012 Flowdock Ltd. See LICENSE.txt for
27
- further details.
53
+ © [Flowdock](https://flowdock.com). See LICENSE.txt for further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "capistrano-node"
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ville Lautanala"]
12
- s.date = "2012-03-26"
12
+ s.date = "2012-03-27"
13
13
  s.description = "Capistrano scripts to handle Node deployment"
14
14
  s.email = "lautis@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
41
41
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
42
  s.add_runtime_dependency(%q<term-ansicolor>, [">= 0"])
43
43
  s.add_runtime_dependency(%q<capistrano>, [">= 2.11"])
44
- s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
44
+ s.add_development_dependency(%q<rspec>, ["~> 2.9"])
45
45
  s.add_development_dependency(%q<yard>, ["~> 0.7"])
46
46
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
47
47
  s.add_development_dependency(%q<bundler>, ["~> 1.1"])
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
49
49
  else
50
50
  s.add_dependency(%q<term-ansicolor>, [">= 0"])
51
51
  s.add_dependency(%q<capistrano>, [">= 2.11"])
52
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
52
+ s.add_dependency(%q<rspec>, ["~> 2.9"])
53
53
  s.add_dependency(%q<yard>, ["~> 0.7"])
54
54
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
55
55
  s.add_dependency(%q<bundler>, ["~> 1.1"])
@@ -58,7 +58,7 @@ Gem::Specification.new do |s|
58
58
  else
59
59
  s.add_dependency(%q<term-ansicolor>, [">= 0"])
60
60
  s.add_dependency(%q<capistrano>, [">= 2.11"])
61
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
61
+ s.add_dependency(%q<rspec>, ["~> 2.9"])
62
62
  s.add_dependency(%q<yard>, ["~> 0.7"])
63
63
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
64
64
  s.add_dependency(%q<bundler>, ["~> 1.1"])
@@ -2,6 +2,7 @@ require 'capistrano-node'
2
2
  require 'term/ansicolor'
3
3
  include Term::ANSIColor
4
4
 
5
+ # Available local Node versions
5
6
  def local_versions(path, prefix)
6
7
  Dir.entries(path).select do |n|
7
8
  n[0] != '.'
@@ -10,6 +11,7 @@ def local_versions(path, prefix)
10
11
  end
11
12
  end
12
13
 
14
+ # Available remote Node versions
13
15
  def remote_versions(path, prefix)
14
16
  capture("ls #{path}").chomp.split("\n").map do |ver|
15
17
  Capistrano::Node.version ver, prefix
@@ -21,9 +23,11 @@ Capistrano::Configuration.instance(:must_exist).load do |configuration|
21
23
  after :'deploy:update_code', :'deploy:npm'
22
24
 
23
25
  set :multi_node, false unless defined? multi_node
24
- set :local, false unless defined? local
25
- set :node_dir, '/opt/nodejs/versions' unless defined? node_dir
26
- set :version_prefix, 'v' unless defined? version_prefix
26
+ set :local, false unless defined? local # Local run?
27
+ set :node_dir, '/opt/nodejs/versions' unless defined? node_dir # Node versions dir
28
+ set :version_prefix, 'v' unless defined? version_prefix # Prefix for versin dirs, (v0.6.10 -> 'v')
29
+
30
+ # Lazy variable to list available node versions from either local or remote
27
31
  set :available_node_versions do
28
32
  if local
29
33
  local_versions node_dir, version_prefix
@@ -32,11 +36,14 @@ Capistrano::Configuration.instance(:must_exist).load do |configuration|
32
36
  end.sort
33
37
  end
34
38
 
39
+ # Export used Node version from package.json
35
40
  set :node_version do
36
41
  requirement = Capistrano::Node.requirement 'package.json'
37
42
  Capistrano::Node.choose_version requirement, available_node_versions
38
43
  end
39
44
 
45
+ set :normalize_asset_timestamps, false # Don't touch public/images etc.
46
+
40
47
  namespace :node do
41
48
  desc 'List available node versions'
42
49
  task :versions do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-node
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-26 00:00:00.000000000 Z
12
+ date: 2012-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: term-ansicolor
16
- requirement: &70108179190900 !ruby/object:Gem::Requirement
16
+ requirement: &70220262818040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70108179190900
24
+ version_requirements: *70220262818040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: capistrano
27
- requirement: &70108179189520 !ruby/object:Gem::Requirement
27
+ requirement: &70220262816700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: '2.11'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70108179189520
35
+ version_requirements: *70220262816700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70108179188160 !ruby/object:Gem::Requirement
38
+ requirement: &70220262814560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 2.8.0
43
+ version: '2.9'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70108179188160
46
+ version_requirements: *70220262814560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yard
49
- requirement: &70108179211800 !ruby/object:Gem::Requirement
49
+ requirement: &70220262812560 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.7'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70108179211800
57
+ version_requirements: *70220262812560
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rdoc
60
- requirement: &70108179211220 !ruby/object:Gem::Requirement
60
+ requirement: &70220262833600 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '3.12'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70108179211220
68
+ version_requirements: *70220262833600
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &70108179210480 !ruby/object:Gem::Requirement
71
+ requirement: &70220262830940 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '1.1'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70108179210480
79
+ version_requirements: *70220262830940
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: jeweler
82
- requirement: &70108179209780 !ruby/object:Gem::Requirement
82
+ requirement: &70220262829360 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 1.8.3
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70108179209780
90
+ version_requirements: *70220262829360
91
91
  description: Capistrano scripts to handle Node deployment
92
92
  email: lautis@gmail.com
93
93
  executables: []
@@ -122,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  segments:
124
124
  - 0
125
- hash: 4423601583990083914
125
+ hash: -1930817025758932239
126
126
  required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements: