Sha256: a2ab8593b40b9a63d7212b2bdc1ae28607ee087f8201399398634d7d508572a2

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/env ruby

require "gemline"
require 'optparse'

## TODO: Real command line parsing to support some switches
##   for things like:
##   --pre : Get latest pre-release version
##   --major N : Get latest version of gem within the given major release number
##   --web or -w : Get rubygems.org link

def self.help_message
  puts "Usage: gemline [GEM NAME]"
  puts "  Prints a Gemfile require line for a Ruby gem on Rubygems.org"
  exit
end

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: gemline gem_name [options]"

  opts.on("--gemspec", "-g") do |g|
    options[:gemspec] = g
  end

  opts.on("--group x,y,z", Array) do |group|
    group = group[0] if group.size == 1
    options[:group] = group
  end

  opts.on("--git x", String) do |git|
    options[:git] = git
  end

  opts.on("-v", "--version") do
    puts "gemline #{Gem::Specification::load("gemline.gemspec").version}"
    exit
  end

  opts.on("-h", "--help", "help") do
    help_message
  end
end.parse!

gem = STDIN.tty? ? ARGV[0] : STDIN.read

help_message unless gem

Gemline.query(gem, options)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gemline-0.4.5 bin/gemline
gemline-0.4.4 bin/gemline
gemline-0.4.3 bin/gemline
gemline-0.4.2 bin/gemline
gemline-0.4.1 bin/gemline
gemline-0.4.0 bin/gemline