diff --git a/lib/motion/project/command.rb b/lib/motion/project/command.rb index c5b2dcba..4c1b6af4 100644 --- a/lib/motion/project/command.rb +++ b/lib/motion/project/command.rb @@ -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. " \ diff --git a/lib/motion/project/command/changelog.rb b/lib/motion/project/command/changelog.rb index fa437526..c5e25a76 100644 --- a/lib/motion/project/command/changelog.rb +++ b/lib/motion/project/command/changelog.rb @@ -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