vcr-archive 0.3.0.pre → 0.3.0

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: 5228f750fa913d827a1bd296a0a4f6cc90d79609
4
- data.tar.gz: dc82326c218702636850f6f5e034a94be9e8c199
3
+ metadata.gz: b882de9340b0381df68e663ad393932ccd1a2302
4
+ data.tar.gz: 1dea9347f9d2edb6bf1879ffaf8e04298c9578ea
5
5
  SHA512:
6
- metadata.gz: 0fd3b2e7b7d8f3819a9e4831dec43e5fb6f79be3a1b8d2a0990f0016f5ec5caaff6f941b041c2cf5585f4096d2c1af303df6df866e08779f1a9129d884abaaa9
7
- data.tar.gz: a07c32c19df1ac6f150b274c67cb7f3a36f4a46354b3c375a95ef2e383900c5f64bc2383cf383afe4debe544c7de57f5d0afb679b5aac63dadd5eebda7efc285
6
+ metadata.gz: 65933962f77e30dd11e9d0550de766c6847972a134a148c24d4b3dc103ef30f553440a07d16f3abb20fd7947c0a21000b842091d26a6ba8e1807c1a746607d7d
7
+ data.tar.gz: 16f76007295afd6d343d1f9545279e55e05f712b639383fcd457666e8815d97527262c5b4170348eed660f250689dda8fb97e86c902323d9f4aeef3797332539
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.3.0] - 2016-07-28
9
+
10
+ - VCR cassette format is now handled by [vcr-archive](https://github.com/everypolitician/vcr-archive), leaving this gem to handle wrapping VCR and saving to git.
11
+ - Git interactions are now done with [ruby-git](https://github.com/schacon/ruby-git) rather than shelling out where possible.
12
+
13
+ ## [0.2.0] - 2016-07-27
14
+
15
+ - Working version of persisting using VCR.
16
+
17
+ ## 0.1.0 - 2016-07-27
18
+
19
+ - Initial release
20
+
21
+ [Unreleased]: https://github.com/everypolitician/vcr-archive/compare/v0.3.0
22
+ [0.3.0]: https://github.com/everypolitician/vcr-archive/compare/v0.2.0...v0.3.0
23
+ [0.2.0]: https://github.com/everypolitician/vcr-archive/compare/v0.1.0...v0.2.0
data/README.md CHANGED
@@ -22,8 +22,18 @@ Or install it yourself as:
22
22
 
23
23
  ```ruby
24
24
  require 'vcr/archive'
25
+ require 'open-uri'
25
26
 
26
- VCR.use_cassette('https://github.com/everypolitician/vcr-archive') do
27
+ VCR.configure do |config|
28
+ config.hook_into :webmock
29
+ config.cassette_serializers[:vcr_archive] = VCR::Archive::Serializer
30
+ config.cassette_persisters[:vcr_archive] = VCR::Archive::Persister
31
+ config.default_cassette_options = { serialize_with: :vcr_archive, persist_with: :vcr_archive }
32
+ end
33
+
34
+ VCR::Archive::Persister.storage_location = '/tmp'
35
+
36
+ VCR.use_cassette('vcr_cassettes/readme_example') do
27
37
  response = open('http://example.org/').read
28
38
  # ...
29
39
  end
data/lib/vcr/archive.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'vcr'
1
2
  require 'yaml'
2
3
 
3
4
  require 'vcr/archive/version'
@@ -49,12 +50,12 @@ module VCR
49
50
  path = absolute_path_to_file(file_name)
50
51
  meta['http_interactions'].each do |interaction|
51
52
  uri = URI.parse(interaction['request']['uri'])
52
- path = File.join(path, uri.host, Digest::SHA1.hexdigest(uri.to_s))
53
- directory = File.dirname(path)
53
+ file_path = File.join(path, uri.host, Digest::SHA1.hexdigest(uri.to_s))
54
+ directory = File.dirname(file_path)
54
55
  FileUtils.mkdir_p(directory) unless File.exist?(directory)
55
56
  body = interaction['response']['body'].delete('string')
56
- File.binwrite("#{path}.yml", YAML.dump(interaction))
57
- File.binwrite("#{path}.html", body)
57
+ File.binwrite("#{file_path}.yml", YAML.dump(interaction))
58
+ File.binwrite("#{file_path}.html", body)
58
59
  end
59
60
  end
60
61
 
@@ -1,5 +1,5 @@
1
1
  module VCR
2
2
  module Archive
3
- VERSION = '0.3.0.pre'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcr-archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.pre
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Mytton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-27 00:00:00.000000000 Z
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vcr
@@ -117,6 +117,7 @@ extra_rdoc_files: []
117
117
  files:
118
118
  - ".gitignore"
119
119
  - ".travis.yml"
120
+ - CHANGELOG.md
120
121
  - Gemfile
121
122
  - LICENSE.txt
122
123
  - README.md
@@ -141,9 +142,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
142
  version: '0'
142
143
  required_rubygems_version: !ruby/object:Gem::Requirement
143
144
  requirements:
144
- - - ">"
145
+ - - ">="
145
146
  - !ruby/object:Gem::Version
146
- version: 1.3.1
147
+ version: '0'
147
148
  requirements: []
148
149
  rubyforge_project:
149
150
  rubygems_version: 2.5.1