Sha256: 541f391f5c3a511fb9bd872db36b363991a95e6d59cf7666cfd01c933457772b

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

module Legion
  class Cli
    module Lex
      class Queue < Thor
        include Thor::Actions

        def self.source_root
          File.dirname(__FILE__)
        end

        no_commands do
          def lex
            Dir.pwd.split('/').last.split('-').last
          end
        end

        desc 'create :name', 'creates a new queue'
        def create(name)
          template('templates/queue.erb', "lib/legion/extensions/#{lex}/transport/queues/#{name}.rb", { name: name, lex: lex })
          template('templates/queue_spec.erb', "spec/queues/#{name}_spec.rb", { name: name, lex: lex })
        end

        desc 'delete :name', 'deletes a queue config file'
        def delete(name)
          remove_file("lib/legion/extensions/#{lex}/transport/queues/#{name}.rb")
          remove_file("spec/queues/#{name}_spec.rb")
          remove_file("spec/transport/queues/#{name}_spec.rb")
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
legion-cli-0.2.0 lib/legion/cli/lex/queue.rb