Class: BuPr::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/bu_pr/runner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Runner

Returns a new instance of Runner.

Parameters:

  • opts (Hash) (defaults to: {})

See Also:



22
23
24
25
# File 'lib/bu_pr/runner.rb', line 22

def initialize opts = {}
  @git    = Git.new
  @config = Configuration.new opts
end

Instance Attribute Details

#configBuPr::Configuration (readonly)

Returns:



18
19
20
# File 'lib/bu_pr/runner.rb', line 18

def config
  @config
end

#gitBuPr::Git (readonly)

Returns:



17
18
19
# File 'lib/bu_pr/runner.rb', line 17

def git
  @git
end

Class Method Details

.call(opts = {}) ⇒ Object

Parameters:

  • opts (Hash) (defaults to: {})

See Also:



12
13
14
# File 'lib/bu_pr/runner.rb', line 12

def call opts = {}
  new(opts).call
end

Instance Method Details

#bundle_updateBoolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/bu_pr/runner.rb', line 41

def bundle_update
  valid? && _bundle_update
end

#callObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/bu_pr/runner.rb', line 27

def call
  if bundle_update && !git.diff?
    puts "no update"
    return
  end

  git.push

  Handlers::Github.call \
    config:         config,
    current_branch: git.current_branch
end

#valid?Boolean



48
49
50
# File 'lib/bu_pr/runner.rb', line 48

def valid?
  check_config! && check_git!
end