serverspec_launcher 0.3.0 → 0.3.1
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 +4 -4
 - data/.gitignore +0 -0
 - data/.rspec +0 -0
 - data/.rubocop.yml +0 -0
 - data/.travis.yml +0 -0
 - data/CODE_OF_CONDUCT.md +0 -0
 - data/Gemfile +0 -0
 - data/LICENSE.txt +0 -0
 - data/README.md +0 -0
 - data/Rakefile +0 -0
 - data/lib/launcher_json_formatter.rb +108 -0
 - data/lib/serverspec_launcher/generators/properties_generator.rb +0 -0
 - data/lib/serverspec_launcher/generators/rakefile_generator.rb +0 -0
 - data/lib/serverspec_launcher/generators/role_spec_generator.rb +0 -0
 - data/lib/serverspec_launcher/generators/spec_helper_generator.rb +0 -0
 - data/lib/serverspec_launcher/helpers/example_helper.rb +0 -0
 - data/lib/serverspec_launcher/helpers/symbolize_helper.rb +0 -0
 - data/lib/serverspec_launcher/rake_tasks.rb +3 -0
 - data/lib/serverspec_launcher/spec_helper.rb +0 -0
 - data/lib/serverspec_launcher/version.rb +1 -1
 - data/lib/serverspec_launcher.rb +0 -0
 - data/serverspec_launcher.gemspec +0 -0
 - data/templates/Rakefile.erb +0 -0
 - data/templates/properties.yaml.erb +0 -0
 - data/templates/role_spec.rb.erb +0 -0
 - data/templates/spec_helper.rb.erb +0 -0
 - metadata +4 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b6f82a6355e080feebc93348e6aab8a405d52cb83dcc124cb28f1ffdb10a0b7d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8b4de676dfccbd4e3b9505fd01f50708da16ed636dd246b2d833036bb7326e94
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 2f3d7740b7ff72401ab01a727c577a9b04a5c92b617656d7f08c0a8d632ac33b61339e1f91e6afde182ca2696c8fedbe4fbc22366cfdbdc2bc3fd67d6eda4526
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 78f064b363e4582f88a65887f52e205fcef175cfd8d31f26abfe1ce803b05c2f0e128382027c632ad37798e287758a17fd7f31a1d1aebda008932abd42b9e347
         
     | 
    
        data/.gitignore
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/.rspec
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/.travis.yml
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/CODE_OF_CONDUCT.md
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/LICENSE.txt
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         
            File without changes
         
     | 
| 
         @@ -0,0 +1,108 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            RSpec::Support.require_rspec_core "formatters/base_formatter"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class LauncherJsonFormatter < RSpec::Core::Formatters::BaseFormatter
         
     | 
| 
      
 5 
     | 
    
         
            +
              RSpec::Core::Formatters.register self, :message, :dump_summary, :dump_profile, :stop, :seed, :close,:example_group_started, :example_group_finsihed
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              attr_reader :output_hash
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              def initialize(output)
         
     | 
| 
      
 10 
     | 
    
         
            +
                super
         
     | 
| 
      
 11 
     | 
    
         
            +
                @output_hash = {
         
     | 
| 
      
 12 
     | 
    
         
            +
                    :version => RSpec::Core::Version::STRING
         
     | 
| 
      
 13 
     | 
    
         
            +
                }
         
     | 
| 
      
 14 
     | 
    
         
            +
                @context = []
         
     | 
| 
      
 15 
     | 
    
         
            +
                @resource = ''
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              def message(notification)
         
     | 
| 
      
 19 
     | 
    
         
            +
                (@output_hash[:messages] ||= []) << notification.message
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              def dump_summary(summary)
         
     | 
| 
      
 23 
     | 
    
         
            +
                @output_hash[:summary] = {
         
     | 
| 
      
 24 
     | 
    
         
            +
                    :duration => summary.duration,
         
     | 
| 
      
 25 
     | 
    
         
            +
                    :example_count => summary.example_count,
         
     | 
| 
      
 26 
     | 
    
         
            +
                    :failure_count => summary.failure_count,
         
     | 
| 
      
 27 
     | 
    
         
            +
                    :pending_count => summary.pending_count,
         
     | 
| 
      
 28 
     | 
    
         
            +
                    :errors_outside_of_examples_count => summary.errors_outside_of_examples_count
         
     | 
| 
      
 29 
     | 
    
         
            +
                }
         
     | 
