Comparing changes

v1.0.10 v1.0.11
7 commits 5 files changed

Commits

708341c fix rubocop violations. mo 2018-02-27 04:48:03
50b96fb add ruby-prof. mo 2018-02-27 04:34:27
fa39468 cache template_path. mo 2018-02-27 04:07:30
a56de3c cache template_path. mo 2018-02-27 04:01:24
4da2824 bump version. mo 2018-02-27 03:41:39
769da4c fix broken specs. mo 2018-02-26 03:56:02
Changed files (5)
lib/saml/kit/version.rb
@@ -2,6 +2,6 @@
 
 module Saml
   module Kit
-    VERSION = '1.0.10'.freeze
+    VERSION = '1.0.11'.freeze
   end
 end
lib/saml/kit/xml_templatable.rb
@@ -3,12 +3,15 @@
 module Saml
   module Kit
     module XmlTemplatable
+      TEMPLATES_DIR = Pathname.new(File.join(__dir__, 'builders/templates/'))
       include ::Xml::Kit::Templatable
 
       def template_path
-        root_path = __dir__
-        template_name = "#{self.class.name.split('::').last.underscore}.builder"
-        File.join(root_path, 'builders/templates/', template_name)
+        @template_path ||= TEMPLATES_DIR.join(template_name)
+      end
+
+      def template_name
+        "#{self.class.name.split('::').last.underscore}.builder"
       end
 
       # Returns true if an embedded signature is requested and at least one signing certificate is available via the configuration.
spec/saml/kit/bindings/url_builder_spec.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
 RSpec.describe Saml::Kit::Bindings::UrlBuilder do
   describe '#build' do
     let(:xml) { '<xml></xml>' }
spec/support/ruby_prof.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+require 'ruby-prof'
+
+module RubyProfiler
+  def with_profiler
+    result = RubyProf.profile do
+      yield
+    end
+    printer = RubyProf::CallTreePrinter.new(result)
+    printer.print(path: 'tmp/', profile: Time.now.utc.iso8601)
+  end
+end
+
+RSpec.configure do |config|
+  config.include RubyProfiler
+end
saml-kit.gemspec
@@ -18,7 +18,11 @@ Gem::Specification.new do |spec|
   spec.required_ruby_version = '>= 2.2.0'
 
   spec.files = `git ls-files -z`.split("\x0").reject do |f|
-    f.match(%r{^(test|spec|features)/})
+    (
+      f.match(%r{^(test|spec|features)/}) ||
+      f.match(/^\..*/) ||
+      f.match(%r{^bin/.*})
+    ) && !f.match(%r{^spec/examples.*/})
   end
   spec.metadata['yard.run'] = 'yri'
   spec.bindir        = 'exe'
@@ -34,6 +38,7 @@ Gem::Specification.new do |spec|
   spec.add_development_dependency 'rspec-benchmark', '~> 0.3'
   spec.add_development_dependency 'rubocop', '~> 0.52'
   spec.add_development_dependency 'rubocop-rspec', '~> 1.22'
+  spec.add_development_dependency 'ruby-prof'
   spec.add_development_dependency 'simplecov', '~> 0.15'
   spec.add_development_dependency 'webmock', '~> 3.1'
 end