xml-kit 0.3.1 → 0.6.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
  SHA256:
3
- metadata.gz: 7d54b8425fbadc4a5fc87ab86cb916a436126b1c0d396e79bf7d9610d0000aa2
4
- data.tar.gz: '096cf9d2ff95c8201044eb808a55a856a99f3f98f0b36f237e1eb9c07392aed8'
3
+ metadata.gz: 72cba660557fbb9fc55640fc292587d0bb9efc0d07d36f2dd7a57a5981f189e3
4
+ data.tar.gz: da50becdadf74efbdd6ab390f2ce634870bd3e716f2beb8d843f6c1ef980ce5e
5
5
  SHA512:
6
- metadata.gz: 4fb9ab21dab02c64219b6a65de104a759e2b603210362ff9a58c01147a32aa9c914d97018d405febc845604e3f727b9079d794b81dd955d600dcc71ea0f64b0b
7
- data.tar.gz: 8fe641c1031dbd7cc8d35786ff2baba1d33096c0fa4f2fb32430a62931eabe3cdc93668455cc9004ea86d0e4513451a201f79cc1867fbd904d99cfe0a11b08c1
6
+ metadata.gz: f06dade4d5725222c16c26f2ac5063585d07e62d6f554f0428743a011d883a9a2c4fe812c56042201cd5ff11cb91b533c17d4de955d60e6aaff7539a8c6d0e6d
7
+ data.tar.gz: 771f4241d74091bd09b85dfbb2bd57675d6ab9e09b2ff2e766b730c017e94f1860675e4701cc9845e945771fb1297c13daa46b9bfd91944e03146eed0d8e316d
@@ -0,0 +1,9 @@
1
+ ---
2
+ version: 2
3
+ updates:
4
+ - package-ecosystem: "bundler"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "daily"
8
+ assignees:
9
+ - "xlgmokha"
@@ -0,0 +1,41 @@
1
+ name: ci
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ branches: [main]
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ ruby-version: ['2.7', '3.0', '3.1']
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ bundler-cache: true
20
+ - name: Running tests…
21
+ run: sh bin/test
22
+ style:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: '3.1'
29
+ bundler-cache: true
30
+ - name: Running style checks…
31
+ run: sh bin/style
32
+ audit:
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v2
36
+ - uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: '2.7'
39
+ bundler-cache: true
40
+ - name: Running audit…
41
+ run: sh bin/audit
data/.rubocop.yml CHANGED
@@ -9,7 +9,13 @@ AllCops:
9
9
  - 'spec/fixtures/**/*'
10
10
  - 'tmp/**/*'
11
11
  - 'vendor/**/*'
12
- TargetRubyVersion: 2.2
12
+ TargetRubyVersion: 2.7
13
+
14
+ Layout/BlockAlignment:
15
+ EnforcedStyleAlignWith: start_of_line
16
+ Exclude:
17
+ - 'lib/**/*.builder'
18
+ - 'spec/**/*'
13
19
 
14
20
  Layout/ClassStructure:
15
21
  Enabled: true
@@ -30,11 +36,11 @@ Layout/ClassStructure:
30
36
  Layout/EndOfLine:
31
37
  EnforcedStyle: lf
32
38
 
33
- Layout/IndentArray:
39
+ Layout/FirstArrayElementIndentation:
34
40
  EnforcedStyle: consistent
35
41
 
36
- Layout/IndentHeredoc:
37
- EnforcedStyle: active_support
42
+ Layout/MultilineOperationIndentation:
43
+ EnforcedStyle: indented
38
44
 
39
45
  Lint/AmbiguousBlockAssociation:
40
46
  Exclude:
@@ -44,6 +50,10 @@ Lint/InterpolationCheck:
44
50
  Exclude:
45
51
  - 'spec/**/*.rb'
46
52
 
53
+ Metrics/AbcSize:
54
+ Exclude:
55
+ - 'lib/xml/kit/self_signed_certificate.rb'
56
+
47
57
  Metrics/BlockLength:
48
58
  Exclude:
49
59
  - '**/**/*.builder'
@@ -56,7 +66,7 @@ Metrics/ModuleLength:
56
66
  Exclude:
57
67
  - 'spec/**/*.rb'
58
68
 
59
- Metrics/LineLength:
69
+ Layout/LineLength:
60
70
  IgnoredPatterns: ['(\A|\s)#']
61
71
  Exclude:
62
72
  - 'spec/**/*.rb'
@@ -84,9 +94,16 @@ Style/TrailingCommaInHashLiteral:
84
94
  RSpec/ExampleLength:
85
95
  Max: 80
86
96
 
97
+ RSpec/LeakyConstantDeclaration:
98
+ Exclude:
99
+ - 'spec/xml/kit/templatable_spec.rb'
100
+
87
101
  RSpec/MultipleExpectations:
88
102
  Enabled: false
89
103
 
104
+ RSpec/MultipleMemoizedHelpers:
105
+ Enabled: false
106
+
90
107
  RSpec/NamedSubject:
91
108
  Enabled: false
92
109
 
data/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
- Version 0.3.1
1
+ Version 0.6.0
2
+
2
3
  # Changelog
3
4
  All notable changes to this project will be documented in this file.
4
5
 
@@ -6,8 +7,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
7
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
8
 
8
9
  ## [Unreleased]
