Sha256: 866f0e24081deecbf94785686d10655207023cb12c0a3f04299cb2fb0c6327ba

Contents?: true

Size: 749 Bytes

Versions: 4

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true

require_relative '../helpers/os_helper.rb'
require_relative '../git/repository.rb'

module Geet
  module Services
    class CreateGist
      include Geet::Helpers::OsHelper

      # options:
      #   :description
      #   :publik:      defaults to false
      #   :no_browse    defaults to false
      #
      def execute(repository, filename, description: nil, publik: false, no_browse: false)
        content = IO.read(filename)

        puts 'Creating the gist...'

        gist = repository.create_gist(filename, content, description: description, publik: publik)

        if no_browse
          puts "Gist address: #{gist.link}"
        else
          os_open(gist.link)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geet-0.1.5 lib/geet/services/create_gist.rb
geet-0.1.4 lib/geet/services/create_gist.rb
geet-0.1.3 lib/geet/services/create_gist.rb
geet-0.1.2 lib/geet/services/create_gist.rb