Sha256: e478e970a5b781de785c8a282a553763d586376d97c373865bd04fda2afaa27f

Contents?: true

Size: 1.1 KB

Versions: 13

Compression:

Stored size: 1.1 KB

Contents

module Relish
  module Command
    class Versions < Base
      include ResourceMethods
      resource_path :versions

      desc    'list the versions for a project'
      command :default do
        puts format(resource[resource_path_for_no_option].get(:accept => :json))
      end

      usage   'versions:add <project>:<version>'
      desc    'add a version to a project',
              'example: relish versions:add rspec/rspec-core:2.0'
      command :add do
        puts resource[resource_path_for_option].post(
          :version => { :name => version_name }
        )
      end

      usage   'versions:remove <project>:<version>'
      desc    'remove a version from a project',
              'example: relish versions:remove rspec/rspec-core:2.0'
      command :remove do
        puts resource["#{resource_path_for_option}/#{version_name}"].delete
      end

    private

      def version_name
        @param && @param.extract_option || error(:version_blank)
      end

      def format(response)
        json_parse(response) do |hash|
          "#{hash['version']['name']}"
        end
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
relish-0.7.1 lib/relish/commands/versions.rb
relish-0.7 lib/relish/commands/versions.rb
relish-0.6 lib/relish/commands/versions.rb
relish-0.5.3 lib/relish/commands/versions.rb
relish-0.5.2 lib/relish/commands/versions.rb
relish-0.5.1 lib/relish/commands/versions.rb
relish-0.5.0 lib/relish/commands/versions.rb
relish-0.4.0 lib/relish/commands/versions.rb
relish-0.3.0 lib/relish/commands/versions.rb
relish-0.3.0.pre lib/relish/commands/versions.rb
relish-0.2.3 lib/relish/commands/versions.rb
relish-0.2.2 lib/relish/commands/versions.rb
relish-0.2.1 lib/relish/commands/versions.rb