Module: Fbgen

Defined in:
lib/football-sources/process.rb

Defined Under Namespace

Classes: Job

Class Method Summary collapse

Class Method Details

.process(datasets, source:, download: false, push: false) ⇒ Object

change download? to cache - true/false - why? why not?

change push: to sync - true/false - why? why not?


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/football-sources/process.rb', line 40

def self.process( datasets,
                     source:,
                     download: false,
                     push:     false )

  Job.download( datasets, source: source )   if download

  ## always pull before push!! (use fast_forward)
  gh = SportDb::GitHubSync.new( datasets )
  gh.git_fast_forward_if_clean    if push


  Job.convert( datasets, source: source )

  if push
    Writer.config.out_dir = SportDb::GitHubSync.root   # e.g. "/sports/openfootball"
  else
    ##  fix/fix - use default - do not (re)set here - why? why not?
    Writer.config.out_dir = './tmp'
  end

  Writer::Job.write( datasets,
                     source: source.config.convert.out_dir )

  ## todo/fix: add a getch or something to hit return before commiting pushing - why? why not?
  gh.git_push_if_changes     if push
end