Class: Gitloggl::Commands::Sync

Inherits:
Gitloggl::Command show all
Defined in:
lib/gitloggl/commands/sync.rb

Instance Attribute Summary collapse

Attributes inherited from Gitloggl::Command

#back, #options

Instance Method Summary collapse

Methods inherited from Gitloggl::Command

#back?, #capture_back, #command, #config, #cursor, #editor, #exec_exist?, #generator, #initialize, #menu_back, #pager, #pastel, #platform, #prompt, #render_table, #screen, #verbose?, #which

Constructor Details

This class inherits a constructor from Gitloggl::Command

Instance Attribute Details

#date_fromObject

Returns the value of attribute date_from.



6
7
8
# File 'lib/gitloggl/commands/sync.rb', line 6

def date_from
  @date_from
end

#date_toObject

Returns the value of attribute date_to.



6
7
8
# File 'lib/gitloggl/commands/sync.rb', line 6

def date_to
  @date_to
end

#gitlab_barObject

Returns the value of attribute gitlab_bar.



7
8
9
# File 'lib/gitloggl/commands/sync.rb', line 7

def gitlab_bar
  @gitlab_bar
end

#integrationObject

Returns the value of attribute integration.



6
7
8
# File 'lib/gitloggl/commands/sync.rb', line 6

def integration
  @integration
end

#toggl_barObject

Returns the value of attribute toggl_bar.



7
8
9
# File 'lib/gitloggl/commands/sync.rb', line 7

def toggl_bar
  @toggl_bar
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gitloggl/commands/sync.rb', line 9

def execute
  if integrations.empty?
    puts pastel.yellow('Please add integration first')
    return back.call
  end

  self.integration = select_integration
  self.date_from, self.date_to = select_dates

  setup_toggl_hooks
  setup_gitlab_hooks

  toggl.run

  print_tables
end