localhost 1.4.2 → 1.5.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
  SHA256:
3
- metadata.gz: 2c43cbd483ba75df04398b4a6e534ec13a4456faa6b373ee1629a6673e6bd133
4
- data.tar.gz: 53e8080f450ce450e76d4085427fc41c9cd56eced5965672c1766798ebfd709d
3
+ metadata.gz: cb2af90326b97a7ed35c40f67354cd551fc7f7087b3988752be1ce84346b5d33
4
+ data.tar.gz: 7d3e6cfe20a573d193ab7d54128af846481287423f058705ec1c7e7267d2093d
5
5
  SHA512:
6
- metadata.gz: 3869a071d7ee5bd45c5e2ea41edd7a164dba4b4aca54ea46b2618b90ffaeb354761b89c1c3398fc0f39917b2342c63648dbd99e320e49d3ce0f94473e7b90ec0
7
- data.tar.gz: 823506611fb8b34a2152eeeee30a641e5027333973c7ed2fcde5ef0ada9c60650196101c10b4aa05d8a6a1e296fce2fae770fd1857308c106e516eb1d57f0702
6
+ metadata.gz: 8c6c85bff1973b4637c03031a73f4f0a77974eb7f9def2db89b7213586ff051f2c3d4d214732a052d6334f6253b9c54282427bf99c321d3a8c125f02bae07493
7
+ data.tar.gz: e35941e8efbae8f94b00f2738b7425cfbc4046dca06971c9a970747146e5eef22de7e17e41a185cd15cae9f44f602e5dccee705d01da19508292511f872d1d1b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -29,12 +29,15 @@ module Localhost
29
29
  return issuer
30
30
  end
31
31
 
32
+ # The default certificate issuer name.
33
+ NAME = "development"
34
+
32
35
  # Initialize the issuer with the given name.
33
36
  #
34
37
  # @parameter name [String] The common name to use for the certificate.
35
38
  # @parameter path [String] The path path for loading and saving the certificate.
36
- def initialize(name = "development", path: State.path)
37
- @name = name
39
+ def initialize(name = nil, path: State.path)
40
+ @name = name || NAME
38
41
  @path = path
39
42
 
40
43
  @subject = nil
@@ -5,10 +5,14 @@
5
5
 
6
6
  module Localhost
7
7
  module System
8
+ # Darwin specific system operations.
8
9
  module Darwin
10
+ # Install a certificate into the system trust store.
11
+ #
12
+ # @parameter certificate [String] The path to the certificate file.
9
13
  def self.install(certificate)
10
14
  login_keychain = File.expand_path("~/Library/Keychains/login.keychain-db")
11
-
15
+
12
16
  system(
13
17
  "security", "add-trusted-cert",
14
18
  "-d", "-r", "trustRoot",
@@ -3,11 +3,13 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2025, by Samuel Williams.
5
5
 
6
- require "etc"
7
-
8
6
  module Localhost
9
7
  module System
10
- module Darwin
8
+ # Linux specific system operations.
9
+ module Linux
10
+ # Install a certificate into the system trust store.
11
+ #
12
+ # @parameter certificate [String] The path to the certificate file.
11
13
  def self.install(certificate)
12
14
  filename = File.basename(certificate)
13
15
  destination = "/usr/local/share/ca-certificates/localhost-#{filename}"
@@ -4,14 +4,16 @@
4
4
  # Copyright, 2025, by Samuel Williams.
5
5
 
6
6
  module Localhost
7
+ # @namespace
7
8
  module System
9
+ # @return [Class] The best system class for the current platform.
8
10
  def self.current
9
11
  case RUBY_PLATFORM
10
12
  when /darwin/
11
- require 'localhost/system/darwin'
13
+ require "localhost/system/darwin"
12
14
  Darwin
13
15
  when /linux/
14
- require 'localhost/system/linux'
16
+ require "localhost/system/linux"
15
17
  Linux
16
18
  else
17
19
  raise NotImplementedError, "Unsupported platform: #{RUBY_PLATFORM}"
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
6
  module Localhost
7
- VERSION = "1.4.2"
7
+ VERSION = "1.5.0"
8
8
  end
data/readme.md CHANGED
@@ -16,8 +16,6 @@ Please see the [project documentation](https://socketry.github.io/localhost/) fo
16
16
 
17
17
  - [Getting Started](https://socketry.github.io/localhost/guides/getting-started/index) - This guide explains how to use `localhost` for provisioning local TLS certificates for development.
18
18
 
19
- - [Browser Configuration](https://socketry.github.io/localhost/guides/browser-configuration/index) - This guide explains how to configure your local browser in order to avoid warnings about insecure self-signed certificates.
20
-
21
19
  - [Example Server](https://socketry.github.io/localhost/guides/example-server/index) - This guide demonstrates how to use <code class="language-ruby">Localhost::Authority</code> to implement a simple HTTPS client & server.
22
20
 
23
21
  ## Releases
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localhost
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -46,7 +46,7 @@ cert_chain:
46
46
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
47
47
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
48
48
  -----END CERTIFICATE-----
49
- date: 2025-03-25 00:00:00.000000000 Z
49
+ date: 2025-04-12 00:00:00.000000000 Z
50
50
  dependencies: []
51
51
  executables: []
52
52
  extensions: []
metadata.gz.sig CHANGED
Binary file