errbit_lighthouse_plugin 0.1.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 +7 -0
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/Rakefile +1 -0
- data/errbit_lighthouse_plugin.gemspec +26 -0
- data/lib/errbit_lighthouse_plugin.rb +12 -0
- data/lib/errbit_lighthouse_plugin/error.rb +3 -0
- data/lib/errbit_lighthouse_plugin/issue_tracker.rb +100 -0
- data/lib/errbit_lighthouse_plugin/rails.rb +8 -0
- data/lib/errbit_lighthouse_plugin/version.rb +3 -0
- data/vendor/assets/images/lighthouseapp_create.png +0 -0
- data/vendor/assets/images/lighthouseapp_goto.png +0 -0
- data/vendor/assets/images/lighthouseapp_inactive.png +0 -0
- data/views/lighthouseapp_body.txt.erb +34 -0
- metadata +116 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: 0d2c4ae2cbaef555312a8393f2201beafbb491b3
         | 
| 4 | 
            +
              data.tar.gz: 6bba5c3028f64fa325e8028fcc05590b097beaff
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: fb351c9f45e26774401b3a9a97fcb74257568df1a04f67c3a4aabecaaa9331c32fa3f6cc567425ce51f2d9515d0ba0c500d2c0d8b04b08ed9a6352908c871da7
         | 
| 7 | 
            +
              data.tar.gz: dd8190aba245d07194a55a9b50183e316997b6af300c963e7a0f813ce8c692be49e17562ce5408ad2680131adb8899fc4b0206cd3f4d5b82eea42704460d8042
         | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.ruby-version
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            2.1.1
         | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            Copyright (c) 2013 Cyril Mougel
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            MIT License
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 6 | 
            +
            a copy of this software and associated documentation files (the
         | 
| 7 | 
            +
            "Software"), to deal in the Software without restriction, including
         | 
| 8 | 
            +
            without limitation the rights to use, copy, modify, merge, publish,
         | 
| 9 | 
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         | 
| 10 | 
            +
            permit persons to whom the Software is furnished to do so, subject to
         | 
| 11 | 
            +
            the following conditions:
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            The above copyright notice and this permission notice shall be
         | 
| 14 | 
            +
            included in all copies or substantial portions of the Software.
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 17 | 
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         | 
| 18 | 
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 19 | 
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         | 
| 20 | 
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 21 | 
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 22 | 
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            require "bundler/gem_tasks"
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            # coding: utf-8
         | 
| 2 | 
            +
            lib = File.expand_path('../lib', __FILE__)
         | 
| 3 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            +
            require 'errbit_lighthouse_plugin/version'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |spec|
         | 
| 7 | 
            +
              spec.name          = "errbit_lighthouse_plugin"
         | 
| 8 | 
            +
              spec.version       = ErrbitLighthousePlugin::VERSION
         | 
| 9 | 
            +
              spec.authors       = ["Stephen Crosby"]
         | 
| 10 | 
            +
              spec.email         = ["stevecrozz@gmail.com"]
         | 
| 11 | 
            +
              spec.description   = %q{Lighthouse integration for Errbit}
         | 
| 12 | 
            +
              spec.summary       = %q{Lighthouse integration for Errbit}
         | 
| 13 | 
            +
              spec.homepage      = "https://github.com/brandedcrate/errbit_lighthouse_plugin"
         | 
| 14 | 
            +
              spec.license       = "MIT"
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              spec.files         = `git ls-files`.split($/)
         | 
| 17 | 
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| 18 | 
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 | 
            +
              spec.require_paths = ["lib"]
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              spec.add_runtime_dependency 'errbit_plugin', '~> 0'
         | 
| 22 | 
            +
              spec.add_runtime_dependency 'lighthouse-api', '~> 2'
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              spec.add_development_dependency 'bundler', '~> 1.3'
         | 
| 25 | 
            +
              spec.add_development_dependency 'rake', '~> 0'
         | 
| 26 | 
            +
            end
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            require "errbit_lighthouse_plugin/version"
         | 
| 2 | 
            +
            require 'errbit_lighthouse_plugin/error'
         | 
| 3 | 
            +
            require 'errbit_lighthouse_plugin/issue_tracker'
         | 
| 4 | 
            +
            require 'errbit_lighthouse_plugin/rails'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module ErrbitLighthousePlugin
         | 
| 7 | 
            +
              def self.root
         | 
| 8 | 
            +
                File.expand_path '../..', __FILE__
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ErrbitPlugin::Registry.add_issue_tracker(ErrbitLighthousePlugin::IssueTracker)
         | 
| @@ -0,0 +1,100 @@ | |
| 1 | 
            +
            require 'lighthouse'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module ErrbitLighthousePlugin
         | 