10
+
11
+ ## [0.6.0] - 2022-05-23
12
+ ### Added
13
+ - Add support for Ruby 3.1
14
+
15
+ ### Removed
16
+ - Drop support for Ruby 2.5
17
+ - Drop support for Ruby 2.6
18
+
19
+ ## [0.5.0] - 2021-01-30
20
+ ### Changed
21
+ - Minimum Ruby 2.5+
22
+
23
+ ## [0.4.0] - 2019-04-30
24
+ ### Added
25
+ - provide stable API for specifying the digest method and signature method.
26
+
9
27
  ### Changed
10
- - nil
28
+ - drop support for ruby 2.2
29
+ - drop support for ruby 2.3
30
+ - use bundler 2.0
11
31
 
12
32
  ## [0.3.1] - 2019-04-01
13
33
  ### Changed
@@ -25,22 +45,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
25
45
  - \_assign does not coerce values by default.
26
46
  - errors are merged together instead of overwritten during attribute validation.
27
47
 
28
- [Unreleased]: https://github.com/saml-kit/xml-kit/compare/v0.3.1...HEAD
29
- [0.3.1]: https://github.com/saml-kit/xml-kit/compare/v0.3.0...v0.3.1
30
- [0.3.0]: https://github.com/saml-kit/xml-kit/compare/v0.2.0...v0.3.0
31
- [0.2.0]: https://github.com/saml-kit/xml-kit/compare/v0.1.14...v0.2.0
32
- [0.1.14]: https://github.com/saml-kit/xml-kit/compare/v0.1.13...v0.1.14
33
- [0.1.13]: https://github.com/saml-kit/xml-kit/compare/v0.1.12...v0.1.13
34
- [0.1.12]: https://github.com/saml-kit/xml-kit/compare/v0.1.11...v0.1.12
35
- [0.1.11]: https://github.com/saml-kit/xml-kit/compare/v0.1.10...v0.1.11
36
- [0.1.10]: https://github.com/saml-kit/xml-kit/compare/v0.1.9...v0.1.10
37
- [0.1.9]: https://github.com/saml-kit/xml-kit/compare/v0.1.8...v0.1.9
38
- [0.1.8]: https://github.com/saml-kit/xml-kit/compare/v0.1.7...v0.1.8
39
- [0.1.7]: https://github.com/saml-kit/xml-kit/compare/v0.1.6...v0.1.7
40
- [0.1.6]: https://github.com/saml-kit/xml-kit/compare/v0.1.5...v0.1.6
41
- [0.1.5]: https://github.com/saml-kit/xml-kit/compare/v0.1.4...v0.1.5
42
- [0.1.4]: https://github.com/saml-kit/xml-kit/compare/v0.1.3...v0.1.4
43
- [0.1.3]: https://github.com/saml-kit/xml-kit/compare/v0.1.1...v0.1.3
44
- [0.1.1]: https://github.com/saml-kit/xml-kit/compare/v0.1.1...v0.1.1
45
- [0.1.1]: https://github.com/saml-kit/xml-kit/compare/v0.1.0...v0.1.1
46
- [0.1.0]: https://github.com/saml-kit/xml-kit/compare/v0.1.0...v0.1.0
48
+ [Unreleased]: https://github.com/xlgmokha/xml-kit/compare/v0.6.0...HEAD
49
+ [0.6.0]: https://github.com/xlgmokha/xml-kit/compare/v0.5.0...v0.6.0
50
+ [0.5.0]: https://github.com/xlgmokha/xml-kit/compare/v0.4.0...v0.5.0
51
+ [0.4.0]: https://github.com/xlgmokha/xml-kit/compare/v0.3.1...v0.4.0
52
+ [0.3.1]: https://github.com/xlgmokha/xml-kit/compare/v0.3.0...v0.3.1
53
+ [0.3.0]: https://github.com/xlgmokha/xml-kit/compare/v0.2.0...v0.3.0
54
+ [0.2.0]: https://github.com/xlgmokha/xml-kit/compare/v0.1.14...v0.2.0
55
+ [0.1.14]: https://github.com/xlgmokha/xml-kit/compare/v0.1.13...v0.1.14
56
+ [0.1.13]: https://github.com/xlgmokha/xml-kit/compare/v0.1.12...v0.1.13
57
+ [0.1.12]: https://github.com/xlgmokha/xml-kit/compare/v0.1.11...v0.1.12
58
+ [0.1.11]: https://github.com/xlgmokha/xml-kit/compare/v0.1.10...v0.1.11
59
+ [0.1.10]: https://github.com/xlgmokha/xml-kit/compare/v0.1.9...v0.1.10
60
+ [0.1.9]: https://github.com/xlgmokha/xml-kit/compare/v0.1.8...v0.1.9
61
+ [0.1.8]: https://github.com/xlgmokha/xml-kit/compare/v0.1.7...v0.1.8
62
+ [0.1.7]: https://github.com/xlgmokha/xml-kit/compare/v0.1.6...v0.1.7
63
+ [0.1.6]: https://github.com/xlgmokha/xml-kit/compare/v0.1.5...v0.1.6
64
+ [0.1.5]: https://github.com/xlgmokha/xml-kit/compare/v0.1.4...v0.1.5
65
+ [0.1.4]: https://github.com/xlgmokha/xml-kit/compare/v0.1.3...v0.1.4
66
+ [0.1.3]: https://github.com/xlgmokha/xml-kit/compare/v0.1.1...v0.1.3
67
+ [0.1.1]: https://github.com/xlgmokha/xml-kit/compare/v0.1.1...v0.1.1
68
+ [0.1.1]: https://github.com/xlgmokha/xml-kit/compare/v0.1.0...v0.1.1
69
+ [0.1.0]: https://github.com/xlgmokha/xml-kit/compare/v0.1.0...v0.1.0
data/Gemfile.lock ADDED
@@ -0,0 +1,102 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ xml-kit (0.6.0)
5
+ activemodel (>= 4.2.0)
6
+ builder (~> 3.2)
7
+ nokogiri (~> 1.10)
8
+ tilt (>= 1.4.1)
9
+ xmldsig (~> 0.6)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activemodel (7.0.3)
15
+ activesupport (= 7.0.3)
16
+ activesupport (7.0.3)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ ast (2.4.2)
22
+ builder (3.2.4)
23
+ bundler-audit (0.9.1)
24
+ bundler (>= 1.2.0, < 3)
25
+ thor (~> 1.0)
26
+ concurrent-ruby (1.1.10)
27
+ diff-lcs (1.5.0)
28
+ docile (1.4.0)
29
+ ffaker (2.21.0)
30
+ i18n (1.10.0)
31
+ concurrent-ruby (~> 1.0)
32
+ mini_portile2 (2.8.0)
33
+ minitest (5.15.0)
34
+ nokogiri (1.13.6)
35
+ mini_portile2 (~> 2.8.0)
36
+ racc (~> 1.4)
37
+ parallel (1.22.1)
38
+ parser (3.1.2.0)
39
+ ast (~> 2.4.1)
40
+ racc (1.6.0)
41
+ rainbow (3.1.1)
42
+ rake (13.0.6)
43
+ regexp_parser (2.4.0)
44
+ rexml (3.2.5)
45
+ rspec (3.11.0)
46
+ rspec-core (~> 3.11.0)
47
+ rspec-expectations (~> 3.11.0)
48
+ rspec-mocks (~> 3.11.0)
49
+ rspec-core (3.11.0)
50
+ rspec-support (~> 3.11.0)
51
+ rspec-expectations (3.11.0)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.11.0)
54
+ rspec-mocks (3.11.1)
55
+ diff-lcs (>= 1.2.0, < 2.0)
56
+ rspec-support (~> 3.11.0)
57
+ rspec-support (3.11.0)
58
+ rubocop (0.93.1)
59
+ parallel (~> 1.10)
60
+ parser (>= 2.7.1.5)
61
+ rainbow (>= 2.2.2, < 4.0)
62
+ regexp_parser (>= 1.8)
63
+ rexml
64
+ rubocop-ast (>= 0.6.0)
65
+ ruby-progressbar (~> 1.7)
66
+ unicode-display_width (>= 1.4.0, < 2.0)
67
+ rubocop-ast (1.18.0)
68
+ parser (>= 3.1.1.0)
69
+ rubocop-rspec (1.44.1)
70
+ rubocop (~> 0.87)
71
+ rubocop-ast (>= 0.7.1)
72
+ ruby-progressbar (1.11.0)
73
+ simplecov (0.21.2)
74
+ docile (~> 1.1)
75
+ simplecov-html (~> 0.11)
76
+ simplecov_json_formatter (~> 0.1)
77
+ simplecov-html (0.12.3)
78
+ simplecov_json_formatter (0.1.4)
79
+ thor (1.2.1)
80
+ tilt (2.0.10)
81
+ tzinfo (2.0.4)
82
+ concurrent-ruby (~> 1.0)
83
+ unicode-display_width (1.8.0)
84
+ xmldsig (0.6.6)
85
+ nokogiri (>= 1.6.8, < 2.0.0)
86
+
87
+ PLATFORMS
88
+ ruby
89
+
90
+ DEPENDENCIES
91
+ bundler (~> 2.0)
92
+ bundler-audit (~> 0.6)
93
+ ffaker (~> 2.7)
94
+ rake (~> 13.0)
95
+ rspec (~> 3.0)
96
+ rubocop (~> 0.52)
97
+ rubocop-rspec (~> 1.22)
98
+ simplecov (~> 0.21.2)
99
+ xml-kit!
100
+
101
+ BUNDLED WITH
102
+ 2.2.7
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 mo
3
+ Copyright (c) 2017 mo khan
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # Xml::Kit
2
2
 
