Sha256: 748cd4473451c3b72489f0039ef890023729d08a1af87e16f1f3ce29fcb8a237

Contents?: true

Size: 960 Bytes

Versions: 7

Compression:

Stored size: 960 Bytes

Contents

module Legion
  class Cli
    module Lex
      class Exchange < 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 exchange class'
        def create(name)
          template('templates/queue.erb', "lib/legion/extensions/#{lex}/transport/exchanges/#{name}.rb", { name: name, lex: lex })
          template('templates/queue_spec.erb', "spec/exchanges/#{name}_spec.rb", { name: name, lex: lex })
        end

        desc 'delete :name', 'deletes an exchange class'
        def delete(name)
          remove_file("lib/legion/extensions/#{lex}/transport/exchanges/#{name}.rb")
          remove_file("spec/exchanges/#{name}_spec.rb")
          remove_file("spec/transport/exchanges/#{name}_spec.rb")
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
legionio-1.2.1 lib/legion/cli/lex/exchange.rb
legionio-1.2.0 lib/legion/cli/lex/exchange.rb
legionio-0.4.3 lib/legion/cli/lex/exchange.rb
legionio-0.4.2 lib/legion/cli/lex/exchange.rb
legionio-0.4.1 lib/legion/cli/lex/exchange.rb
legionio-0.4.0 lib/legion/cli/lex/exchange.rb
legion-cli-0.2.0 lib/legion/cli/lex/exchange.rb