Skip to content

Commit

Permalink
Merge pull request #172 from sul-dlss/apply-vcr-sanitize
Browse files Browse the repository at this point in the history
Apply vcr sanitize
  • Loading branch information
mejackreed committed Mar 31, 2016
2 parents e9a04a0 + 144e989 commit 39fc599
Show file tree
Hide file tree
Showing 48 changed files with 114 additions and 91 deletions.
25 changes: 24 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

task default: [:ci, :rubocop]
task default: [:rubocop, :ci, 'vcr:sanitize']

# If the config/database.yml file does not exist, use the example file
# so that the config/application can load.
Expand Down Expand Up @@ -41,3 +41,26 @@ task :rubocop_patch do
system "git diff --name-only HEAD..master | grep -E -i 'rake|*.rb|*.erb' | xargs bundle exec rubocop"
end
end

namespace :vcr do
desc 'List all VCR cassettes'
task :cassettes do
Dir.glob("fixtures/vcr_cassettes/**/*.yml") { |f| puts f }
end

desc 'Remove private credentials from VCR cassettes'
task :sanitize do
public_license = 'some-license-id'
config_license = ConfigSettings.SCIENCEWIRE.LICENSE_ID
if config_license != public_license
puts "VCR SANITIZE: sanitizing a private license in the vcr cassettes"
Dir.glob("fixtures/vcr_cassettes/**/*.yml") do |file_name|
text = File.read(file_name)
if text.include? config_license
File.write(file_name, text.gsub(config_license, public_license))
puts "VCR SANITIZE: #{file_name}"
end
end
end
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 39fc599

Please sign in to comment.