| 
      
 30 
     | 
    
         
            +
                @output_hash[:summary_line] = summary.totals_line
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              def stop(notification)
         
     | 
| 
      
 34 
     | 
    
         
            +
                @output_hash[:examples] = notification.examples.map do |example|
         
     | 
| 
      
 35 
     | 
    
         
            +
                  format_example(example).tap do |hash|
         
     | 
| 
      
 36 
     | 
    
         
            +
                    e = example.exception
         
     | 
| 
      
 37 
     | 
    
         
            +
                    if e
         
     | 
| 
      
 38 
     | 
    
         
            +
                      hash[:exception] =  {
         
     | 
| 
      
 39 
     | 
    
         
            +
                          :class => e.class.name,
         
     | 
| 
      
 40 
     | 
    
         
            +
                          :message => e.message,
         
     | 
| 
      
 41 
     | 
    
         
            +
                          :backtrace => e.backtrace,
         
     | 
| 
      
 42 
     | 
    
         
            +
                      }
         
     | 
| 
      
 43 
     | 
    
         
            +
                    end
         
     | 
| 
      
 44 
     | 
    
         
            +
                  end
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
              def seed(notification)
         
     | 
| 
      
 49 
     | 
    
         
            +
                return unless notification.seed_used?
         
     | 
| 
      
 50 
     | 
    
         
            +
                @output_hash[:seed] = notification.seed
         
     | 
| 
      
 51 
     | 
    
         
            +
              end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              def close(_notification)
         
     | 
| 
      
 54 
     | 
    
         
            +
                output.write @output_hash.to_json
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              def dump_profile(profile)
         
     | 
| 
      
 58 
     | 
    
         
            +
                @output_hash[:profile] = {}
         
     | 
| 
      
 59 
     | 
    
         
            +
                dump_profile_slowest_examples(profile)
         
     | 
| 
      
 60 
     | 
    
         
            +
                dump_profile_slowest_example_groups(profile)
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
              def example_group_started(example_group)
         
     | 
| 
      
 64 
     | 
    
         
            +
                @context.push "#{example_group.group.description}"
         
     | 
| 
      
 65 
     | 
    
         
            +
                @resource = "#{example_group.group.description}"
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
              def example_group_finished(example_group)
         
     | 
| 
      
 69 
     | 
    
         
            +
                @group.pop
         
     | 
| 
      
 70 
     | 
    
         
            +
              end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
              # @api private
         
     | 
| 
      
 73 
     | 
    
         
            +
              def dump_profile_slowest_examples(profile)
         
     | 
| 
      
 74 
     | 
    
         
            +
                @output_hash[:profile] = {}
         
     | 
| 
      
 75 
     | 
    
         
            +
                @output_hash[:profile][:examples] = profile.slowest_examples.map do |example|
         
     | 
| 
      
 76 
     | 
    
         
            +
                  format_example(example).tap do |hash|
         
     | 
| 
      
 77 
     | 
    
         
            +
                    hash[:run_time] = example.execution_result.run_time
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
                @output_hash[:profile][:slowest] = profile.slow_duration
         
     | 
| 
      
 81 
     | 
    
         
            +
                @output_hash[:profile][:total] = profile.duration
         
     | 
| 
      
 82 
     | 
    
         
            +
              end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
              # @api private
         
     | 
| 
      
 85 
     | 
    
         
            +
              def dump_profile_slowest_example_groups(profile)
         
     | 
| 
      
 86 
     | 
    
         
            +
                @output_hash[:profile] ||= {}
         
     | 
| 
      
 87 
     | 
    
         
            +
                @output_hash[:profile][:groups] = profile.slowest_groups.map do |loc, hash|
         
     | 
