Class: Cejo::Projects::ProjectInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/cejo/projects/project_info.rb

Overview

Project Information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(folders, info) ⇒ ProjectInfo

Returns a new instance of ProjectInfo.



12
13
14
15
# File 'lib/cejo/projects/project_info.rb', line 12

def initialize(folders, info)
  @main_config = folders.cejo_config
  @info = info
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



10
11
12
# File 'lib/cejo/projects/project_info.rb', line 10

def info
  @info
end

#local_folderObject (readonly)

Returns the value of attribute local_folder.



10
11
12
# File 'lib/cejo/projects/project_info.rb', line 10

def local_folder
  @local_folder
end

#main_configObject (readonly)

Returns the value of attribute main_config.



10
11
12
# File 'lib/cejo/projects/project_info.rb', line 10

def main_config
  @main_config
end

#utilsObject (readonly)

Returns the value of attribute utils.



10
11
12
# File 'lib/cejo/projects/project_info.rb', line 10

def utils
  @utils
end

Instance Method Details

#commandsObject



37
38
39
# File 'lib/cejo/projects/project_info.rb', line 37

def commands
  info[:commands]
end

#folderObject



17
18
19
# File 'lib/cejo/projects/project_info.rb', line 17

def folder
  Pathname.new(Dir.home).join('Builds', name)
end

#main_branchObject



45
46
47
# File 'lib/cejo/projects/project_info.rb', line 45

def main_branch
  info[:default]
end

#nameObject



21
22
23
# File 'lib/cejo/projects/project_info.rb', line 21

def name
  info[:name]
end

#patchObject



33
34
35
# File 'lib/cejo/projects/project_info.rb', line 33

def patch
  info[:patch]
end

#patchesObject

Folder with all patches available



56
57
58
# File 'lib/cejo/projects/project_info.rb', line 56

def patches
  main_config.join('patches').join name
end

#purgeObject



41
42
43
# File 'lib/cejo/projects/project_info.rb', line 41

def purge
  info[:purge]
end

#repositoryObject



49
50
51
52
53
# File 'lib/cejo/projects/project_info.rb', line 49

def repository
  require 'git'

  Git.open folder
end

#tagObject



29
30
31
# File 'lib/cejo/projects/project_info.rb', line 29

def tag
  info[:tag]
end

#to_sObject



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/cejo/projects/project_info.rb', line 60

def to_s
  <<~INFO
    ❯ Building Project

    Name: #{name.capitalize}
    Url: #{url}
    Default: #{main_branch}
    Tag: #{tag}
    Patch: #{patch}
    Folder: #{folder}
  INFO
end

#urlObject



25
26
27
# File 'lib/cejo/projects/project_info.rb', line 25

def url
  info[:url]
end