3
+ [![Build Status](https://github.com/xlgmokha/xml-kit/workflows/ci/badge.svg)](https://github.com/xlgmokha/xml-kit/actions)
3
4
  [![Gem Version](https://badge.fury.io/rb/xml-kit.svg)](https://rubygems.org/gems/xml-kit)
4
- [![Code Climate](https://codeclimate.com/github/saml-kit/xml-kit.svg)](https://codeclimate.com/github/saml-kit/xml-kit)
5
- [![Build Status](https://travis-ci.org/saml-kit/xml-kit.svg?branch=master)](https://travis-ci.org/saml-kit/xml-kit)
6
- [![Security](https://hakiri.io/github/saml-kit/xml-kit/master.svg)](https://hakiri.io/github/saml-kit/xml-kit/master)
7
5
 
8
6
  Xml::Kit is a toolkit for working with XML. It supports adding [XML Digital Signatures](https://www.w3.org/TR/xmldsig-core/)
9
7
  and [XML Encryption](https://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html).
@@ -113,13 +111,13 @@ This will produce something like the following:
113
111
 
114
112
  ## Development
115
113
 
116
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
114
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
117
115
 
118
116
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
119
117
 
120
118
  ## Contributing
121
119
 
122
- Bug reports and pull requests are welcome on GitHub at https://github.com/saml-kit/xml-kit.
120
+ Bug reports and pull requests are welcome on GitHub at https://github.com/xlgmokha/xml-kit.
123
121
 
124
122
  ## License
125
123
 
data/Rakefile CHANGED
@@ -10,4 +10,3 @@ RuboCop::RakeTask.new(:rubocop)
10
10
  Bundler::Audit::Task.new
11
11
 
12
12
  task default: :spec
13
- task lint: [:rubocop, 'bundle:audit']
data/bin/audit ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+ [ -z "$DEBUG" ] || set -x
5
+
6
+ cd "$(dirname "$0")/.."
7
+
8
+ bundle exec rake bundle:audit
data/bin/setup CHANGED
@@ -1,6 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
1
+ #!/bin/sh
2
+
3
+ set -e
4
+ [ -z "$DEBUG" ] || set -x
5
+
6
+ cd "$(dirname "$0")/.."
5
7
 
6
8
  bundle install
data/bin/style ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+ [ -z "$DEBUG" ] || set -x
5
+
6
+ cd "$(dirname "$0")/.."
7
+
8
+ bundle exec rake rubocop
data/bin/test CHANGED
@@ -1,17 +1,8 @@
1
1
  #!/bin/sh
2
2
 
3
- # script/test: Run test suite for application. Optionally pass in a path to an
4
- # individual test file to run a single test.
5
-
6
-
7
3
  set -e
8
-
9
- cd "$(dirname "$0")/.."
10
-
11
4
  [ -z "$DEBUG" ] || set -x
12
5
 
13
- echo [$(date "+%H:%M:%S")] "==> Running setup…"
14
- bin/setup
6
+ cd "$(dirname "$0")/.."
15
7
 
16
- echo [$(date "+%H:%M:%S")] "==> Running tests…"
17
8
  bundle exec rake spec
@@ -7,9 +7,7 @@ module Xml
7
7
  # {include:file:spec/xml/kit/certificate_spec.rb}
8
8
  class Certificate
9
9
  include Templatable
10
- # rubocop:disable Metrics/LineLength
11
10
  BASE64_FORMAT = %r(\A([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\Z).freeze
12
- # rubocop:enable Metrics/LineLength
13
11
  BEGIN_CERT = /-----BEGIN CERTIFICATE-----/.freeze
14
12
  END_CERT = /-----END CERTIFICATE-----/.freeze
15
13
  # The use can be `:signing` or `:encryption`. Use `nil` for both.
@@ -4,7 +4,7 @@ module Xml
4
4
  module Kit
5
5
  module Crypto
6
6
  class OaepCipher
7
- ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-oaep-mgf1p".freeze
7
+ ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-oaep-mgf1p"
8
8
  ALGORITHMS = {
9
9
  ALGORITHM => true
10
10
  }.freeze
@@ -4,7 +4,7 @@ module Xml
4
4
  module Kit
5
5
  module Crypto
6
6
  class RsaCipher
7
- ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5".freeze
7
+ ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5"
8
8
  attr_reader :algorithm, :key
9
9
 
10
10
  def initialize(algorithm, key)
@@ -4,7 +4,7 @@ module Xml
4
4
  module Kit
5
5
  module Crypto
6
6
  class SymmetricCipher
7
- DEFAULT_ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}aes256-cbc".freeze
7
+ DEFAULT_ALGORITHM = "#{::Xml::Kit::Namespaces::XMLENC}aes256-cbc"
8
8
  ALGORITHMS = {
9
9
  "#{::Xml::Kit::Namespaces::XMLENC}tripledes-cbc" => 'DES-EDE3-CBC',
10
10
  "#{::Xml::Kit::Namespaces::XMLENC}aes128-cbc" => 'AES-128-CBC',
@@ -56,12 +56,10 @@ module Xml
56
56
  def symmetric_key_from(encrypted_key, attempts = private_keys.count)
57
57
  cipher, algorithm = cipher_and_algorithm_from(encrypted_key)
58
58
  private_keys.each do |private_key|
59
- begin
60
- attempts -= 1
61
- return to_plaintext(cipher, private_key, algorithm)
62
- rescue OpenSSL::PKey::RSAError
63
- raise if attempts.zero?
64
- end
59
+ attempts -= 1
60
+ return to_plaintext(cipher, private_key, algorithm)
61
+ rescue OpenSSL::PKey::RSAError
62
+ raise if attempts.zero?
65
63
  end
66
64
  raise DecryptionError, private_keys
67
65
  end
@@ -12,22 +12,20 @@ module Xml
12
12
  attr_reader :symmetric_cipher
13
13
  attr_reader :symmetric_cipher_value
14
14
 
15
- def initialize(
16
- raw_xml,
17
- id: Id.generate,
18
- symmetric_cipher: Xml::Kit::Crypto::SymmetricCipher.new,
19
- asymmetric_cipher:,
20
- key_info: nil
21
- )
15
+ def initialize(raw_xml,
16
+ id: Id.generate,
17
+ symmetric_cipher: nil,
18
+ asymmetric_cipher: nil,
19
+ key_info: nil)
22
20
  @id = id
23
- @symmetric_cipher = symmetric_cipher
21
+ @symmetric_cipher = symmetric_cipher ||
22
+ key_info.try(:symmetric_cipher) ||
23
+ Xml::Kit::Crypto::SymmetricCipher.new
24
24
  @symmetric_cipher_value = Base64.strict_encode64(
25
- symmetric_cipher.encrypt(raw_xml)
26
- )
27
- @key_info = key_info || create_key_info_for(
28
- symmetric_cipher,
29
- asymmetric_cipher
25
+ @symmetric_cipher.encrypt(raw_xml)
30
26
  )
27
+ @key_info = key_info ||
28
+ create_key_info_for(@symmetric_cipher, asymmetric_cipher)
31
29
  end
32
30
 
33
31
  def to_xml(xml: ::Builder::XmlMarkup.new)
@@ -14,15 +14,16 @@ module Xml
14
14
  attr_reader :asymmetric_cipher, :symmetric_cipher
15
15
  attr_accessor :key_info
16
16
 
17
- def initialize(
18
- id: Id.generate,
19
- asymmetric_cipher:,
20
- symmetric_cipher: Xml::Kit::Crypto::SymmetricCipher.new,
21
- key_info: nil
22
- )
17
+ def initialize(id: Id.generate,
18
+ asymmetric_cipher: nil,
19
+ symmetric_cipher: nil,
20
+ key_info: nil)
23
21
  @id = id
24
- @asymmetric_cipher = asymmetric_cipher
25
- @symmetric_cipher = symmetric_cipher
22
+ @asymmetric_cipher = asymmetric_cipher ||
23
+ key_info.try(:asymmetric_cipher)
24
+ @symmetric_cipher = symmetric_cipher ||
25
+ key_info.try(:symmetric_cipher) ||
26
+ Xml::Kit::Crypto::SymmetricCipher.new
26
27
  @key_info = key_info
27
28
  end
28
29
 
@@ -4,21 +4,20 @@ module Xml
4
4
  module Kit
5
5
  # @deprecated Use {#Xml::Kit::EncryptedData} class instead of this
6
6
  class Encryption < EncryptedData
7
+ DEFAULT_SYMMETRIC = Crypto::SymmetricCipher::DEFAULT_ALGORITHM
8
+ DEFAULT_ASYMMETRIC = Crypto::RsaCipher::ALGORITHM
9
+
7
10
  attr_reader :asymmetric_algorithm
8
11
  attr_reader :symmetric_algorithm
9
12
  attr_reader :symmetric_cipher_value
10
13
  attr_reader :key_info
11
14
 
12
- def initialize(
13
- raw_xml,
14
- public_key,
15
- symmetric_algorithm: Crypto::SymmetricCipher::DEFAULT_ALGORITHM,
16
- asymmetric_algorithm: Crypto::RsaCipher::ALGORITHM,
17
- key_info: nil
18
- )
15
+ def initialize(raw_xml, public_key,
16
+ symmetric_algorithm: DEFAULT_SYMMETRIC,
17
+ asymmetric_algorithm: DEFAULT_ASYMMETRIC, key_info: nil)
19
18
  @symmetric_algorithm = symmetric_algorithm
20
19
  @asymmetric_algorithm = asymmetric_algorithm
21
- Xml::Kit.deprecate('Encryption is deprecated. Use EncryptedData.')
20
+ Xml::Kit.deprecate('Encryption', alternative: 'EncryptedData')
22
21
  super(raw_xml,
23
22
  symmetric_cipher: symmetric(symmetric_algorithm),
24
23
  asymmetric_cipher: asymmetric(asymmetric_algorithm, public_key),
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Xml
2
4
  module Kit
3
5
  class KeyInfo
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Xml
2
4
  module Kit
3
5
  class KeyInfo
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Xml
2
4
  module Kit
3
5
  class KeyInfo
@@ -16,11 +16,31 @@ module Xml
16
16
  attr_accessor :x509_data
17
17
  attr_accessor :encrypted_key
18
18
 
19
- def initialize(x509: nil)
19
+ def initialize(x509: nil, encrypted_key: nil)
20
+ @encrypted_key = encrypted_key
20
21
  @x509_data = x509
21
22
  yield self if block_given?
22
23
  end
23
24
 
25
+ def asymmetric_cipher(algorithm: Crypto::RsaCipher::ALGORITHM)
26
+ return encrypted_key.asymmetric_cipher if encrypted_key
27
+
28
+ if x509_data
29
+ return Crypto.cipher_for(
30
+ derive_algorithm_from(x509_data.public_key),
31
+ x509_data.public_key
32
+ )
33
+ end
34
+
35
+ super(algorithm: algorithm)
36
+ end
37
+
38
+ def symmetric_cipher
39
+ return super if encrypted_key.nil?
40
+
41
+ encrypted_key.symmetric_cipher
42
+ end
43
+
24
44
  def key_value
25
45
  @key_value ||= KeyValue.new
26
46
  end
@@ -35,6 +55,17 @@ module Xml
35
55
 
36
56
  Base64.strict_encode64(ski.value)
37
57
  end
58
+
59
+ private
60
+
61
+ def derive_algorithm_from(key)
62
+ case key
63
+ when OpenSSL::PKey::RSA
64
+ "#{::Xml::Kit::Namespaces::XMLENC}rsa-1_5"
65
+ else
66
+ raise ::Xml::Kit::Error, "#{key.try(:class)} is not supported"
67
+ end
68
+ end
38
69
  end
39
70
  end
40
71
  end
@@ -30,12 +30,10 @@ module Xml
30
30
  # @param use [Symbol] Can be either `:signing` or `:encryption`.
31
31
  # @param passphrase [String] the passphrase to use to encrypt the private key.
32
32
  # @param algorithm [String] the symmetric algorithm to use for encrypting the private key.
33
- def self.generate(
34
- use:,
35
- passphrase: SecureRandom.uuid,
36
- algorithm: ::Xml::Kit::Crypto::SymmetricCipher::DEFAULT_ALGORITHM
37
- )
38
- algorithm = ::Xml::Kit::Crypto::SymmetricCipher::ALGORITHMS[algorithm]
33
+ def self.generate(use:,
34
+ passphrase: SecureRandom.uuid,
35
+ algorithm: Crypto::SymmetricCipher::DEFAULT_ALGORITHM)
36
+ algorithm = Crypto::SymmetricCipher::ALGORITHMS[algorithm]
39
37
  certificate, private_key = SelfSignedCertificate.new.create(
40
38
  algorithm: algorithm,
41
39
  passphrase: passphrase
@@ -3,18 +3,18 @@
3
3
  module Xml
4
4
  module Kit
5
5
  module Namespaces
6
- CANONICALIZATION = 'http://www.w3.org/2001/10/xml-exc-c14n#'.freeze
7
- ENVELOPED_SIG = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'.freeze
8
- RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'.freeze
9
- RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'.freeze
10
- RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'.freeze
11
- RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512'.freeze
12
- SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1'.freeze
13
- SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'.freeze
14
- SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#sha384'.freeze
15
- SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'.freeze
16
- XMLDSIG = 'http://www.w3.org/2000/09/xmldsig#'.freeze
17
- XMLENC = 'http://www.w3.org/2001/04/xmlenc#'.freeze
6
+ CANONICALIZATION = 'http://www.w3.org/2001/10/xml-exc-c14n#'
7
+ ENVELOPED_SIG = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'
8
+ RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'
9
+ RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'
10
+ RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'
11
+ RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512'
12
+ SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1'
13
+ SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'
14
+ SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#sha384'
15
+ SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'
16
+ XMLDSIG = 'http://www.w3.org/2000/09/xmldsig#'
17
+ XMLENC = 'http://www.w3.org/2001/04/xmlenc#'
18
18
  end
19
19
  end
20
20
  end
@@ -3,13 +3,11 @@
3
3
  module Xml
4
4
  module Kit
5
5
  class SelfSignedCertificate
6
- SUBJECT = '/C=CA/ST=AB/L=Calgary/O=XmlKit/OU=XmlKit/CN=XmlKit'.freeze
6
+ SUBJECT = '/C=CA/ST=AB/L=Calgary/O=XmlKit/OU=XmlKit/CN=XmlKit'
7
7
 
8
- def create(
9
- algorithm: 'AES-256-CBC',
10
- passphrase: nil,
11
- key_pair: OpenSSL::PKey::RSA.new(2048)
12
- )
8
+ def create(algorithm: 'AES-256-CBC',
9
+ passphrase: nil,
10
+ key_pair: OpenSSL::PKey::RSA.new(2048))
13
11
  certificate = certificate_for(key_pair.public_key)
14
12
  certificate.sign(key_pair, OpenSSL::Digest::SHA256.new)
15
13
  [certificate.to_pem, export(key_pair, algorithm, passphrase)]
@@ -15,7 +15,7 @@ module Xml
15
15
  SHA512: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512',
16
16
  }.freeze
17
17
  DIGEST_METHODS = {
18
- SHA1: 'http://www.w3.org/2000/09/xmldsig#SHA1',
18
+ SHA1: 'http://www.w3.org/2000/09/xmldsig#sha1',
19
19
  SHA224: 'http://www.w3.org/2001/04/xmldsig-more#sha224',
20
20
  SHA256: 'http://www.w3.org/2001/04/xmlenc#sha256',
21
21
  SHA384: 'http://www.w3.org/2001/04/xmldsig-more#sha384',
@@ -27,12 +27,10 @@ module Xml
27
27
  attr_reader :reference_id
28
28
  attr_reader :signature_method
29
29
 
30
- def initialize(
31
- reference_id,
32
- signature_method: :SH256,
33
- digest_method: :SHA256,
34
- certificate:
35
- )
30
+ def initialize(reference_id,
31
+ signature_method: :SH256,
32
+ digest_method: :SHA256,
33
+ certificate:)
36
34
  @certificate = certificate
37
35
  @digest_method = DIGEST_METHODS[digest_method]
38
36
  @reference_id = reference_id
@@ -39,12 +39,10 @@ module Xml
39
39
  end
40
40
 
41
41
  # @!visibility private
42
- def self.sign(
43
- xml: ::Builder::XmlMarkup.new,
44
- key_pair:,
45
- signature_method: :SHA256,
46
- digest_method: :SHA256
47
- )
42
+ def self.sign(xml: ::Builder::XmlMarkup.new,
43
+ key_pair:,
44
+ signature_method: :SHA256,
45
+ digest_method: :SHA256)
48
46
  signatures = new(
49
47
  key_pair: key_pair,
50
48
  signature_method: signature_method,
@@ -17,6 +17,14 @@ module Xml
17
17
  # The [Xml::Kit::Certificate] that contains the public key to use for encrypting the document.
18
18
  attr_accessor :encryption_certificate
19
19
 
20
+ # Allows you to specify the digest method algorithm. (Default: SHA256)
21
+ # A list of digest methods can be found in [Xml::Kit::Signature].
22
+ attr_accessor :digest_method
23
+
24
+ # Allows you to specify the signature method algorithm. (Default: SHA256)
25
+ # A list of signature methods can be found in [Xml::Kit::Signature].
26
+ attr_accessor :signature_method
27
+
20
28
  # Returns the generated XML document with an XML Digital Signature and XML Encryption.
21
29
  def to_xml(xml: ::Builder::XmlMarkup.new, pretty: false)
22
30
  result = signatures.complete(render(self, xml: xml))
@@ -28,11 +36,12 @@ module Xml
28
36
  # @since 0.3.0
29
37
  # @param xml [Builder::XmlMarkup] the xml builder instance
30
38
  # @param id [String] the id of EncryptedKey element
31
- def encrypt_key_for(xml:, id:)
39
+ def encrypt_key_for(xml:, id:, key_info: nil)
32
40
  ::Xml::Kit::EncryptedKey.new(
33
41
  id: id,
34
42
  asymmetric_cipher: asymmetric_cipher,
35
- symmetric_cipher: symmetric_cipher
43
+ symmetric_cipher: symmetric_cipher,
44
+ key_info: key_info
36
45
  ).to_xml(xml: xml)
37
46
  end
38
47
 
@@ -67,6 +76,8 @@ module Xml
67
76
  # @abstract
68
77
  # @since 0.3.0
69
78
  def asymmetric_cipher(algorithm: Crypto::RsaCipher::ALGORITHM)
79
+ raise Xml::Kit::Error, 'encryption_certificate is not specified.' unless encryption_certificate
80
+
70
81
  @asymmetric_cipher ||= Crypto.cipher_for(
71
82
  algorithm,
72
83
  encryption_certificate.public_key
@@ -94,9 +105,11 @@ module Xml
94
105
  # Allows you to specify which key pair to use for generating an XML digital signature.
95
106
  #
96
107
  # @param key_pair [Xml::Kit::KeyPair] the key pair to use for signing.
97
- def sign_with(key_pair)
108
+ def sign_with(key_pair, signature_method: :SHA256, digest_method: :SHA256)
98
109
  self.signing_key_pair = key_pair
99
110
  self.embed_signature = true
111
+ self.signature_method = signature_method
112
+ self.digest_method = digest_method
100
113
  signatures.sign_with(key_pair)
101
114
  end
102
115
 
@@ -118,19 +131,11 @@ module Xml
118
131
  def signatures
119
132
  @signatures ||= ::Xml::Kit::Signatures.new(
120
133
  key_pair: signing_key_pair,
121
- digest_method: digest_method,
122
- signature_method: signature_method
134
+ digest_method: digest_method || :SHA256,
135
+ signature_method: signature_method || :SHA256
123
136
  )
124
137
  end
125
138
 
126
- def digest_method
127
- :SHA256
128
- end
129
-
130
- def signature_method
131
- :SHA256
132
- end
133
-
134
139
  # @!visibility private
135
140
  def encrypt?
136
141
  encrypt && encryption_certificate
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Xml
4
4
  module Kit
5
- VERSION = '0.3.1'.freeze
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
data/lib/xml/kit.rb CHANGED
@@ -35,6 +35,8 @@ require 'xml/kit/version'
35
35
 
36
36
  module Xml
37
37
  module Kit
38
+ class Error < StandardError; end
39
+
38
40
  class << self
39
41
  def logger
40
42
  @logger ||= Logger.new(STDOUT)
@@ -42,9 +44,13 @@ module Xml
42
44
 
43
45
  attr_writer :logger
44
46
 
45
- def deprecate(message)
47
+ def deprecate(name, alternative: nil)
46
48
  @deprecation ||= ActiveSupport::Deprecation.new('1.0.0', 'xml-kit')
47
- @deprecation.deprecation_warning(message)
49
+ if alternative
50
+ @deprecation.deprecation_warning(name, "Use `#{alternative}` instead")
51
+ else
52
+ @deprecation.deprecation_warning(name)
53
+ end
48
54
  end
49
55
  end
50
56
  end
data/xml-kit.gemspec CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.summary = 'A simple toolkit for working with XML.'
14
14
  spec.description = 'A simple toolkit for working with XML.'
15
- spec.homepage = 'https://github.com/saml-kit/xml-kit'
15
+ spec.homepage = 'https://github.com/xlgmokha/xml-kit'
16
16
  spec.license = 'MIT'
17
- spec.required_ruby_version = '>= 2.2.0'
17
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
20
  f.match(%r{^(test|spec|features)/})
@@ -26,14 +26,15 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency 'activemodel', '>= 4.2.0'
28
28
  spec.add_dependency 'builder', '~> 3.2'
29
- spec.add_dependency 'nokogiri', '>= 1.8.5'
29
+ spec.add_dependency 'nokogiri', '~> 1.10'
30
30
  spec.add_dependency 'tilt', '>= 1.4.1'
31
31
  spec.add_dependency 'xmldsig', '~> 0.6'
32
+ spec.add_development_dependency 'bundler', '~> 2.0'
32
33
  spec.add_development_dependency 'bundler-audit', '~> 0.6'
33
34
  spec.add_development_dependency 'ffaker', '~> 2.7'
34
- spec.add_development_dependency 'rake', '~> 10.0'
35
+ spec.add_development_dependency 'rake', '~> 13.0'
35
36
  spec.add_development_dependency 'rspec', '~> 3.0'
36
37
  spec.add_development_dependency 'rubocop', '~> 0.52'
37
38
  spec.add_development_dependency 'rubocop-rspec', '~> 1.22'
38
- spec.add_development_dependency 'simplecov', '~> 0.15.1'
39
+ spec.add_development_dependency 'simplecov', '~> 0.21.2'
39
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-01 00:00:00.000000000 Z
11
+ date: 2022-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.8.5
47
+ version: '1.10'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.8.5
54
+ version: '1.10'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: tilt
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: bundler-audit
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +128,14 @@ dependencies:
114
128
  requirements:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: '10.0'
131
+ version: '13.0'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: '10.0'
138
+ version: '13.0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: rspec
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +184,14 @@ dependencies:
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: 0.15.1
187
+ version: 0.21.2
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: 0.15.1
194
+ version: 0.21.2
181
195
  description: A simple toolkit for working with XML.
182
196
  email:
183
197
  - mo@mokhan.ca
@@ -185,20 +199,21 @@ executables: []
185
199
  extensions: []
186
200
  extra_rdoc_files: []
187
201
  files:
202
+ - ".github/dependabot.yml"
203
+ - ".github/workflows/ci.yml"
188
204
  - ".gitignore"
189
- - ".gitlab-ci.yml"
190
205
  - ".rspec"
191
206
  - ".rubocop.yml"
192
- - ".travis.yml"
193
207
  - CHANGELOG.md
194
208
  - Gemfile
209
+ - Gemfile.lock
195
210
  - LICENSE.txt
196
211
  - README.md
197
212
  - Rakefile
198
- - bin/cibuild
213
+ - bin/audit
199
214
  - bin/console
200
- - bin/lint
201
215
  - bin/setup
216
+ - bin/style
202
217
  - bin/test
203
218
  - lib/xml-kit.rb
204
219
  - lib/xml/kit.rb
@@ -238,12 +253,12 @@ files:
238
253
  - lib/xml/kit/templates/signature.builder
239
254
  - lib/xml/kit/version.rb
240
255
  - xml-kit.gemspec
241
- homepage: https://github.com/saml-kit/xml-kit
256
+ homepage: https://github.com/xlgmokha/xml-kit
242
257
  licenses:
243
258
  - MIT
244
259
  metadata:
245
260
  yard.run: yri
246
- post_install_message:
261
+ post_install_message:
247
262
  rdoc_options: []
248
263
  require_paths:
249
264
  - lib
@@ -251,15 +266,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
266
  requirements:
252
267
  - - ">="
253
268
  - !ruby/object:Gem::Version
254
- version: 2.2.0
269
+ version: 2.7.0
255
270
  required_rubygems_version: !ruby/object:Gem::Requirement
256
271
  requirements:
257
272
  - - ">="
258
273
  - !ruby/object:Gem::Version
259
274
  version: '0'
260
275
  requirements: []
261
- rubygems_version: 3.0.2
262
- signing_key:
276
+ rubygems_version: 3.3.13
277
+ signing_key:
263
278
  specification_version: 4
264
279
  summary: A simple toolkit for working with XML.
265
280
  test_files: []
data/.gitlab-ci.yml DELETED
@@ -1,15 +0,0 @@
1
- image: ruby:2.2
2
-
3
- before_script:
4
- - apt-get update && apt-get install -y locales
5
- - echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
6
- - locale-gen
7
- - export LC_ALL=en_US.UTF-8
8
-
9
- rspec:
10
- script:
11
- - bin/cibuild
12
-
13
- lint:
14
- script:
15
- - bin/lint
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.2.10
5
- - 2.3.8
6
- - 2.4.6
7
- - 2.5.5
8
- - 2.6.2
9
- script:
10
- - bin/cibuild
11
- - bin/lint
data/bin/cibuild DELETED
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
-
3
- # script/cibuild: Setup environment for CI to run tests. This is primarily
4
- # designed to run on the continuous integration server.
5
-
6
- set -e
7
-
8
- cd "$(dirname "$0")/.."
9
-
10
- echo [$(date "+%H:%M:%S")] "==> Started at…"
11
-
12
- # GC customizations
13
- export RUBY_GC_MALLOC_LIMIT=79000000
14
- export RUBY_GC_HEAP_INIT_SLOTS=800000
15
- export RUBY_HEAP_FREE_MIN=100000
16
- export RUBY_HEAP_SLOTS_INCREMENT=400000
17
- export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
18
-
19
- ruby -v
20
- gem install bundler --conservative
21
- bin/test
data/bin/lint DELETED
@@ -1,11 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -e
4
-
5
- [ -z "$DEBUG" ] || set -x
6
-
7
- echo [$(date "+%H:%M:%S")] "==> Running setup…"
8
- bin/setup
9
-
10
- echo [$(date "+%H:%M:%S")] "==> Running linters…"
11
- bundle exec rake lint