| 
      
 88 
     | 
    
         
            +
                  hash.update(:location => loc)
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
              end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
              private
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
              def format_example(example)
         
     | 
| 
      
 95 
     | 
    
         
            +
                {
         
     | 
| 
      
 96 
     | 
    
         
            +
                    :id => example.id,
         
     | 
| 
      
 97 
     | 
    
         
            +
                    :description => example.description,
         
     | 
| 
      
 98 
     | 
    
         
            +
                    :full_description => example.full_description,
         
     | 
| 
      
 99 
     | 
    
         
            +
                    :status => example.execution_result.status.to_s,
         
     | 
| 
      
 100 
     | 
    
         
            +
                    :file_path => example.metadata[:file_path],
         
     | 
| 
      
 101 
     | 
    
         
            +
                    :line_number  => example.metadata[:line_number],
         
     | 
| 
      
 102 
     | 
    
         
            +
                    :run_time => example.execution_result.run_time,
         
     | 
| 
      
 103 
     | 
    
         
            +
                    :pending_message => example.execution_result.pending_message,
         
     | 
| 
      
 104 
     | 
    
         
            +
                    :resource => @resource,
         
     | 
| 
      
 105 
     | 
    
         
            +
                    :context => @context
         
     | 
| 
      
 106 
     | 
    
         
            +
                }
         
     | 
| 
      
 107 
     | 
    
         
            +
              end
         
     | 
| 
      
 108 
     | 
    
         
            +
            end
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -113,6 +113,9 @@ class ServerspecLauncherRakeTasks 
     | 
|
| 
       113 
113 
     | 
    
         
             
                if options[:formatters].include?('json')
         
     | 
| 
       114 
114 
     | 
    
         
             
                  opts = "#{opts}  --format j --out #{report_path}.json"
         
     | 
| 
       115 
115 
     | 
    
         
             
                end
         
     | 
| 
      
 116 
     | 
    
         
            +
                if options[:formatters].include?('launcher')
         
     | 
| 
      
 117 
     | 
    
         
            +
                  opts = "#{opts}  --format LauncherJsonFormatter --out #{report_path}_extended.json"
         
     | 
| 
      
 118 
     | 
    
         
            +
                end
         
     | 
| 
       116 
119 
     | 
    
         
             
                unless options[:color]
         
     | 
| 
       117 
120 
     | 
    
         
             
                  opts = "#{opts} --no-color"
         
     | 
| 
       118 
121 
     | 
    
         
             
                end
         
     | 
| 
         
            File without changes
         
     | 
    
        data/lib/serverspec_launcher.rb
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/serverspec_launcher.gemspec
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        data/templates/Rakefile.erb
    CHANGED
    
    | 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
    
        data/templates/role_spec.rb.erb
    CHANGED
    
    | 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: serverspec_launcher
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andrew Wardrobe
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2019- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-05-06 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -212,6 +212,7 @@ files: 
     | 
|
| 
       212 
212 
     | 
    
         
             
            - bin/console
         
     | 
| 
       213 
213 
     | 
    
         
             
            - bin/setup
         
     | 
| 
       214 
214 
     | 
    
         
             
            - exe/serverspec_launcher
         
     | 
| 
      
 215 
     | 
    
         
            +
            - lib/launcher_json_formatter.rb
         
     | 
| 
       215 
216 
     | 
    
         
             
            - lib/serverspec_launcher.rb
         
     | 
| 
       216 
217 
     | 
    
         
             
            - lib/serverspec_launcher/generators/properties_generator.rb
         
     | 
| 
       217 
218 
     | 
    
         
             
            - lib/serverspec_launcher/generators/rakefile_generator.rb
         
     | 
| 
         @@ -247,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       247 
248 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       248 
249 
     | 
    
         
             
            requirements: []
         
     | 
| 
       249 
250 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       250 
     | 
    
         
            -
            rubygems_version: 2.7. 
     | 
| 
      
 251 
     | 
    
         
            +
            rubygems_version: 2.7.6
         
     | 
| 
       251 
252 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       252 
253 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       253 
254 
     | 
    
         
             
            summary: A utility to manage serverspec scripts
         
     |