Sha256: 1d24b21b5378ae80487f594c9486c8422dfdbd9a3e5804ed990209d8db4f5932

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 Bytes

Contents

module Wassup
  module Panes
    module Netlify
      class Deploys
        attr_accessor :site_id

        def initialize(site_id:)
          @site_id = site_id
        end

        def configure(pane)
          pane.content do |content|
            deploys = Helpers::Netlify.deploys(site_id: site_id)
            deploys.each do |deploy|
              display = Helpers::Netlify::Formatter.deploy(deploy)
              content.add_row(display, deploy)
            end
          end
          pane.selection('enter', 'Open in Netlify') do |deploy|
            url = "#{deploy['admin_url']}/deploys/#{deploy['id']}"
            `open #{url}`
          end
          pane.selection('o', 'Open preview') do |deploy|
            if deploy['state'] == 'error'
              # show alert that isn't here yet
            elsif deploy['review_id'].nil?
              `open #{deploy['url']}`
            else
              `open #{deploy['deploy_ssl_url']}`
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wassup-0.4.1 lib/wassup/panes/netlify.rb
wassup-0.4.0 lib/wassup/panes/netlify.rb