Class: Compass::Commands::PrintVersion
- Inherits:
-
Base
- Object
- Base
- Compass::Commands::PrintVersion
show all
- Defined in:
- lib/compass/commands/print_version.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#working_path
Attributes included from Actions
#logger
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#failed!, #perform, register, #successful?
Methods included from Actions
#basename, #copy, #directory, #log_action, #process_erb, #relativize, #remove, #separate, #strip_trailing_separator, #write_file
Constructor Details
#initialize(working_path, options) ⇒ PrintVersion
Returns a new instance of PrintVersion.
69
70
71
|
# File 'lib/compass/commands/print_version.rb', line 69
def initialize(working_path, options)
self.options = options
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
67
68
69
|
# File 'lib/compass/commands/print_version.rb', line 67
def options
@options
end
|
Class Method Details
.description(command) ⇒ Object
45
46
47
|
# File 'lib/compass/commands/print_version.rb', line 45
def description(command)
"Print out version information"
end
|
.long_output_string ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/compass/commands/print_version.rb', line 53
def long_output_string
lines = []
lines << "Compass #{::Compass.version[:string]}"
if name = ::Compass.version[:name]
lines.last << " (#{name})"
end
lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein"
lines << "Released under the MIT License."
lines << "Compass is charityware."
lines << "Please make a tax deductable donation for a worthy cause: http://umdf.org/compass"
lines.join("\n")
end
|
.option_parser(arguments) ⇒ Object
.parse!(arguments) ⇒ Object
48
49
50
51
52
|
# File 'lib/compass/commands/print_version.rb', line 48
def parse!(arguments)
parser = option_parser(arguments)
parser.parse!
parser.options
end
|
.usage ⇒ Object
42
43
44
|
# File 'lib/compass/commands/print_version.rb', line 42
def usage
option_parser([]).to_s
end
|
Instance Method Details
#execute ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/compass/commands/print_version.rb', line 73
def execute
if options[:custom]
version = ""
version << "#{Compass.version[:major]}" if options[:major]
version << ".#{Compass.version[:minor]}" if options[:minor]
version << ".#{Compass.version[:patch]}" if options[:patch]
puts version
elsif options[:quiet]
puts ::Compass.version[:string]
else
puts self.class.long_output_string
end
end
|