txbr 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a26e4fcc27b8a68d3fa2d1460aafaf08966ee6aeaf7a8d16745e79c509955c3
4
- data.tar.gz: 10d380377a107dd01c46489870abb21b6fc663d018f3ce88b10670d1f377262f
3
+ metadata.gz: fd81fe81e5e0d795e842a3cf75c4277d0ba5e7211214596d2755835994d27435
4
+ data.tar.gz: 6a40e039b54a45ba5271525dbc27fea9294eadc7d0580e38f87c3f1d8579f6aa
5
5
  SHA512:
6
- metadata.gz: 53f0538ee6675d79068528bf834b2df19996f21d1e4c0c731a1cae9b19ee9eccdd5ddb4b6981dd0c68b53dcff6eabe95654037308cecf3a65f6543390f89fa45
7
- data.tar.gz: cfddc02280c8c413c4f4a8b0f8f389fc2358b35cdf8940dd149ba7dbab5b6b6013174af205dbf9bad5965d5e14d3b571c0d1d7d5a883a6313a05165ed4f9177a
6
+ metadata.gz: 6d314adee43b7c9450db5a230e6e8b3a35205ed764f102f875c9967e01205e8d19bef938715d64aa1c065f91b7cf9a7a014733e14eff6c0b711a004f58e4a363
7
+ data.tar.gz: bbf37aa158dd6c518c472f7f10214648c1c6496437ba9373e14e52fe987c196d42738dc9d639c637d68c796cd6eb67e2cced94f3b5b3c755757e95accedd477d
@@ -25,6 +25,10 @@ module Txbr
25
25
  end
26
26
  end
27
27
 
28
+ def contains_translations?
29
+ metadata.project_slug && metadata.resource_slug && metadata.prefix
30
+ end
31
+
28
32
  private
29
33
 
30
34
  def extract_strings_from(root, manifest)
data/lib/txbr/metadata.rb CHANGED
@@ -5,9 +5,9 @@ module Txbr
5
5
  attr_reader :project_slug, :resource_slug, :prefix
6
6
 
7
7
  def initialize(options = {})
8
- @project_slug = options.fetch('project_slug')
9
- @resource_slug = options.fetch('resource_slug')
10
- @prefix = options.fetch('prefix')
8
+ @project_slug = options['project_slug']
9
+ @resource_slug = options['resource_slug']
10
+ @prefix = options['prefix']
11
11
  end
12
12
 
13
13
  def ==(other)
@@ -38,6 +38,10 @@ module Txbr
38
38
 
39
39
  alias each_string each
40
40
 
41
+ def empty?
42
+ @strings.empty?
43
+ end
44
+
41
45
  private
42
46
 
43
47
  def each_helper(root, path, &block)
data/lib/txbr/template.rb CHANGED
@@ -38,8 +38,9 @@ module Txbr
38
38
  end
39
39
 
40
40
  def content_tags
41
- @content_tags ||= connected_content_tags.map do |tag|
42
- ContentTag.new(liquid_template, tag)
41
+ @content_tags ||= connected_content_tags.each_with_object([]) do |tag, ret|
42
+ tag = ContentTag.new(liquid_template, tag)
43
+ ret << tag if tag.contains_translations?
43
44
  end
44
45
  end
45
46
 
@@ -19,7 +19,7 @@ module Txbr
19
19
  manifest.merge(content_tag.strings_manifest)
20
20
  end
21
21
 
22
- yield to_resource(metadata, strings)
22
+ yield to_resource(metadata, strings) unless strings.empty?
23
23
  end
24
24
  end
25
25
 
data/lib/txbr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Txbr
2
- VERSION = '2.4.0'
2
+ VERSION = '2.4.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: txbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro