gtm-cli 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: d33c477b1a0829f87dc731c10bcf25632f881aba
4
- data.tar.gz: e88ad2a17d6c9df48141fdfbbaed1156d4b56b20
3
+ metadata.gz: 2c047bae5ddfc6e9475e4ad9611ad46a64e14a46
4
+ data.tar.gz: 7a44329332547d4e3c0cfb479d9ec7e8d5b7f75a
5
5
  SHA512:
6
- metadata.gz: 331ebdc7a110bc34154d7a8f579014ea4ec1763895b1e7bc87d4add088b1cdb9f0fc9ed0282de9aa7318f5ad70be28ccef5090fee9469ab6d58d9fc0fd575ccd
7
- data.tar.gz: 43746904954f1c099b0f755bc0516421d8c6b92cb8718eb9bb2fb19f5ffff232e390a33012ad94ac98c372f19d39a22581fba43f1c70f0b0ae4fabd22c00bbfc
6
+ metadata.gz: 9154a8e41698513cd6782f3e122c4032ac74d5a099f236fd14f7d4bf0c1aa2937a9abc06256777eeb3fbd8f53b0df9fc6be8b354e48691b5f6705f8a1ea7560d
7
+ data.tar.gz: f9d15782db7628ac7be37a5cb9f26a07b0a83d0fd66be2508fd79570bff8193a1765544cb4265ac6fb8f9847dfa2eed11843fa6a1ac3b19f7edf59407821af80
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gtm (0.0.9)
4
+ gtm-cli (0.1.1)
5
5
  activesupport (~> 4.1)
6
6
  commander (~> 4.2)
7
7
  google-api-client (~> 0.8)
@@ -26,7 +26,7 @@ GEM
26
26
  celluloid (0.16.0)
27
27
  timers (~> 4.0.0)
28
28
  coderay (1.1.0)
29
- commander (4.3.4)
29
+ commander (4.3.5)
30
30
  highline (~> 1.7.2)
31
31
  diff-lcs (1.2.5)
32
32
  extlib (0.9.16)
@@ -66,7 +66,7 @@ GEM
66
66
  guard (~> 2.1)
67
67
  guard-compat (~> 1.1)
68
68
  rspec (>= 2.99.0, < 4.0)
69
- highline (1.7.2)
69
+ highline (1.7.8)
70
70
  hitimes (1.2.2)
71
71
  i18n (0.7.0)
72
72
  json (1.8.2)
@@ -146,7 +146,10 @@ DEPENDENCIES
146
146
  activesupport
147
147
  bundler (~> 1.6)
148
148
  google-api-client
149
- gtm!
149
+ gtm-cli!
150
150
  guard-rspec (~> 4.5)
151
151
  rake (~> 10.3)
152
152
  rubocop (~> 0.26)
153
+
154
+ BUNDLED WITH
155
+ 1.10.6
data/lib/gtm/bootstrap.rb CHANGED
@@ -34,7 +34,7 @@ module GTM
34
34
  push = GTM::Push.new @client
35
35
  push.run
36
36
  else
37
- puts 'pleas specify a single tag file, directory push is not supported (yet)'
37
+ print 'pleas specify a single tag file, directory push is not supported (yet)'
38
38
  end
39
39
  end
40
40
 
data/lib/gtm/client.rb CHANGED
@@ -38,7 +38,7 @@ module GTM
38
38
  raise GTM::AuthException if result.data['error'] && result.data.error['code']
39
39
  @accounts = result.data.accounts
40
40
  yield @accounts
41
- puts 'DONE'
41
+ print 'DONE'
42
42
  rescue AuthException
43
43
  client_secrets = Google::APIClient::ClientSecrets.load
44
44
  flow = Google::APIClient::InstalledAppFlow.new(
data/lib/gtm/pull.rb CHANGED
@@ -74,19 +74,19 @@ module GTM
74
74
  print "pulling tags from account #{container['accountId']} into #{tags_path} "
75
75
  tags.each do |tag|
76
76
  tag_name = tag['name'].parameterize.underscore
77
- if tag.parameter.last && tag.parameter.last.type.eql?('template') && tag.parameter.last.key.in?(%w(html))
78
- template = tag.parameter.last
79
- File.open("#{tags_path}/#{tag_name}.#{template.key}", 'w') do |f|
80
- f.write template.value
77
+ html_parameter = tag.parameter.select { |p| p.key.eql? 'html' }.first
78
+ if html_parameter
79
+ File.open("#{tags_path}/#{tag_name}.#{html_parameter.key}", 'w') do |f|
80
+ f.write html_parameter.value
81
81
  end
82
82
  data = Marshal.dump(tag.to_hash)
83
- File.open("#{meta_tags_path}/#{tag_name}.#{template.key}.dump", 'w') do |f|
83
+ File.open("#{meta_tags_path}/#{tag_name}.#{html_parameter.key}.dump", 'w') do |f|
84
84
  f.write data
85
85
  end
86
86
  print '.'
87
87
  end
88
88
  end
89
- puts '[OK]'
89
+ print '[OK]'
90
90
  end
91
91
  end
92
92
  end
data/lib/gtm/push.rb CHANGED
@@ -18,7 +18,9 @@ module GTM
18
18
  tag = Marshal.load(data)
19
19
  tag_content = File.read("#{@client.scope[:path]}#{tag_file}")
20
20
  body = tag
21
- body['parameter'].last['value'] = tag_content
21
+ body['parameter'].each do |parameter|
22
+ parameter['value'] = tag_content if parameter['key'].eql?('html')
23
+ end
22
24
  @client.run do |_accounts|
23
25
  print "pushing tag #{"#{@client.scope[:path]}#{tag_file}"} for account #{tag['accountId']} into container #{tag['containerId']} "
24
26
  result = @client.client.execute(
@@ -30,7 +32,7 @@ module GTM
30
32
  },
31
33
  body_object: body
32
34
  )
33
- puts '[OK]'
35
+ print '[OK]'
34
36
  end
35
37
  end
36
38
  end
data/lib/gtm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GTM
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtm-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Dudda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.4.6
154
+ rubygems_version: 2.5.0
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: GTM Cli