Skip to content

Commit

Permalink
Merge pull request #61 from minicomp/v1.1.2
Browse files Browse the repository at this point in the history
V1.1.2
  • Loading branch information
mnyrop authored Sep 12, 2020
2 parents 2b18d1f + ec584f7 commit ccedb70
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Gemfile.lock
coverage
test_build
docs
doc
.yardoc
DIANE
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
AllCops:
NewCops: enable
TargetRubyVersion: 2.4
Exclude: ['spec/**/*', 'test_build/**/*']
Layout/LineLength:
IgnoredPatterns: ['raise', 'puts', 'set', 'warn', 'ÈÉÊË', 'EEEE', 'safe_join', 'spec']
Metrics/AbcSize:
Max: 26
Max: 28
Metrics/MethodLength:
Max: 15
Layout/EmptyComment:
Enabled: false
Layout/EmptyLineAfterGuardClause:
Enabled: false
Style/SingleArgumentDig:
Enabled: false
1 change: 0 additions & 1 deletion .yardopts

This file was deleted.

74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [https://contributor-covenant.org/version/1/4][version]

[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/
1 change: 1 addition & 0 deletions lib/wax_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
require_relative 'wax_tasks/record'
require_relative 'wax_tasks/site'
require_relative 'wax_tasks/utils'
require_relative 'wax_tasks/version'

#
module WaxTasks
Expand Down
2 changes: 0 additions & 2 deletions lib/wax_tasks/asset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module WaxTasks
class Asset
attr_reader :id, :path



def initialize(path, pid, variants)
@path = path
@pid = pid
Expand Down
19 changes: 9 additions & 10 deletions lib/wax_tasks/collection/images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ def items_from_imagedata
records = records_from_metadata
Dir.glob(Utils.safe_join(@imagedata_source, '*')).map do |path|
item = WaxTasks::Item.new(path, @image_variants)
if item.valid?
item.record = records.find { |r| r.pid == item.pid }
item.iiif_config = @config.dig 'images', 'iiif'
warn Rainbow("\nCould not find record in #{@metadata_source} for image item #{path}.\n").orange if item.record.nil?
item
else
puts Rainbow("Skipping #{path} because type #{item.type} is not an accepted format").yellow unless item.type == '.pdf'
end
next if item.type == '.pdf'
next puts Rainbow("Skipping #{path} because type #{item.type} is not an accepted format").yellow unless item.valid?

item.record = records.find { |r| r.pid == item.pid }
item.iiif_config = @config.dig 'images', 'iiif'
warn Rainbow("\nCould not find record in #{@metadata_source} for image item #{path}.\n").orange if item.record.nil?
item
end.compact
end

Expand Down Expand Up @@ -97,8 +96,8 @@ def add_iiif_results_to_records(records, manifests)

json = JSON.parse manifest.to_json
@image_variants.each do |k, _v|
value = json.dig k
record.set k, "/#{Utils.content_clean(value)}" unless value.nil?
value = json.fetch k, ''
record.set k, "/#{Utils.content_clean(value)}" unless value.empty?
end

record.set 'manifest', "/#{Utils.content_clean(manifest.id)}"
Expand Down
2 changes: 1 addition & 1 deletion lib/wax_tasks/collection/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def consolidate_records(original, new)
lost_record_pids.each do |pid|
new << original.find { |r| r.pid == pid }
end
new
new.sort_by(&:order)
end

#
Expand Down
2 changes: 1 addition & 1 deletion lib/wax_tasks/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def type
#
#
def valid?
accepted_image_formats.include?(@type) || @type == 'dir'
accepted_image_formats.include? @type or @type == 'dir'
end

#
Expand Down
4 changes: 2 additions & 2 deletions lib/wax_tasks/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def self.content_clean(str)
str.gsub!(/\A---(.|\n)*?---/, '') # remove yaml front matter
str.gsub!(/{%(.*)%}/, '') # remove functional liquid
str.gsub!(/{{.*}}/, '') # remove referential liquid
str.gsub!(%r{<\/?[^>]*>}, '') # remove html
str.gsub!(%r{</?[^>]*>}, '') # remove html
str.gsub!('\\n', '') # remove newlines
str.gsub!(/\s+/, ' ') # remove extra space
str.tr!('"', "'") # replace double quotes with single
Expand All @@ -114,7 +114,7 @@ def self.slug(str)
#
#
def self.safe_join(*args)
File.join(args.compact).sub %r{^\/}, ''
File.join(args.compact).sub %r{^/}, ''
end

# Constructs the order variable for each page (if the collection
Expand Down
5 changes: 5 additions & 0 deletions lib/wax_tasks/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module WaxTasks
VERSION = '1.1.2'
end
10 changes: 6 additions & 4 deletions wax_tasks.gemspec
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# frozen_string_literal: true

$LOAD_PATH.push File.expand_path('../lib')
require_relative 'lib/wax_tasks/version'

Gem::Specification.new do |spec|
spec.name = 'wax_tasks'
spec.version = '1.1.1'
spec.version = WaxTasks::VERSION
spec.authors = ['Marii Nyrop']
spec.email = ['[email protected]']
spec.license = 'MIT'
spec.homepage = 'https://github.com/minicomp/wax_tasks'
spec.summary = 'Rake tasks for minimal exhibition sites with Minicomp/Wax.'
spec.description = 'Rake tasks for minimal exhibition sites with Minicomp/Wax.'

spec.files = Dir['Gemfile', 'lib/**/*']
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end

spec.test_files = Dir['spec/*']
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.4'
spec.metadata['yard.run'] = 'yri'

Expand Down

0 comments on commit ccedb70

Please sign in to comment.