papers 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8920678dc22b3cb5e808318218cc9173f2fa9b12
4
- data.tar.gz: e6cf43b697b50fb7076460b98c91275b62e9bc9a
3
+ metadata.gz: 04a56da48ddc413020f2fcd656e2db6e0e3b0ba8
4
+ data.tar.gz: 94f31684ae3f21f18b919cefbb167f024045f5ad
5
5
  SHA512:
6
- metadata.gz: 7ffdda6169b1b528c35468acccce5c1a343008cdb057dd7a0c0408700558a7f0f400cf9491c9372e7f840e9f1b02ce09adb7429f1522c4203d11f7d83e504150
7
- data.tar.gz: fea0e35cfe2e43700cabd46b8bd5c820d7ead96c3bc1efb7a48380d681bc844ffa9efe701c5df7aea5817d7ac854478e49f3b260086dd0129c88b402caa62f4c
6
+ metadata.gz: e70b63d4c27b79bbc19a4144664738a933fbe31301d3a3c335bf5aae3e0bdae5ae6227034a41203b4cbb9772959b9977b66e3f31d71748966d15203c78520009
7
+ data.tar.gz: 5a3a99002c51bc3f0529d6593e5193dd005d495e6afa4cf1e5f99dc00eee7f569f70622bc52de5be032d087d08a2b90c01ff1d0086580fddbf5493bdfd20cc5a
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.0
4
+ * Add `config.ignore_npm_dev_dependencies` option to not apply validation to npm devDepdency modules. This is useful if you don't need to consider packages that aren't use in production.
5
+
3
6
  ## 2.2.0
4
7
 
5
8
  * Fix empty npm package name bug. The name of an npm package would be blank when its version was,
data/README.md CHANGED
@@ -102,6 +102,9 @@ Papers.configure do |config|
102
102
  # Configures Papers to validate licenses for NPM dependencies. Defaults to false.
103
103
  config.validate_npm_packages = false
104
104
 
105
+ # Configured Papers to ignore NPM dev dependencies. Defaults to false.
106
+ config.ignore_npm_dev_dependencies = false
107
+
105
108
  # Configures where Papers should look for the package.json file. Defaults to:
106
109
  # package.json in the root directory of the project
107
110
  config.npm_package_json_path = File.join(Dir.pwd, 'package.json')
@@ -9,6 +9,7 @@ module Papers
9
9
  attr_accessor :validate_javascript
10
10
  attr_accessor :validate_bower_components
11
11
  attr_accessor :validate_npm_packages
12
+ attr_accessor :ignore_npm_dev_dependencies
12
13
 
13
14
  attr_accessor :javascript_paths
14
15
  attr_accessor :whitelist_javascript_paths
@@ -37,7 +38,7 @@ module Papers
37
38
  @validate_javascript = true
38
39
  @validate_bower_components = false
39
40
  @validate_npm_packages = false
40
-
41
+ @ignore_npm_dev_dependencies = false
41
42
 
42
43
  @javascript_paths = [
43
44
  File.join(Dir.pwd, 'app', 'assets', 'javascripts'),
@@ -67,5 +68,9 @@ module Papers
67
68
  !!@validate_npm_packages
68
69
  end
69
70
 
71
+ def ignore_npm_dev_dependencies?
72
+ !!@ignore_npm_dev_dependencies
73
+ end
74
+
70
75
  end
71
76
  end
@@ -7,7 +7,8 @@ module Papers
7
7
  end
8
8
 
9
9
  def self.full_introspected_entries
10
- packages = (package['dependencies'] || {}).merge((package['devDependencies'] || {}))
10
+ packages = (package['dependencies'] || {})
11
+ packages.merge!((package['devDependencies'] || {})) unless Papers.config.ignore_npm_dev_dependencies
11
12
  packages.map do |name, version|
12
13
  # FIXME: This version cleanup is inadequate for npm version specifiers, which may be git or
13
14
  # tarball URLs.
@@ -1,7 +1,7 @@
1
1
  module Papers
2
2
  class Version
3
3
  MAJOR = 2
4
- MINOR = 2
4
+ MINOR = 3
5
5
  PATCH = 0
6
6
 
7
7
  def self.to_s
@@ -22,19 +22,28 @@ describe 'NpmPackageSpecification' do
22
22
  expect { Papers::NpmPackage.full_introspected_entries }.to raise_error JSON::ParserError
23
23
  end
24
24
 
25
- it 'combines dependencies and devDependencies' do
25
+ it 'combines dependencies and devDependencies by default' do
26
26
  allow(Papers::NpmPackage).to receive(:package).and_return({
27
27
  'dependencies' => { 'prod_package' => '~> 1.2.3' },
28
28
  'devDependencies' => {'dev_package' => '~> 1.2.0'}
29
29
  })
30
-
31
-
32
30
  expect(Papers::NpmPackage.full_introspected_entries).to eq([
33
31
  { 'name' => 'prod_package', 'version' => '1.2.3' },
34
32
  { 'name' => 'dev_package', 'version' => '1.2.0' }
35
33
  ])
36
34
  end
37
35
 
36
+ it 'does not combine dependencies and devDependencies when ignore_npm_dev_dependencies is true' do
37
+ allow(Papers::NpmPackage).to receive(:package).and_return({
38
+ 'dependencies' => { 'prod_package' => '~> 1.2.3' },
39
+ 'devDependencies' => {'dev_package' => '~> 1.2.0'}
40
+ })
41
+ allow_any_instance_of(Papers::Configuration).to receive(:ignore_npm_dev_dependencies).and_return(true)
42
+ expect(Papers::NpmPackage.full_introspected_entries).to eq([
43
+ { 'name' => 'prod_package', 'version' => '1.2.3' }
44
+ ])
45
+ end
46
+
38
47
  it 'returns dependencies when devDependencies is not defined' do
39
48
  allow(Papers::NpmPackage).to receive(:package).and_return({
40
49
  'dependencies' => { 'npm_package' => '1.2.3' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ralph Bodenner
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-08-10 00:00:00.000000000 Z
15
+ date: 2015-10-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake