capistrano-npm 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/capistrano-npm.gemspec +20 -0
- data/lib/capistrano/npm.rb +13 -0
- data/lib/capistrano/npm/version.rb +5 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 03279ddd9f7ac5efad92ec70586f4e1d2a26479d
|
4
|
+
data.tar.gz: d7dd5ac3a5d933c9b9fafb1b66d24442ac447b3f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a298db70c092b5f5c2769ec4f32492eeb56600b6721caa8769a237c4b63874994f06f00e3792088666d51a42e43d24a7a1f67ed41f75078dcd5b47d41fd03574
|
7
|
+
data.tar.gz: 50fde150def4605b3b9e4afceb15a65e6df600b4f7ae72de71ff36b826bb1bc591c160abc7501b63e7cae27bf05f56edd9f049f110aa7185117ed756ddcd2884
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# capistrano-npm
|
2
|
+
|
3
|
+
capistrano-npm is a [Capistrano](https://github.com/capistrano/capistrano) extension that will let you run [npm](https://npmjs.org/) during your deploy process.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
1. Install the Gem
|
8
|
+
|
9
|
+
```bash
|
10
|
+
gem install capistrano-npm
|
11
|
+
```
|
12
|
+
|
13
|
+
Or if you're using Bundler, add it to your `Gemfile`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'capistrano-npm', github: 'swalkinshaw/npm'
|
17
|
+
```
|
18
|
+
|
19
|
+
2. Add to `Capfile` or `config/deploy.rb`:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'capistrano/npm'
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Add the task to your `deploy.rb`:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
after 'deploy:finalize_update', 'npm:install'
|
31
|
+
```
|
32
|
+
|
33
|
+
### Optimize
|
34
|
+
|
35
|
+
Ideally when using npm, you should add `node_modules` to your `.gitignore` file to keep them out of your repository.
|
36
|
+
|
37
|
+
Since `npm install` does not guarantee that you will get the same package versions when deploying, you should use `npm shrinkwrap` (https://npmjs.org/doc/shrinkwrap.html) first.
|
38
|
+
|
39
|
+
Running `npm shrinkwrap` will created a `npm-shrinkwrap.json` file that locks down the dependency versions. Check this file into your repository.
|
40
|
+
|
41
|
+
Now when deploying, `npm install` will detect the `npm-shrinkwrap.json` file and use that to install the packages.
|
42
|
+
|
43
|
+
### Tasks
|
44
|
+
|
45
|
+
* `npm:install`: Runs `npm install`.
|
46
|
+
|
47
|
+
### Dependencies
|
48
|
+
|
49
|
+
This extension also adds the `npm` command as a Capistrano dependency. Meaning when you run `cap deploy:check`, it will make sure the `npm` command exists.
|
50
|
+
|
51
|
+
### Configuration
|
52
|
+
|
53
|
+
* `npm_path`: Path to npm bin on the remote server. Defaults to just `npm` as its assumed to be in your `$PATH`.
|
54
|
+
* `npm_options`: Options for `npm` command. Defaults to `--production` to avoid installing dev dependencies.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,20 @@
|
|
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/npm/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'capistrano-npm'
|
9
|
+
s.version = Capistrano::Npm::VERSION
|
10
|
+
s.authors = ['Scott Walkinshaw']
|
11
|
+
s.email = ['scott.walkinshaw@gmail.com']
|
12
|
+
s.homepage = 'https://github.com/swalkinshaw/capistrano-npm'
|
13
|
+
s.summary = %q{Capistrano extension for npm (Node Packaged Modules)}
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split($/)
|
17
|
+
s.require_paths = %w(lib)
|
18
|
+
|
19
|
+
s.add_dependency 'capistrano', '>= 2.5.5'
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Capistrano::Configuration.instance(true).load do
|
2
|
+
set :npm_path, 'npm'
|
3
|
+
set :npm_options, '--production'
|
4
|
+
|
5
|
+
depend :remote, :command, npm_path
|
6
|
+
|
7
|
+
namespace :npm do
|
8
|
+
desc 'Runs npm install.'
|
9
|
+
task :install, :roles => :app, :except => { :no_release => true } do
|
10
|
+
try_sudo "cd #{latest_release} && #{npm_path} #{npm_options} install"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-npm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Walkinshaw
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-19 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: 2.5.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.5.5
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- scott.walkinshaw@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- Gemfile
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- capistrano-npm.gemspec
|
39
|
+
- lib/capistrano/npm.rb
|
40
|
+
- lib/capistrano/npm/version.rb
|
41
|
+
homepage: https://github.com/swalkinshaw/capistrano-npm
|
42
|
+
licenses:
|
43
|
+
- MIT
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.0.0
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: Capistrano extension for npm (Node Packaged Modules)
|
65
|
+
test_files: []
|