houdini/lib/tasks/bundler_notice.rake
2020-02-29 20:47:20 -06:00

22 lines
No EOL
745 B
Ruby

# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
desc "generating a notice for bundler"
# Clear old activerecord sessions tables daily
task :bundler_notice => :environment do
require 'bundler'
require 'httparty'
parser = Bundler::LockfileParser.new(File.read(Rails.root.join("Gemfile.lock")))
result = parser.specs.map do |spec|
"gem/rubygems/-/#{spec.name}/#{spec.version.to_s}"
end
@options = {
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
}
result = HTTParty.post("https://api.clearlydefined.io/notices", @options.merge(body:JSON::generate({coordinates: result})))
byebug
end