Class: V1gittools::BaseTool

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

Direct Known Subclasses

ChangeLogTool, DevelopStoryTool, QATool

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = nil) ⇒ BaseTool

Returns a new instance of BaseTool.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/v1gittools/base_tool.rb', line 5

def initialize args=nil
  @args = args


  @config = V1gittools::config
  check_proper_init
  @repo_config = V1gittools::repo_config
  git_root_path = `git rev-parse --show-toplevel`.strip
  @git = Git.open(git_root_path)
  @v1 = VersiononeSdk::Client.new(@config[:v1config])
  @github = Github.new(Hash[@config[:github].map{ |k, v| [k.to_sym, v] }])
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



3
4
5
# File 'lib/v1gittools/base_tool.rb', line 3

def args
  @args
end

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/v1gittools/base_tool.rb', line 3

def config
  @config
end

#gitObject (readonly)

Returns the value of attribute git.



3
4
5
# File 'lib/v1gittools/base_tool.rb', line 3

def git
  @git
end

#githubObject (readonly)

Returns the value of attribute github.



3
4
5
# File 'lib/v1gittools/base_tool.rb', line 3

def github
  @github
end

#repo_configObject (readonly)

Returns the value of attribute repo_config.



3
4
5
# File 'lib/v1gittools/base_tool.rb', line 3

def repo_config
  @repo_config
end

#v1Object (readonly)

Returns the value of attribute v1.



3
4
5
# File 'lib/v1gittools/base_tool.rb', line 3

def v1
  @v1
end

Instance Method Details

#check_proper_initObject



18
19
20
21
22
23
# File 'lib/v1gittools/base_tool.rb', line 18

def check_proper_init
  if @config[:github] && @config[:github][:oauth_token] == 'AUTOGENERATE'
    puts "v1git has not been setup for this repository yet. Please run #{$0} init to initialize and setup v1git."
    exit
  end
end