Class: PushGem

Inherits:
Object
  • Object
show all
Defined in:
lib/push_gem.rb,
lib/push_gem/version.rb

Constant Summary collapse

VERSION =
"1.0.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(author:, gem:) ⇒ PushGem



12
13
14
15
# File 'lib/push_gem.rb', line 12

def initialize(author:, gem:)
  @author = author
  @gem    = gem
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



10
11
12
# File 'lib/push_gem.rb', line 10

def author
  @author
end

#gemObject

Returns the value of attribute gem.



10
11
12
# File 'lib/push_gem.rb', line 10

def gem
  @gem
end

Instance Method Details

#checkObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/push_gem.rb', line 32

def check
  validate_author!
  validate_gem!

  RSpec::Core::RakeTask.new(:spec) do |t|
    t.verbose = false
  end

  RuboCop::RakeTask.new

  puts "Running tests for #{gem} gem..."

  Rake::Task["spec"].invoke
  Rake::Task["rubocop"].invoke
end

#pushObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/push_gem.rb', line 17

def push
  validate_author!
  validate_gem!

  system("bundle install")

  puts "Pushing #{gem} gem..."

  build_gem
  push_to_github
  push_to_rubygems

  puts "Successfully pushed #{gem} gem to both GitHub Packages and RubyGems.org"
end