| 4 | 
            +
              class IssueTracker < ErrbitPlugin::IssueTracker
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                LABEL = "lighthouseapp"
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                FIELDS = [
         | 
| 9 | 
            +
                  [:account, {
         | 
| 10 | 
            +
                    :label       => "Subdomain",
         | 
| 11 | 
            +
                    :placeholder => "subdomain from http://{{subdomain}}.lighthouseapp.com"
         | 
| 12 | 
            +
                  }],
         | 
| 13 | 
            +
                  [:api_token, {
         | 
| 14 | 
            +
                    :label       => "API Token",
         | 
| 15 | 
            +
                    :placeholder => "123456789abcdef123456789abcdef"
         | 
| 16 | 
            +
                  }],
         | 
| 17 | 
            +
                  [:project_id, {
         | 
| 18 | 
            +
                    :label       => "Project ID",
         | 
| 19 | 
            +
                    :placeholder => "123456"
         | 
| 20 | 
            +
                  }]
         | 
| 21 | 
            +
                ]
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                NOTE = ""
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                def self.label
         | 
| 26 | 
            +
                  LABEL
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                def self.note
         | 
| 30 | 
            +
                  NOTE
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                def self.fields
         | 
| 34 | 
            +
                  FIELDS
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                def url
         | 
| 38 | 
            +
                  sprintf(
         | 
| 39 | 
            +
                    "http://%s.lighthouseapp.com/projects/%s",
         | 
| 40 | 
            +
                    params[:subdomain],
         | 
| 41 | 
            +
                    params[:project_id]
         | 
| 42 | 
            +
                  )
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                def comments_allowed?
         | 
| 46 | 
            +
                  false
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                # configured properly if all the fields are filled in
         | 
| 50 | 
            +
                def configured?
         | 
| 51 | 
            +
                  non_empty_params = params.reject { |k,v| v.empty? }.keys.map(&:intern)
         | 
| 52 | 
            +
                  required_fields  = FIELDS.map { |f| f[0].intern }
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                  (required_fields - non_empty_params).empty?
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                def errors
         | 
| 58 | 
            +
                  errors = []
         | 
| 59 | 
            +
                  if FIELDS.detect {|f| params[f[0]].blank? }
         | 
| 60 | 
            +
                    errors << [:base, 'You must specify your Lighthouseapp Subdomain, API token and Project ID']
         | 
| 61 | 
            +
                  end
         | 
| 62 | 
            +
                  errors
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                def create_issue(problem, reported_by = nil)
         | 
| 66 | 
            +
                  Lighthouse.account = params['account']
         | 
| 67 | 
            +
                  Lighthouse.token   = params['api_token']
         | 
| 68 | 
            +
                  # updating lighthouse account
         | 
| 69 | 
            +
                  Lighthouse::Ticket.site
         | 
| 70 | 
            +
                  Lighthouse::Ticket.format = :xml
         | 
| 71 | 
            +
                  ticket = Lighthouse::Ticket.new(:project_id => params['project_id'])
         | 
| 72 | 
            +
                  ticket.title = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}"
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  ticket.body = self.class.body_template.result(binding)
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                  ticket.tags << "errbit"
         | 
| 77 | 
            +
                  ticket.save!
         | 
| 78 | 
            +
                  problem.update_attributes(
         | 
| 79 | 
            +
                    :issue_link => ticket_link(ticket),
         | 
| 80 | 
            +
                    :issue_type => self.class.label
         | 
| 81 | 
            +
                  )
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                def ticket_link(ticket)
         | 
| 85 | 
            +
                  Lighthouse::Ticket.site.to_s
         | 
