Skip to content

Commit 468a463

Browse files
committed
add rake task for updating version
1 parent f4bca72 commit 468a463

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

Rakefile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
require "bundler/gem_tasks"
2-
require "net/http"
3-
4-
PEM_PATH = File.expand_path(File.join(__FILE__, "../lib/certifi/vendor/cacert.pem"))
5-
MKCERT_URL = "https://mkcert.org/generate/"
1+
lib = File.expand_path('../lib', __FILE__)
2+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3+
require 'certifi'
4+
require 'bundler/gem_tasks'
5+
require 'net/http'
66

77
begin
88
require 'rspec/core/rake_task'
@@ -17,8 +17,16 @@ rescue LoadError => e
1717
# rspec won't exist on production
1818
end
1919

20-
task :update do
21-
File.open(PEM_PATH, "w") do |f|
22-
f.write(Net::HTTP.get(URI.parse(MKCERT_URL)))
20+
task :update => [:update_pem, :update_version]
21+
22+
task :update_pem do
23+
File.open(Certifi.where, 'w') do |f|
24+
f.write(Net::HTTP.get(URI.parse('https://mkcert.org/generate/')))
25+
end
26+
end
27+
28+
task :update_version do
29+
File.open(Certifi::VERSION_PATH, 'w') do |f|
30+
f.write(Time.now.strftime('%Y-%m-%d'))
2331
end
2432
end

lib/certifi/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2018-08-23

lib/certifi/version.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module Certifi
2-
VERSION = "2018.01.18"
2+
VERSION_PATH = File.expand_path(File.join(File.dirname(__FILE__), "VERSION"))
3+
VERSION = File.read(VERSION_PATH)
34
end

0 commit comments

Comments
 (0)