openstax_kitchen 6.1.0 → 7.0.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: 68b22024e79d8b530195dafc0dba4b939f7c5503023ae1fbc1ee876a038595d9
4
- data.tar.gz: 4a35e7fdbae28ecadd234c1aff6596ef61ec4aaffd4adf2a29bc401ed54b7576
3
+ metadata.gz: 43191e77a90ff1979ef567be7b5ab17d0eeac503ead1294d8d329e18d6740c75
4
+ data.tar.gz: ae55a2aa093d942166c41502c2019b327ccaf4eab1fd383773acd94827122524
5
5
  SHA512:
6
- metadata.gz: 34d9856998c75fee77bc41b734399ffc3045a93082cba273b636b10411b852ee71f4e9bda86a38108e9293f53136194d3c85cb12ea5c92159d571c64d2b85044
7
- data.tar.gz: d29fd215321a1ab877c16083b73bb0b872ee67c68a636425e6ef5ded5d8fd9ff7ae77599ec1d9a500e69ad627f175ac7c5fb1194310b8e0979d0cc7160403b55
6
+ metadata.gz: 6bcc9edf90d94f61582668e6bae0c39a42dd6d4535f944d7566eb4d17cd85ed1e5712b9e51b6ed5cf71d5928d90b211c26ac6134a356246a41ea379c4a3af73b
7
+ data.tar.gz: ea31d5248fec4947d06d53f2555c71ff36274c9a174976b6751dd9894a41eb949601e77c2116227374573cbdf823e9c7fc94142ce9d3341d9159d8d7d03074a2
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+
10
+ ## [7.0.0] - 2021-06-21
11
+
12
+ * Changed selector expected by `default strategy` in `move_solutions_to_answer_key` to optimize search (major)
13
+ * Fix Rubocop GitHub Action's regular expression used to select files to lint (patch)
14
+ * Added monkey patch for array to be able to add a prefix: `%w[multiple-choice true-false].prefix('section.')` (minor)
15
+
9
16
  ## [6.1.0] - 2021-06-21
10
17
 
11
18
  * Create a `BakeReferences` V2 for unnumbered section references (minor)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openstax_kitchen (6.1.0)
4
+ openstax_kitchen (7.0.0)
5
5
  activesupport
6
6
  i18n
7
7
  nokogiri
data/docker/rubocop CHANGED
@@ -4,13 +4,15 @@
4
4
 
5
5
  DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
6
6
 
7
- from="${1:-main}"
8
- to="${2:-HEAD}"
7
+ commit_range="${1:-main}"
8
+ if [ ! -z "$2" ]; then
9
+ commit_range="$commit_range..$2"
10
+ fi
9
11
 
10
- echo "Checking from $from to $to"
12
+ echo "Checking $commit_range"
11
13
 
12
14
  # https://dev.to/scienta/get-changed-files-in-github-actions-1p36
13
- changed_ruby_files=$(git diff --name-only --diff-filter=ACMRT $from $to | grep -E "(lib\/|spec\/)*.rb$" | xargs)
15
+ changed_ruby_files=$(git diff --name-only --diff-filter=ACMRT $commit_range | grep -E "(lib\/|spec\/).*\.rb$" | xargs)
14
16
 
15
17
  if [[ -z "${changed_ruby_files// }" ]]; then
16
18
  echo "No files to lint with Rubocop"
@@ -10,8 +10,8 @@ module Kitchen::Directions::MoveSolutionsToAnswerKey
10
10
  protected
11
11
 
12
12
  def bake_section(chapter:, append_to:)
13
- @classes.each do |klass|
14
- chapter.search(".#{klass} [data-type='solution']").each do |solution|
13
+ @selectors.each do |selector|
14
+ chapter.search("#{selector} div[data-type='solution']").each do |solution|
15
15
  append_to.add_child(solution.cut.to_s)
16
16
  end
17
17
  end
@@ -20,7 +20,7 @@ module Kitchen::Directions::MoveSolutionsToAnswerKey
20
20
  # This method helps to obtain more strategy-specific params through
21
21
  # "strategy_options: {blah1: 1, blah2: 2}"
22
22
  def initialize(strategy_options)
23
- @classes = strategy_options[:classes] || (raise 'missing classes for strategy')
23
+ @selectors = strategy_options[:selectors] || (raise 'missing selectors for strategy')
24
24
  end
25
25
  end
26
26
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Monkey patches for +Array+
4
+ #
5
+ class Array
6
+
7
+ # Receives a string to add as prefix in each item and returns
8
+ # a new array with the concatenaded strings
9
+ #
10
+ # @return [Array<String>]
11
+ #
12
+ def prefix(string)
13
+ map { |item| "#{string}#{item}" }
14
+ end
15
+ end
@@ -3,5 +3,5 @@
3
3
  # A library for modifying the structure of OpenStax book XML.
4
4
  #
5
5
  module Kitchen
6
- VERSION = '6.1.0'
6
+ VERSION = '7.0.0'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
@@ -349,6 +349,7 @@ files:
349
349
  - lib/kitchen/page_element.rb
350
350
  - lib/kitchen/page_element_enumerator.rb
351
351
  - lib/kitchen/pantry.rb
352
+ - lib/kitchen/patches/array.rb
352
353
  - lib/kitchen/patches/i18n.rb
353
354
  - lib/kitchen/patches/integer.rb
354
355
  - lib/kitchen/patches/nokogiri.rb