Sha256: 6f3f2e3449f9411b7b10020783095feb89591b340352a7d25daad5f0e44c0980

Contents?: true

Size: 839 Bytes

Versions: 7

Compression:

Stored size: 839 Bytes

Contents

module Legion
  class Cli
    module Lex
      class Actor < 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 actor'
        method_option :type, enum: %w[subscription every poll once loop], default: 'subscription'
        def create(name)
          template('templates/actor.erb', "#{lex}/lib/actors/#{name}.rb", { name: name, lex: lex, type: options[:type] })
        end

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