Module: Versionista
- Defined in:
- lib/versionista.rb
Defined Under Namespace
Classes: Manager
Constant Summary collapse
- VERSION =
File.read(File.('../../VERSION', __FILE__))
Class Method Summary collapse
Class Method Details
.from_args(args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/versionista.rb', line 7 def self.from_args(args) = {} optparse = OptionParser.new do |opts| opts. = <<-EOF Versionista! #{VERSION} Manage version files. To get started run $ versionista --init --version-file ./path/to/File EOF .gsub(/^\s*/,'') opts.on('-f', '--version-file FILE', 'Path to version file') do |file| [:file] = File.(file) end opts.on('-b', '--bump WHICH', 'Bump: major/minor/patch') do |which| [:which] = which end opts.on('-i', '--init', 'Initialize version file') do [:init] = true end opts.on('-h', '--help', 'halp') do puts opts exit 0 end end optparse.parse! args if .empty? puts optparse exit 0 end Manager.new([:init], [:file], [:which]) end |