guard-npm 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +59 -0
- data/lib/guard/npm.rb +37 -0
- data/lib/guard/npm/notifier.rb +33 -0
- data/lib/guard/npm/templates/Guardfile +5 -0
- data/lib/guard/npm/version.rb +6 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d68411f1daa5e4e2c0fd01c0e8100c3a04bb3bc9
|
4
|
+
data.tar.gz: db7c159f8325cd5267dd270ba6a6c9581849bf1f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 852e1b1d8c8f2e9401ab9f17b0ee4dacce89f63d7f299f41344455c250ae209854e06c675123581991918baaf96e211ff576295a1e118e4a75933bea7ed0aca9
|
7
|
+
data.tar.gz: 246aa58ac687c840a91fb5fb262676454afb78e3d6231a9d4594c82d4d3d1b0555bbce5a6c7283b5bb3739ea242c8dce3a37d0837328fb3cf0ffc952cf0b1496
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Yann Lugrin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Guard::Npm
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/guard-npm.png)](http://badge.fury.io/rb/guard-npm) [![Build Status](https://travis-ci.org/alexrabarts/guard-npm.png?branch=master)](https://travis-ci.org/alexrabarts/guard-npm) [![Dependency Status](https://gemnasium.com/alexrabarts/guard-npm.png)](https://gemnasium.com/alexrabarts/guard-npm) [![Code Climate](https://codeclimate.com/github/alexrabarts/guard-npm.png)](https://codeclimate.com/github/alexrabarts/guard-npm) [![Coverage Status](https://coveralls.io/repos/alexrabarts/guard-npm/badge.png?branch=master)](https://coveralls.io/r/alexrabarts/guard-npm)
|
3
|
+
|
4
|
+
npm guard allows to automatically & intelligently install/update package.json when needed.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
|
8
|
+
Please be sure to have [Guard](https://github.com/guard/guard) installed before continue.
|
9
|
+
|
10
|
+
Install the gem:
|
11
|
+
|
12
|
+
```
|
13
|
+
$ gem install guard-npm
|
14
|
+
```
|
15
|
+
|
16
|
+
Add it to your Gemfile (inside development group):
|
17
|
+
|
18
|
+
``` ruby
|
19
|
+
group :development do
|
20
|
+
gem 'guard-npm'
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
Add guard definition to your Guardfile by running this command:
|
25
|
+
|
26
|
+
```
|
27
|
+
$ guard init npm
|
28
|
+
```
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
Please read [Guard usage doc](https://github.com/guard/guard#readme)
|
33
|
+
|
34
|
+
## Guardfile
|
35
|
+
|
36
|
+
npm guard can be really adapted to all kind of projects.
|
37
|
+
|
38
|
+
### Standard RubyGem project
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
guard 'npm' do
|
42
|
+
watch('package.json')
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
Please read [Guard doc](https://github.com/guard/guard#readme) for more information about the Guardfile DSL.
|
47
|
+
|
48
|
+
## Development
|
49
|
+
|
50
|
+
* Source hosted at [GitHub](https://github.com/alexrabarts/guard-npm)
|
51
|
+
* Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/alexrabarts/guard-npm/issues)
|
52
|
+
|
53
|
+
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
|
54
|
+
you make.
|
55
|
+
|
56
|
+
## Authors
|
57
|
+
|
58
|
+
[Yann Lugrin](https://github.com/yannlugrin)
|
59
|
+
[Alex Rabarts](https://github.com/alexrabarts)
|
data/lib/guard/npm.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'guard'
|
3
|
+
require 'guard/guard'
|
4
|
+
|
5
|
+
module Guard
|
6
|
+
class Npm < Guard
|
7
|
+
autoload :Notifier, 'guard/npm/notifier'
|
8
|
+
|
9
|
+
def start
|
10
|
+
install_package
|
11
|
+
end
|
12
|
+
|
13
|
+
def reload
|
14
|
+
install_package
|
15
|
+
end
|
16
|
+
|
17
|
+
def run_all
|
18
|
+
install_package
|
19
|
+
end
|
20
|
+
|
21
|
+
def run_on_additions(paths = [])
|
22
|
+
install_package
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_on_modifications(paths = [])
|
26
|
+
install_package
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def install_package
|
32
|
+
system('npm install')
|
33
|
+
|
34
|
+
$? == 0 ? :package_installed : false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Guard
|
3
|
+
class Npm
|
4
|
+
class Notifier
|
5
|
+
|
6
|
+
def self.guard_message(result, duration)
|
7
|
+
case result
|
8
|
+
when true
|
9
|
+
"package.json has been installed\nin %.1f seconds." % [duration]
|
10
|
+
else
|
11
|
+
"package.json can't be installed,\nplease check manually."
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# failed | success
|
16
|
+
def self.guard_image(result)
|
17
|
+
icon = if result
|
18
|
+
:success
|
19
|
+
else
|
20
|
+
:failed
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.notify(result, duration)
|
25
|
+
message = guard_message(result, duration)
|
26
|
+
image = guard_image(result)
|
27
|
+
|
28
|
+
::Guard::Notifier.notify(message, :title => 'npm install', :image => image)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-npm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yann Lugrin
|
8
|
+
- Alex Rabarts
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-09-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: guard
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.1'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.14.1
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 2.14.1
|
42
|
+
description: Guard::Npm automatically install/update your npm package.json when needed
|
43
|
+
email:
|
44
|
+
- yann.lugrin@sans-savoir.net
|
45
|
+
- alexrabarts@gmail.com
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- lib/guard/npm/notifier.rb
|
51
|
+
- lib/guard/npm/templates/Guardfile
|
52
|
+
- lib/guard/npm/version.rb
|
53
|
+
- lib/guard/npm.rb
|
54
|
+
- LICENSE
|
55
|
+
- README.md
|
56
|
+
homepage: http://rubygems.org/gems/guard-npm
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 1.3.6
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project: guard-npm
|
76
|
+
rubygems_version: 2.0.3
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Guard gem for npm
|
80
|
+
test_files: []
|