Sha256: d8cff7fe780139bf7e8832b30158d0469bd964c011e7611168ca5493145a5946

Contents?: true

Size: 949 Bytes

Versions: 7

Compression:

Stored size: 949 Bytes

Contents

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

        desc 'delete :name', 'deletes a message class'
        def delete(name)
          remove_file("lib/legion/extensions/#{lex}/transport/messages/#{name}.rb")
          remove_file("spec/messages/#{name}_spec.rb")
          remove_file("spec/transport/messages/#{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/message.rb
legionio-1.2.0 lib/legion/cli/lex/message.rb
legionio-0.4.3 lib/legion/cli/lex/message.rb
legionio-0.4.2 lib/legion/cli/lex/message.rb
legionio-0.4.1 lib/legion/cli/lex/message.rb
legionio-0.4.0 lib/legion/cli/lex/message.rb
legion-cli-0.2.0 lib/legion/cli/lex/message.rb