Class: Fastlane::Helper::StandardMetadataBlock
- Inherits:
-
MetadataBlock
show all
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb,
lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb
Instance Attribute Summary collapse
#block_key
Instance Method Summary
collapse
Constructor Details
#initialize(block_key, content_file_path) ⇒ StandardMetadataBlock
Returns a new instance of StandardMetadataBlock.
31
32
33
34
|
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb', line 31
def initialize(block_key, content_file_path)
super(block_key)
@content_file_path = content_file_path
end
|
Instance Attribute Details
#content_file_path ⇒ Object
Returns the value of attribute content_file_path.
29
30
31
|
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb', line 29
def content_file_path
@content_file_path
end
|
Instance Method Details
#generate_block(fw) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb', line 46
def generate_block(fw)
fw.puts("msgctxt \"#{@block_key}\"")
line_count = File.foreach(@content_file_path).inject(0) { |c, _line| c + 1 }
if line_count <= 1
fw.puts("msgid \"#{File.open(@content_file_path, 'r').read}\"")
else
fw.puts('msgid ""')
sf = File.open(@content_file_path, 'r').to_a
sf.each do |line|
l = "\"#{line.strip}"
l << '\\n' unless line == sf.last
l << '"'
fw.puts(l)
end
end
fw.puts('msgstr ""')
fw.puts('')
end
|
#handle_line(fw, line) ⇒ Object
40
41
42
43
44
|
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb', line 40
def handle_line(fw, line)
generate_block(fw) if line.start_with?('msgctxt')
end
|
#is_handler_for(key) ⇒ Object
36
37
38
|
# File 'lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb', line 36
def is_handler_for(key)
key == @block_key.to_s
end
|