Class: Lokale::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/lokale.rb,
lib/lokale/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Action

Returns a new instance of Action.



9
10
11
# File 'lib/lokale/config.rb', line 9

def initialize(type)
  @type = type
end

Instance Attribute Details

#argObject

Returns the value of attribute arg.



7
8
9
# File 'lib/lokale/config.rb', line 7

def arg
  @arg
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/lokale/config.rb', line 7

def type
  @type
end

Class Method Details

.add_to_projObject



19
# File 'lib/lokale/config.rb', line 19

def self.add_to_proj;      Action.new(:add_to_proj)     end

.appendObject



15
# File 'lib/lokale/config.rb', line 15

def self.append;           Action.new(:append)          end

.copy_baseObject



14
# File 'lib/lokale/config.rb', line 14

def self.copy_base;        Action.new(:copy_base)       end

.create_configObject



18
# File 'lib/lokale/config.rb', line 18

def self.create_config;    Action.new(:create_config)   end

.exportObject



16
# File 'lib/lokale/config.rb', line 16

def self.export;           Action.new(:export)          end

.importObject



17
# File 'lib/lokale/config.rb', line 17

def self.import;           Action.new(:import)          end

.summaryObject



13
# File 'lib/lokale/config.rb', line 13

def self.summary;          Action.new(:summary)         end

Instance Method Details

#perform(agent, reporter) ⇒ Object



15
16
17
# File 'lib/lokale.rb', line 15

def perform(agent, reporter)
  send(("perform_" + @type.to_s).to_sym, agent, reporter)
end

#perform_add_to_proj(agent, reporter) ⇒ Object



49
50
51
52
# File 'lib/lokale.rb', line 49

def perform_add_to_proj(agent, reporter)
  print "Creating project file...".blue
  agent.write_to_project_file
end

#perform_append(agent, reporter) ⇒ Object



29
30
31
32
# File 'lib/lokale.rb', line 29

def perform_append(agent, reporter)
  print "Appending new macro calls to localization files...".blue
  agent.append_new_macro_calls
end

#perform_copy_base(agent, reporter) ⇒ Object



24
25
26
27
# File 'lib/lokale.rb', line 24

def perform_copy_base(agent, reporter)
  print "Copying `en` strings files to `Base`...".blue
  agent.copy_base
end

#perform_create_config(agent, reporter) ⇒ Object



44
45
46
47
# File 'lib/lokale.rb', line 44

def perform_create_config(agent, reporter)
  print "Creating config file...".blue
  Config.get.create_default_file
end

#perform_export(agent, reporter) ⇒ Object



34
35
36
37
# File 'lib/lokale.rb', line 34

def perform_export(agent, reporter)
  print "Preparing xliff files with new localized strings...".blue
  agent.export_xliffs
end

#perform_import(agent, reporter) ⇒ Object



39
40
41
42
# File 'lib/lokale.rb', line 39

def perform_import(agent, reporter)
  print "Attempting to import new strings...".blue
  agent.try_to_import
end

#perform_summary(agent, reporter) ⇒ Object



19
20
21
22
# File 'lib/lokale.rb', line 19

def perform_summary(agent, reporter)
  print "Printing summary...".blue
  reporter.print_summary
end


11
12
13
# File 'lib/lokale.rb', line 11

def print(str)
  puts str.blue
end