Module: Hoe::Highline

Extended by:
Forwardable
Defined in:
lib/hoe/highline.rb

Overview

Add Highline command-line interaction functions to Hoe Rakefiles.

Constant Summary collapse

VERSION =

Library version constant

'0.2.1'
REVISION =

Version-control revision constant

%q$Revision: 0621f704d94a $
COLOR_SCHEME =

HighLine color scheme

{
	:header    => [ :bold, :yellow ],
	:subheader => [ :bold, :white ],
	:values    => [ :bold, :white ],
	:error     => [ :red ],
	:warning   => [ :yellow ],
	:message   => [ :reset ],
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#highlineObject

The HighLine object used for prompting



29
30
31
# File 'lib/hoe/highline.rb', line 29

def highline
  @highline
end

Instance Method Details

#define_highline_tasksObject

Hoe hook – add the Highline functions to Kernel when the plugin is loaded.



45
46
47
48
49
50
# File 'lib/hoe/highline.rb', line 45

def define_highline_tasks
	$terminal = self.highline

	::Kernel.extend( Forwardable )
	::Kernel.def_delegators :$terminal, :agree, :ask, :choose, :color, :list, :say
end

#initialize_highlineObject

Set up the plugin’s instance variables.



33
34
35
36
37
38
39
40
# File 'lib/hoe/highline.rb', line 33

def initialize_highline
	HighLine.color_scheme = HighLine::ColorScheme.new( COLOR_SCHEME )
	@highline = HighLine.new( $stdin, $stderr )

	minor_version = VERSION[ /^\d+\.\d+/ ]
	self.extra_dev_deps << ['hoe-highline', "~> #{minor_version}"] unless
		self.name == 'hoe-highline'
end