diff --git a/README.md b/README.md index 8c1b25d..497f42c 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,20 @@ set :npm_roles, :all # default set :npm_env_variables, {} # default ``` +Alternatively, if you want to have control on the execution of npm tasks + +```ruby +# Capfile +require capistrano/npm/without_hooks +``` + +You can then add the hooks on a per deploy script basis + +```ruby +# config/deploy/my_stage_with_npm.rb +before 'deploy:updated', 'npm:install' +``` + ### Dependencies npm allows for normal `dependencies` and `devDependencies`. By default this gem uses `'--production --silent --no-progress'` as the install flags which will **only** install `dependencies` and skip `devDependencies`. If you want your `devDependencies` installed as well, then remove `--production`. diff --git a/capistrano-npm.gemspec b/capistrano-npm.gemspec index 412d991..df11ee4 100644 --- a/capistrano-npm.gemspec +++ b/capistrano-npm.gemspec @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = 'capistrano-npm' - spec.version = '1.0.2' + spec.version = '1.1.0' spec.authors = ['Scott Walkinshaw'] spec.email = ['scott.walkinshaw@gmail.com'] spec.description = %q{npm support for Capistrano 3.x} diff --git a/lib/capistrano/hooks/npm.rb b/lib/capistrano/hooks/npm.rb new file mode 100644 index 0000000..e4f35b8 --- /dev/null +++ b/lib/capistrano/hooks/npm.rb @@ -0,0 +1 @@ +before 'deploy:updated', 'npm:install' diff --git a/lib/capistrano/npm.rb b/lib/capistrano/npm.rb index 0f7d01b..449512d 100644 --- a/lib/capistrano/npm.rb +++ b/lib/capistrano/npm.rb @@ -1 +1 @@ -load File.expand_path('../tasks/npm.rake', __FILE__) +load File.expand_path('../tasks/deploy_npm.rake', __FILE__) diff --git a/lib/capistrano/npm/without_hooks.rb b/lib/capistrano/npm/without_hooks.rb new file mode 100644 index 0000000..324dde6 --- /dev/null +++ b/lib/capistrano/npm/without_hooks.rb @@ -0,0 +1 @@ +load File.expand_path('../../tasks/npm.rake', __FILE__) diff --git a/lib/capistrano/tasks/deploy_npm.rake b/lib/capistrano/tasks/deploy_npm.rake new file mode 100644 index 0000000..ac1ada5 --- /dev/null +++ b/lib/capistrano/tasks/deploy_npm.rake @@ -0,0 +1,2 @@ +load File.expand_path('../npm.rake', __FILE__) +load File.expand_path('../../hooks/npm.rake', __FILE__)