| 86 | 
            +
                    .sub(/#{Lighthouse::Ticket.site.path}$/, '') <<
         | 
| 87 | 
            +
                  Lighthouse::Ticket.element_path(
         | 
| 88 | 
            +
                    ticket.id, :project_id => params['project_id'])
         | 
| 89 | 
            +
                    .sub(/\.xml$/, '')
         | 
| 90 | 
            +
                end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                def self.body_template
         | 
| 93 | 
            +
                  @body_template ||= ERB.new(File.read(
         | 
| 94 | 
            +
                    File.join(
         | 
| 95 | 
            +
                      ErrbitLighthousePlugin.root, 'views', 'lighthouseapp_body.txt.erb'
         | 
| 96 | 
            +
                    )
         | 
| 97 | 
            +
                  ))
         | 
| 98 | 
            +
                end
         | 
| 99 | 
            +
              end
         | 
| 100 | 
            +
            end
         | 
| Binary file | 
| Binary file | 
| Binary file | 
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            [See this exception on Errbit](<%= problem.url %> "See this exception on Errbit")
         | 
| 2 | 
            +
            <% if notice = problem.notices.first %>
         | 
| 3 | 
            +
            # <%= notice.message %> #
         | 
| 4 | 
            +
            ## Summary ##
         | 
| 5 | 
            +
            <% if notice.request['url'].present? %>
         | 
| 6 | 
            +
            ### URL ###
         | 
| 7 | 
            +
            [<%= notice.request['url'] %>](<%= notice.request['url'] %>)
         | 
| 8 | 
            +
            <% end %>
         | 
| 9 | 
            +
            ### Where ###
         | 
| 10 | 
            +
            <%= notice.where %>
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ### Occured ###
         | 
| 13 | 
            +
            <%= notice.created_at.to_s(:micro) %>
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ### Similar ###
         | 
| 16 | 
            +
            <%= (notice.problem.notices_count - 1).to_s %>
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            ## Params ##
         | 
| 19 | 
            +
            <code><%= pretty_hash(notice.params) %></code>
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            ## Session ##
         | 
| 22 | 
            +
            <code><%= pretty_hash(notice.session) %></code>
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            ## Backtrace ##
         | 
| 25 | 
            +
            <code>
         | 
| 26 | 
            +
            <% notice.backtrace_lines.each do |line| %><%= line.number %>:  <%= line.file_relative %> -> **<%= line.method %>**
         | 
| 27 | 
            +
            <% end %>
         | 
| 28 | 
            +
            </code>
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            ## Environment ##
         | 
| 31 | 
            +
            <% for key, val in notice.env_vars %>
         | 
| 32 | 
            +
            <%= key %>: <%= val %>
         | 
| 33 | 
            +
            <% end %>
         | 
| 34 | 
            +
            <% end %>
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,116 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: errbit_lighthouse_plugin
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.1.0
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Stephen Crosby
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2014-09-06 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: errbit_plugin
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - "~>"
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '0'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - "~>"
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '0'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: lighthouse-api
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '2'
         | 
| 34 | 
            +
              type: :runtime
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '2'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: bundler
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - "~>"
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '1.3'
         | 
| 48 | 
            +
              type: :development
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - "~>"
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '1.3'
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: rake
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - "~>"
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
              type: :development
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - "~>"
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '0'
         | 
| 69 | 
            +
            description: Lighthouse integration for Errbit
         | 
| 70 | 
            +
            email:
         | 
| 71 | 
            +
            - stevecrozz@gmail.com
         | 
| 72 | 
            +
            executables: []
         | 
| 73 | 
            +
            extensions: []
         | 
| 74 | 
            +
            extra_rdoc_files: []
         | 
| 75 | 
            +
            files:
         | 
| 76 | 
            +
            - ".gitignore"
         | 
| 77 | 
            +
            - ".ruby-version"
         | 
| 78 | 
            +
            - Gemfile
         | 
| 79 | 
            +
            - LICENSE.txt
         | 
| 80 | 
            +
            - Rakefile
         | 
| 81 | 
            +
            - errbit_lighthouse_plugin.gemspec
         | 
| 82 | 
            +
            - lib/errbit_lighthouse_plugin.rb
         | 
| 83 | 
            +
            - lib/errbit_lighthouse_plugin/error.rb
         | 
| 84 | 
            +
            - lib/errbit_lighthouse_plugin/issue_tracker.rb
         | 
| 85 | 
            +
            - lib/errbit_lighthouse_plugin/rails.rb
         | 
| 86 | 
            +
            - lib/errbit_lighthouse_plugin/version.rb
         | 
| 87 | 
            +
            - vendor/assets/images/lighthouseapp_create.png
         | 
| 88 | 
            +
            - vendor/assets/images/lighthouseapp_goto.png
         | 
| 89 | 
            +
            - vendor/assets/images/lighthouseapp_inactive.png
         | 
| 90 | 
            +
            - views/lighthouseapp_body.txt.erb
         | 
| 91 | 
            +
            homepage: https://github.com/brandedcrate/errbit_lighthouse_plugin
         | 
| 92 | 
            +
            licenses:
         | 
| 93 | 
            +
            - MIT
         | 
| 94 | 
            +
            metadata: {}
         | 
| 95 | 
            +
            post_install_message: 
         | 
| 96 | 
            +
            rdoc_options: []
         | 
| 97 | 
            +
            require_paths:
         | 
| 98 | 
            +
            - lib
         | 
| 99 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 100 | 
            +
              requirements:
         | 
| 101 | 
            +
              - - ">="
         | 
| 102 | 
            +
                - !ruby/object:Gem::Version
         | 
| 103 | 
            +
                  version: '0'
         | 
| 104 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 105 | 
            +
              requirements:
         | 
| 106 | 
            +
              - - ">="
         | 
| 107 | 
            +
                - !ruby/object:Gem::Version
         | 
| 108 | 
            +
                  version: '0'
         | 
| 109 | 
            +
            requirements: []
         | 
| 110 | 
            +
            rubyforge_project: 
         | 
| 111 | 
            +
            rubygems_version: 2.2.2
         | 
| 112 | 
            +
            signing_key: 
         | 
| 113 | 
            +
            specification_version: 4
         | 
| 114 | 
            +
            summary: Lighthouse integration for Errbit
         | 
| 115 | 
            +
            test_files: []
         | 
| 116 | 
            +
            has_rdoc: 
         |