Class: Locca::Locca

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

Instance Method Summary collapse

Instance Method Details

#build(project) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/locca.rb', line 61

def build(project)
    if not project
        raise 'Can\'t initialize Locca with nil project'
    end

    build_action(project).execute()
end

#build_action(project) ⇒ Object



103
104
105
# File 'lib/locca.rb', line 103

def build_action(project)
    return BuildAction.new(project, project.collection_builder(), project.collection_writer(), project.collections_generator(), collection_merger())
end

#collection_mergerObject



113
114
115
# File 'lib/locca.rb', line 113

def collection_merger()
    return CollectionMerger.new()
end

#fetch(project) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/locca.rb', line 82

def fetch(project)
    if not project
        raise 'Can\'t initialize Locca with nil project'
    end
    
    one_sky_action(project).fetch()
end

#merge(src_file, dst_file) ⇒ Object



69
70
71
72
# File 'lib/locca.rb', line 69

def merge(src_file, dst_file)
    action = MergeAction.new(src_file, dst_file, collection_builder(), collection_writer(), collection_merger())
    action.execute()
end

#one_sky_action(project) ⇒ Object



107
108
109
110
111
# File 'lib/locca.rb', line 107

def one_sky_action(project)
    onesky = Onesky.new(project.config_value_for_key('onesky_project_id'), project.config_value_for_key('onesky_public_key'), project.config_value_for_key('onesky_secret_key'))

    return OneskySyncAction.new(project, onesky, project.collection_builder(), project.collection_writer(), project.collections_generator(), collection_merger())
end

#sync(project, prune_missing_strings = false) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/locca.rb', line 74

def sync(project, prune_missing_strings = false)
    if not project
        raise 'Can\'t initialize Locca with nil project'
    end
    
    one_sky_action(project).sync(prune_missing_strings)
end

#translate(project, lang = nil) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/locca.rb', line 90

def translate(project, lang = nil)
    if not project
        raise 'Can\'t initialize Locca with nil project'
    end

    if not lang
        lang = project.base_lang
    end

    action = TranslateAction.new(project, lang, project.collection_builder, project.collection_writer, collection_merger())
    action.execute()
end