Sha256: 082592c007428cbf43342ce68fdb15af8fc7a81c2f85afbe02a90914d258c6e6

Contents?: true

Size: 909 Bytes

Versions: 8

Compression:

Stored size: 909 Bytes

Contents

require 'yaml'

namespace :generate do
  desc "Create Rollbar project for current shopify app, and return the ROLLBAR API TOKEN"
  task rollbar_project: :environment do
    begin
      config_path = File.join(ENV['HOME'], '.disco_app.yml')
      config = YAML.load_file(config_path)
    rescue StandardError
      abort("Could not load configuration file from #{config_path}, aborting.")
    end

    params = {
      write_account_access_token: config['params']['ROLLBAR_ACCOUNT_ACCESS_TOKEN_WRITE'].to_s,
      read_account_access_token: config['params']['ROLLBAR_ACCOUNT_ACCESS_TOKEN_READ'].to_s
    }

    project_access_token = DiscoApp::RollbarClient.new(params).create_project(ENV['APP_NAME'].blank? ? ENV['SHOPIFY_APP_NAME'] : ENV['APP_NAME'])
    puts '#' * 80
    puts 'New Rollbar project successfully created!'
    puts "ROLLBAR_ACCESS_TOKEN = #{project_access_token}"
    puts '#' * 80
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
disco_app-0.14.1 lib/tasks/rollbar.rake
disco_app-0.14.2 lib/tasks/rollbar.rake
disco_app-0.15.0 lib/tasks/rollbar.rake
disco_app-0.16.0 lib/tasks/rollbar.rake
disco_app-0.14.4 lib/tasks/rollbar.rake
disco_app-0.14.3 lib/tasks/rollbar.rake
disco_app-0.15.2 lib/tasks/rollbar.rake
disco_app-0.14.0 lib/tasks/rollbar.rake