Module: SchemaEvolutionManager::SemInfo

Defined in:
lib/schema-evolution-manager/sem_info.rb

Defined Under Namespace

Modules: Tag

Class Method Summary collapse

Class Method Details

.tag(args) ⇒ Object



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
# File 'lib/schema-evolution-manager/sem_info.rb', line 9

def SemInfo.tag(args)
  valid = ['exists', 'latest', 'next']

  subcommand = args.shift.to_s.strip

  if subcommand == "exists"
    tag = args.shift.to_s.strip
    if tag.empty?
      puts "ERROR: Missing tag."
      exit(3)
    elsif ::SchemaEvolutionManager::Library.tag_exists?(tag)
      puts "true"
    else
      puts "false"
    end

  elsif subcommand == "latest"
    if latest = ::SchemaEvolutionManager::SemInfo::Tag.latest
      latest.to_version_string
    else
      nil
    end

  elsif subcommand == "next"
    ::SchemaEvolutionManager::SemInfo::Tag.next(args).to_version_string

  elsif subcommand.empty?
    puts "ERROR: Missing tag subcommand. Must be one of: %s" % valid.join(", ")
    exit(3)

  else
    puts "ERROR: Invalid tag subcommand[%s]. Must be one of: %s" % [subcommand, valid.join(", ")]
    exit(4)
  end
end

.version(args = nil) ⇒ Object



5
6
7
# File 'lib/schema-evolution-manager/sem_info.rb', line 5

def SemInfo.version(args=nil)
  SchemaEvolutionManager::SemVersion::VERSION.dup
end