[command] Make the changelog command work again.

This commit is contained in:
Eloy Durán
2014-01-16 18:16:03 +01:00
parent 86c2914a44
commit d3db52b9c2
2 changed files with 16 additions and 9 deletions

View File

@@ -40,6 +40,17 @@ module Motion; module Project
help! message
end
# This is lifted straight from CLAide, but adjusted slightly because the
# Class#name method is overriden in the old (deprecated) API below.
def self.command
@command ||= __name__.split('::').last.gsub(/[A-Z]+[a-z]*/) do |part|
part.downcase << '-'
end[0..-2]
end
class << self
alias_method :__name__, :name
end
def self.name
warn "The usage of `Motion::Project::Command.name` is deprecated use the " \
"`Motion::Project::Command.command` method instead. " \
@@ -54,7 +65,6 @@ module Motion; module Project
self.command = name
end
def self.help
warn "The usage of `Motion::Project::Command.help` is deprecated use the " \
"`Motion::Project::Command.summary` method instead. " \

View File

@@ -22,15 +22,12 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
module Motion; module Project
class ChangelogCommand < Command
self.name = 'changelog'
self.help = 'View the changelog'
def run(args)
unless args.empty?
die "Usage: motion changelog"
end
class Changelog < Command
self.summary = 'View the changelog.'
self.description = 'View the changes that have been made in all ' \
'RubyMotion versions.'
def run
pager = (ENV['PAGER'] or '/usr/bin/less')
system("#{pager} /Library/RubyMotion/NEWS")
end