bergamasco 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1397e1d71f822e2ba31fb055cae298505fe60d92
4
- data.tar.gz: 1928b970eed69989858bf680b6290151ec42539d
3
+ metadata.gz: 62901afff36fd4f178b9cf83af26ca098b624bfc
4
+ data.tar.gz: 259429f324394efe47680033ff33068427171b4b
5
5
  SHA512:
6
- metadata.gz: 2604ab9dcd36d6e2670ec41392fe27aa308252a93ddaaad7faed930591dd5be15c4e52dd6a156f826a78846f6aed24a93dcdb56b301ab94a227cdb01e4396b91
7
- data.tar.gz: 677df10181be5b8a3b47fc4a78c2d5f768640c7339b7d52f6696d692b51bc37fefecf5c81c6b8ce9f0142f3c413d8c3702bdee12014a6620e29cddd367459d04
6
+ metadata.gz: e230e0cd85143096d69b4fce20b7fbbf87b37fc48dd69c455113eb6e1d6207ddcf87884ffc3ee17774b0cd442bec61bbb4b7011e2d037df445ba902b6fa05eee
7
+ data.tar.gz: 88d56f662c43c51f48617729f7542b93dd3e3f60d80b7388748cd30809ed0ddc09ceebbb3b82b126375e616a36e4680e0091e1f7c6ca2e45a85017aea2e5e792
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bergamasco (0.1.1)
4
+ bergamasco (0.1.2)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  builder (~> 3.2, >= 3.2.2)
7
7
  commonmarker (~> 0.14.0)
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/bergamasco.svg)](https://badge.fury.io/rb/bergamasco)
4
4
  [![Build Status](https://travis-ci.org/datacite/bergamasco.svg?branch=master)](https://travis-ci.org/datacite/bergamasco)
5
- [![Test Coverage](https://codeclimate.com/github/datacite/bergamasco/badges/coverage.svg)](https://codeclimate.com/github/datacite/bergamasco/coverage)
6
- [![Code Climate](https://codeclimate.com/github/datacite/bergamasco/badges/gpa.svg)](https://codeclimate.com/github/datacite/bergamasco)
7
5
 
8
6
  Text utilities for common cleanup and reformatting tasks when working with scholarly metadata.
9
7
 
@@ -23,6 +23,15 @@ module Bergamasco
23
23
  join_yaml_frontmatter(metadata, content)
24
24
  end
25
25
 
26
+ def self.read_yaml(filepath)
27
+ file = IO.read(filepath)
28
+ SafeYAML.load(file)
29
+ end
30
+
31
+ def self.write_yaml(filepath, content)
32
+ IO.write(filepath, content.to_yaml)
33
+ end
34
+
26
35
  def self.render_html(text, options={})
27
36
  text = split_yaml_frontmatter(text).last if options[:skip_yaml_header]
28
37
 
@@ -1,3 +1,3 @@
1
1
  module Bergamasco
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,3 +1,4 @@
1
+ ---
1
2
  layout: post
2
3
  title: Cool DOI's
3
4
  author: mfenner
@@ -37,6 +37,20 @@ describe Bergamasco::Markdown do
37
37
  expect(updated_file).to eq(file)
38
38
  end
39
39
 
40
+ it 'should read yaml' do
41
+ filepath = fixture_path + 'cool-dois.yml'
42
+ metadata = subject.read_yaml(filepath)
43
+ expect(metadata["title"]).to eq("Cool DOI's")
44
+ end
45
+
46
+ it 'should write yaml' do
47
+ filepath = fixture_path + 'cool-dois.yml'
48
+ text = IO.read(filepath)
49
+ metadata = subject.read_yaml(filepath)
50
+ length = subject.write_yaml(filepath, metadata)
51
+ expect(length).to eq(text.length)
52
+ end
53
+
40
54
  it 'should update file' do
41
55
  filepath = fixture_path + 'cool-dois.html.md'
42
56
  file = IO.read(filepath)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bergamasco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner