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
#perform, register
Methods included from Actions
#basename, #compile, #copy, #directory, #process_erb, #relativize, #remove, #separate, #strip_trailing_separator, #write_file
Constructor Details
#initialize(working_path, options) ⇒ PrintVersion
Returns a new instance of PrintVersion.
61
62
63
|
# File 'lib/compass/commands/print_version.rb', line 61
def initialize(working_path, options)
self.options = options
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
59
60
61
|
# File 'lib/compass/commands/print_version.rb', line 59
def options
@options
end
|
Class Method Details
.description(command) ⇒ Object
49
50
51
|
# File 'lib/compass/commands/print_version.rb', line 49
def description(command)
"Print out version information"
end
|
.option_parser(arguments) ⇒ Object
.parse!(arguments) ⇒ Object
52
53
54
55
56
|
# File 'lib/compass/commands/print_version.rb', line 52
def parse!(arguments)
parser = option_parser(arguments)
parser.parse!
parser.options
end
|
.usage ⇒ Object
46
47
48
|
# File 'lib/compass/commands/print_version.rb', line 46
def usage
option_parser([]).to_s
end
|
Instance Method Details
#execute ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/compass/commands/print_version.rb', line 65
def execute
if options[:custom]
version = ""
version << "#{Compass.version[:major]}" if options[:major]
version << ".#{Compass.version[:minor]}" if options[:minor]
version << ".#{Compass.version[:teeny]}" if options[:patch]
if options[:revision]
if version.size > 0
version << " [#{Compass.version[:rev][0..6]}]"
else
version << Compass.version[:rev]
end
end
puts version
elsif options[:quiet]
puts ::Compass.version[:string]
else
lines = []
lines << "Compass #{::Compass.version[:string]}"
lines << "Copyright (c) 2008-2009 Chris Eppstein"
lines << "Released under the MIT License."
puts lines.join("\n")
end
end
|