Class: Raketeer::GitHubPkgTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/raketeer/github_pkg_task.rb

Overview

Author:

  • Jonathan Bradley Whited

Since:

  • 0.2.8

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :github_pkg) {|_self| ... } ⇒ GitHubPkgTask

Returns a new instance of GitHubPkgTask.

Yields:

  • (_self)

Yield Parameters:

Since:

  • 0.2.8



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/raketeer/github_pkg_task.rb', line 28

def initialize(name=:github_pkg)
  super()

  @deps = [:build]
  @description = "Publish this project's gem(s) to GitHub Packages"
  @name = name
  @username = nil

  yield self if block_given?

  @username = Util.find_github_username if @username.nil?

  raise "#{self.class.name}.username is nil" if @username.nil?

  define
end

Instance Attribute Details

#depsObject

Since:

  • 0.2.8



23
24
25
# File 'lib/raketeer/github_pkg_task.rb', line 23

def deps
  @deps
end

#descriptionObject

Since:

  • 0.2.8



24
25
26
# File 'lib/raketeer/github_pkg_task.rb', line 24

def description
  @description
end

#nameObject

Since:

  • 0.2.8



25
26
27
# File 'lib/raketeer/github_pkg_task.rb', line 25

def name
  @name
end

#usernameObject

Since:

  • 0.2.8



26
27
28
# File 'lib/raketeer/github_pkg_task.rb', line 26

def username
  @username
end

Instance Method Details

#defineObject

Since:

  • 0.2.8



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/raketeer/github_pkg_task.rb', line 45

def define
  desc @description
  task @name => Array(@deps) do |task,args|
    sh_cmd = ['gem']

    sh_cmd.push('push')
    sh_cmd.push('--key','github')
    sh_cmd.push('--host',"https://rubygems.pkg.github.com/#{username}")
    sh_cmd.push(*Dir.glob(File.join('pkg','*.gem'))) # Is this okay for multiple gems?

    sh(*sh_cmd)
  end
end