Class: Txgh::Puller

Inherits:
Object
  • Object
show all
Defined in:
lib/txgh/puller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, repo, branch = nil) ⇒ Puller

Returns a new instance of Puller.



5
6
7
8
9
# File 'lib/txgh/puller.rb', line 5

def initialize(project, repo, branch = nil)
  @project = project
  @repo = repo
  @branch = branch
end

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



3
4
5
# File 'lib/txgh/puller.rb', line 3

def branch
  @branch
end

#projectObject (readonly)

Returns the value of attribute project.



3
4
5
# File 'lib/txgh/puller.rb', line 3

def project
  @project
end

#repoObject (readonly)

Returns the value of attribute repo.



3
4
5
# File 'lib/txgh/puller.rb', line 3

def repo
  @repo
end

Instance Method Details

#pullObject



11
12
13
14
15
16
17
18
19
# File 'lib/txgh/puller.rb', line 11

def pull
  tx_config.resources.each do |tx_resource|
    if repo.process_all_branches?
      tx_resource = Txgh::TxBranchResource.new(tx_resource, branch)
    end

    pull_resource(tx_resource)
  end
end

#pull_resource(tx_resource) ⇒ Object



21
22
23
24
25
# File 'lib/txgh/puller.rb', line 21

def pull_resource(tx_resource)
  each_language do |language_code|
    committer.commit_resource(tx_resource, branch, language_code)
  end
end

#pull_slug(resource_slug) ⇒ Object



27
28
29
# File 'lib/txgh/puller.rb', line 27

def pull_slug(resource_slug)
  pull_resource(tx_config.resource(resource_slug, branch))
end