Class: Sycersion::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/sycersion.rb

Overview

Runs the program based on the arguments provided at the commandline

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Runner

Returns a new instance of Runner.



17
18
19
20
# File 'lib/sycersion.rb', line 17

def initialize(argv)
  @options = Options.new(argv).options
  pp @options if ENV['SYC_DEBUG']
end

Instance Method Details

#configuration_informationObject



53
54
55
# File 'lib/sycersion.rb', line 53

def configuration_information
  puts Sycersion::VersionInfo.new.process(@options) if @options[:info]
end

#environment_settingsObject



29
30
31
# File 'lib/sycersion.rb', line 29

def environment_settings
  Sycersion::VersionEnvironment.new.setup if @options[:init]
end

#runObject



22
23
24
25
26
27
# File 'lib/sycersion.rb', line 22

def run
  environment_settings
  version_manipulation
  version_compare
  configuration_information
end

#version_compareObject



46
47
48
49
50
51
# File 'lib/sycersion.rb', line 46

def version_compare
  return unless @options[:compare]

  @options[:compare].shift
  puts Sycersion::VersionCompare.new.compare(@options[:compare])
end

#version_manipulationObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/sycersion.rb', line 33

def version_manipulation
  case @options.keys
  when [:set]
    Sycersion::VersionSetter.new.version = (@options[:set])
  when [:pre_release]
    Sycersion::VersionSetter.new.pre_release = (@options[:pre_release])
  when [:build]
    Sycersion::VersionSetter.new.build = (@options[:build])
  when [:inc]
    Sycersion::VersionIncrementer.new.increment(@options[:inc])
  end
end