Class: AutoTagger::CommandLine
- Inherits:
-
Object
- Object
- AutoTagger::CommandLine
- Defined in:
- lib/auto_tagger/command_line.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(args) ⇒ CommandLine
constructor
A new instance of CommandLine.
Constructor Details
#initialize(args) ⇒ CommandLine
Returns a new instance of CommandLine.
4 5 6 |
# File 'lib/auto_tagger/command_line.rb', line 4 def initialize(args) @args = args end |
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/auto_tagger/command_line.rb', line 8 def execute case [:command] when :version [true, "AutoTagger version #{AutoTagger::VERSION}"] when :help [true, [:help_text]] when :cleanup begin purged = AutoTagger::Base.new().cleanup [true, "Deleted: #{purged}"] rescue AutoTagger::Base::StageCannotBeBlankError [false, "You must provide a stage"] end when :delete_locally begin purged = AutoTagger::Base.new().delete_locally [true, "Deleted: #{purged}"] rescue AutoTagger::Base::StageCannotBeBlankError [false, "You must provide a stage"] end when :delete_on_remote begin purged = AutoTagger::Base.new().delete_on_remote [true, "Deleted: #{purged}"] rescue AutoTagger::Base::StageCannotBeBlankError [false, "You must provide a stage"] end when :list begin [true, AutoTagger::Base.new().list.join("\n")] rescue AutoTagger::Base::StageCannotBeBlankError [false, "You must provide a stage"] end when :config [true, AutoTagger::Configuration.new().settings.map { |key, value| "#{key} : #{value}" }.join("\n")] else begin = [] if [:deprecated] << AutoTagger::Deprecator.string("Please use `autotag create #{[:stage]}` instead") end ref = AutoTagger::Base.new().create_ref << "Created ref #{ref.name}" [true, .join("\n")] rescue AutoTagger::Base::StageCannotBeBlankError [false, "You must provide a stage"] end end end |