bergamasco 0.2.8 → 0.2.9

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: 2408331adbbd94d3263b46bc845e4ee28b9d25e7
4
- data.tar.gz: 31ef99f8504917494f39e7855cba98789bede309
3
+ metadata.gz: 019430c76e307359d0bdfa7e2e1f4bb6b765899b
4
+ data.tar.gz: 242da0ac868471fbfa51f9c8ddb77d55d7581836
5
5
  SHA512:
6
- metadata.gz: 07ed905d2d57fb0d3c5fb86f832346e4ceb9c594b77ca86c0522b6320643babc0a00352bb3c2d54da3fdc108300976626614836f3f074c9de3366ba570d37c42
7
- data.tar.gz: 2bdfda5983ab9ab33f365d9fe1c1fb8dd2b503aaa5a22a7a210b88df4e9290f75cf125d3be67210f0dd8b5f99e464b8a514bc8d895fe99001d324a6123a0cbab
6
+ metadata.gz: feeff06a54ade78d2bd83ea8cda527e424b960307987c86c13598098dfb0271f4497e46d41980799d87b03bd1e15c25312cc3e43d5a431d3e857a7c66f3206c2
7
+ data.tar.gz: 14132388259869c8befb75255da89f3daaba00792205057feb9a826c804da94d8aee98f723c593132294f2d931fead7aca6b33aa4fefc29037e50a6ad4855500
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bergamasco (0.2.8)
4
+ bergamasco (0.2.9)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  addressable (~> 2.3.8)
7
7
  builder (~> 3.2, >= 3.2.2)
@@ -19,10 +19,13 @@ module Bergamasco
19
19
  metadata.to_yaml + "---\n" + content
20
20
  end
21
21
 
22
- def self.update_file(file, new_metadata)
22
+ def self.update_file(filepath, new_metadata)
23
+ file = IO.read(filepath)
23
24
  metadata, content = split_yaml_frontmatter(file)
24
25
  metadata = update_yaml_frontmatter(metadata, new_metadata)
25
- join_yaml_frontmatter(metadata, content)
26
+ new_file = join_yaml_frontmatter(metadata, content)
27
+ IO.write(filepath, new_file)
28
+ new_file
26
29
  end
27
30
 
28
31
  def self.read_yaml(filepath)
@@ -1,3 +1,3 @@
1
1
  module Bergamasco
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -7,6 +7,7 @@ tags:
7
7
  - doi
8
8
  - featured
9
9
  image: https://blog.datacite.org/images/2016/12/cool-dois.png
10
+ doi: 10.23725/0000-03VC
10
11
  ---
11
12
  In 1998 Tim Berners-Lee coined the term cool URIs [-@https://www.w3.org/Provider/Style/URI], that is URIs that don’t change. We know that URLs referenced in the scholarly literature are often not cool, leading to link rot [@https://doi.org/10.1371/journal.pone.0115253] and making it hard or impossible to find the referenced resource.READMORE
12
13
 
@@ -73,10 +73,9 @@ describe Bergamasco::Markdown do
73
73
 
74
74
  it 'should update file' do
75
75
  filepath = fixture_path + 'cool-dois.html.md'
76
- file = IO.read(filepath)
77
76
  new_metadata = { "doi" => "10.23725/0000-03VC"}
78
- updated_file = subject.update_file(file, new_metadata)
79
- expect(updated_file).to include("\ndoi: 10.23725/0000-03VC\n")
77
+ file = subject.update_file(filepath, new_metadata)
78
+ expect(file).to include("\ndoi: 10.23725/0000-03VC\n")
80
79
  end
81
80
 
82
81
  it 'should convert markdown' do
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.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner