Class: Gemsmith::Rake::Build
- Inherits:
-
Object
- Object
- Gemsmith::Rake::Build
- Defined in:
- lib/gemsmith/rake/build.rb
Overview
Provides gem build functionality. Meant to be wrapped in Rake tasks.
Instance Method Summary collapse
- #clean ⇒ Object
- #doc ⇒ Object
-
#initialize(tocer: Tocer::Writer, shell: Bundler::UI::Shell, kernel: Kernel) ⇒ Build
constructor
A new instance of Build.
- #validate ⇒ Object
Constructor Details
#initialize(tocer: Tocer::Writer, shell: Bundler::UI::Shell, kernel: Kernel) ⇒ Build
Returns a new instance of Build.
8 9 10 11 12 |
# File 'lib/gemsmith/rake/build.rb', line 8 def initialize tocer: Tocer::Writer, shell: Bundler::UI::Shell, kernel: Kernel @tocer = tocer @shell = shell.new @kernel = kernel end |
Instance Method Details
#clean ⇒ Object
20 21 22 23 |
# File 'lib/gemsmith/rake/build.rb', line 20 def clean FileUtils.rm_rf "pkg" shell.confirm "Cleaned gem artifacts." end |
#doc ⇒ Object
14 15 16 17 18 |
# File 'lib/gemsmith/rake/build.rb', line 14 def doc readme = File.join Dir.pwd, "README.md" tocer.new(readme).write shell.confirm "Updated gem documentation." end |
#validate ⇒ Object
25 26 27 28 29 |
# File 'lib/gemsmith/rake/build.rb', line 25 def validate return if `git status --porcelain`.empty? shell.error "Build failed: Gem has uncommitted changes." kernel.exit 1 end |