Class: Cejo::Floss::Main

Inherits:
Object
  • Object
show all
Defined in:
lib/cejo/floss/main.rb

Overview

Core Management FLOSS Projects

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(folders, utils, command) ⇒ Main

Returns a new instance of Main.



12
13
14
15
16
# File 'lib/cejo/floss/main.rb', line 12

def initialize(folders, utils, command)
  @folders = folders
  @utils = utils
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



10
11
12
# File 'lib/cejo/floss/main.rb', line 10

def command
  @command
end

#foldersObject (readonly)

Returns the value of attribute folders.



10
11
12
# File 'lib/cejo/floss/main.rb', line 10

def folders
  @folders
end

#servicesObject (readonly)

Returns the value of attribute services.



10
11
12
# File 'lib/cejo/floss/main.rb', line 10

def services
  @services
end

#utilsObject (readonly)

Returns the value of attribute utils.



10
11
12
# File 'lib/cejo/floss/main.rb', line 10

def utils
  @utils
end

Instance Method Details

#archiveObject



35
36
37
38
39
# File 'lib/cejo/floss/main.rb', line 35

def archive
  process_projects do |info|
    Archive.new(utils, info.name, info.folder, info.to_s).run
  end
end

#grabObject



42
43
44
45
46
# File 'lib/cejo/floss/main.rb', line 42

def grab
  process_projects do |info|
    Grab.new(utils, info.folder, info.url, info.to_s).run
  end
end

#parsed_projectsObject



18
19
20
21
# File 'lib/cejo/floss/main.rb', line 18

def parsed_projects
  folder = folders.cejo_config.join 'floss'
  utils.parse_folder folder
end

#process_projectsObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cejo/floss/main.rb', line 23

def process_projects
  parsed_projects.each do |language, projects|
    puts "\n❯ #{language.capitalize}"
    puts

    projects.each do |url|
      project_info = ProjectInfo.new url, language.to_s
      yield project_info
    end
  end
end

#runObject



49
50
51
# File 'lib/cejo/floss/main.rb', line 49

def run
  public_send(command)
end