infrataster-plugin-ssl_certificates 0.0.1 → 0.0.2

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: 2be075f13659eafd7c7edbedc8e382f9a74c7a6d
4
- data.tar.gz: 5d69801417ad3a7744bab1fa90028203de8955d2
3
+ metadata.gz: c54c408b03ae09f17897c08837ecbe3c2d3e868b
4
+ data.tar.gz: c253e6afefd7eb1c0da7770151336c111385d4b5
5
5
  SHA512:
6
- metadata.gz: 7b8607911436b76081d821f71605cad7d782cf231956deae810f24d0a2f363a22a0b7132e4f8c709a0a4f34d06a79c91bfff5c3a04250889a641fbef2746915b
7
- data.tar.gz: 9abba59b9b5b75faedd189b4c2b70a50480d11f3c982eb9036a176cb2cadc91371ec57697d6796c1c7f6f360ad11d05305678860bc171d7d08fb8a5d96b3b6af
6
+ metadata.gz: ff42d838d71ef9657bb5ca0aac0d9716772dd0e105f0ead429c6a7c58f464a1c78a3aadf35d488275ee87a25bd7805084e011c9ae57114ba033becddce6156c9
7
+ data.tar.gz: 2eaec23058323c3dc329581a345832241a7e9d471068e0102ea022bffd6b112852acd89cde10cf587c8b97c737d93461c2041ab72b1383ae73467a2de82cc9af
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Infrataster::Plugin::SslCertificates
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/infrataster-plugin-ssl_certificates.svg)](http://badge.fury.io/rb/infrataster-plugin-ssl_certificates)
4
+
3
5
  Check SSL certificates plugin for [infrataster](https://github.com/ryotarai/infrataster)
4
6
 
5
7
  ## Installation
@@ -23,13 +25,23 @@ require 'infrataster-plugin-ssl_certificates'
23
25
  reuqire 'spec_helper'
24
26
 
25
27
  describe server(:app) do
26
- describe domain('https://www.example.com') do
28
+ describe domain('example.com') do
27
29
  it { expect(certificate.serial).to eq(1234567) }
28
30
  it { expect(certificate.not_after.to_s).to eq("2015-12-31 18:00:00 UTC") }
29
31
  end
30
32
  end
31
33
  ```
32
34
 
35
+ You can specify port number by options passed to Infrataster::Server.define in spec_helper.rb:
36
+
37
+ ```ruby
38
+ Infrataster::Server.define(
39
+ :app,
40
+ '192.168.33.10',
41
+ ssl: { port: 8443 }
42
+ )
43
+ ```
44
+
33
45
  ## Contributing
34
46
 
35
47
  1. Fork it ( https://github.com/[my-github-username]/infrataster-plugin-ssl_certificates/fork )
@@ -5,7 +5,13 @@ module Infrataster
5
5
  module Contexts
6
6
  class SslCertificatesContext < BaseContext
7
7
  def certificate
8
- https = Net::HTTP.new(resource.url.host, resource.url.port)
8
+ options = { port: 443 }
9
+
10
+ if server.options[:ssl]
11
+ options = options.merge(server.options[:ssl])
12
+ end
13
+
14
+ https = Net::HTTP.new(resource.domain, options[:port])
9
15
  https.use_ssl = true
10
16
  https.verify_mode = OpenSSL::SSL::VERIFY_PEER
11
17
  https.start do
@@ -5,14 +5,15 @@ module Infrataster
5
5
  class SslCertificatesResource < BaseResource
6
6
  Error = Class.new(StandardError)
7
7
 
8
- attr_reader :url
8
+ attr_reader :domain, :options
9
9
 
10
- def initialize(url)
11
- @url = URI.parse(url)
10
+ def initialize(domain, options = {})
11
+ @domain = domain
12
+ @options = options
12
13
  end
13
14
 
14
15
  def to_s
15
- "SSL Certification: #{@url}"
16
+ "SSL Certification: #{@domain}"
16
17
  end
17
18
  end
18
19
  end
@@ -1,7 +1,7 @@
1
1
  module Infrataster
2
2
  module Plugin
3
3
  module SslCertificates
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,8 @@
1
+ require 'infrataster/rspec'
2
+ require 'infrataster-plugin-ssl_certificates'
3
+
4
+ Infrataster::Server.define(
5
+ :web,
6
+ '127.0.0.1',
7
+ ssl: { port: 443 }
8
+ )
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe server(:web) do
4
+ describe domain('example.com') do
5
+ it { expect(certificate.not_after.to_s).to eq('2015-11-13 12:00:00 UTC') }
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infrataster-plugin-ssl_certificates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuma Muramatsu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-11 00:00:00.000000000 Z
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: infrataster
@@ -84,6 +84,8 @@ files:
84
84
  - lib/infrataster/helpers/ssl_certificates_resource_helper.rb
85
85
  - lib/infrataster/resources/ssl_certificates_resource.rb
86
86
  - lib/infrataster_plugin_ssl_certificates/version.rb
87
+ - spec/spec_helper.rb
88
+ - spec/ssl_certificates_spec.rb
87
89
  homepage: ''
88
90
  licenses:
89
91
  - MIT
@@ -104,8 +106,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
106
  version: '0'
105
107
  requirements: []
106
108
  rubyforge_project:
107
- rubygems_version: 2.4.5
109
+ rubygems_version: 2.2.2
108
110
  signing_key:
109
111
  specification_version: 4
110
112
  summary: Check SSL certificates plugin for infrataster
111
- test_files: []
113
+ test_files:
114
+ - spec/spec_helper.rb
115
+ - spec/ssl_certificates_spec.rb