web_translate_it 2.5.3 → 2.5.4

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: 2f4da4e145e768d5dcebc04cb085be79182fa33af33ce4d5fa0b0c1598cef7b4
4
- data.tar.gz: d565be12c309530ef0e55b1090804f5e1137b1f327bc08e278477448a4076701
3
+ metadata.gz: bc4a1374f3018354d15fea035305984fa839a6786526cc88e8d3151f176d8f79
4
+ data.tar.gz: fbc8868713a8d691169eea12318bb0c288853c25cedf24ddaaac10b44b461d09
5
5
  SHA512:
6
- metadata.gz: c47cbf387a3557e67ea5d948a2a226d380bb60d3bc9b53755ab858d9ec3f315ae64737d9681c1a3fc4bc5ef29a23a93751ea710dce10576ec2ddfdcc0cd58b47
7
- data.tar.gz: 85abf263f0112367bd8f5ae8af8d22e5cb2bdebbb4c31dcc532602b245f389999912bbad8869db0fcf870b7a5e02c7c3000e6fbb9fb89f8221a0ca94eaaeb371
6
+ metadata.gz: c8ec5eae4ac2941ca048cc798fb4ae5cb5c539345d11286d9aa35a68dca5e35cc3e138cbcb95c0ebf5d8adaffda69938cf41613762612a9ba33836e6f95f2871
7
+ data.tar.gz: 20af38470f30300f01d260e17d15d16ef90597b72d5e1e5f5d9869cf70a192c65d84f3dc9771ada30264f65c75ebfb0855da9b9f0e94e966cfc908cc872b3eda
data/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 2.5.4 / 2022-03-08
2
+
3
+ * Better support for `before_pull`, `after_pull`, `before_push`, `after_push` hooks. They now display the command output, and write an error message if the exit status of the command was not successful.
4
+
1
5
  ## Version 2.5.3 / 2022-02-04
2
6
 
3
7
  * Properly fix ruby compatibility issues.
@@ -36,7 +36,7 @@ module WebTranslateIt
36
36
  def pull
37
37
  complete_success = true
38
38
  STDOUT.sync = true
39
- `#{configuration.before_pull}` if configuration.before_pull
39
+ before_pull_hook
40
40
  # Selecting files to pull
41
41
  files = []
42
42
  fetch_locales_to_pull.each do |locale|
@@ -70,15 +70,37 @@ module WebTranslateIt
70
70
  threads.each { |thread| thread.join }
71
71
  time = Time.now - time
72
72
  puts "Pulled #{files.size} files at #{(files.size/time).round} files/sec, using #{n_threads} threads."
73
- `#{configuration.after_pull}` if configuration.after_pull
73
+ after_pull_hook
74
74
  complete_success
75
75
  end
76
76
  end
77
-
77
+
78
+ def before_pull_hook
79
+ if configuration.before_pull
80
+ output = `#{configuration.before_pull}`
81
+ if $?.success?
82
+ puts output
83
+ else
84
+ abort 'Error: exit code for before_pull command is not zero'
85
+ end
86
+ end
87
+ end
88
+
89
+ def after_pull_hook
90
+ if configuration.after_pull
91
+ output = `#{configuration.after_pull}`
92
+ if $?.success?
93
+ puts output
94
+ else
95
+ abort 'Error: exit code for after_pull command is not zero'
96
+ end
97
+ end
98
+ end
99
+
78
100
  def push
79
101
  complete_success = true
80
102
  STDOUT.sync = true
81
- `#{configuration.before_push}` if configuration.before_push
103
+ before_push_hook
82
104
  WebTranslateIt::Connection.new(configuration.api_key) do |http|
83
105
  fetch_locales_to_push(configuration).each do |locale|
84
106
  if parameters.any?
@@ -96,9 +118,31 @@ module WebTranslateIt
96
118
  end
97
119
  end
98
120
  end
99
- `#{configuration.after_push}` if configuration.after_push
121
+ after_push_hook
100
122
  complete_success
101
123
  end
124
+
125
+ def before_push_hook
126
+ if configuration.before_push
127
+ output = `#{configuration.before_push}`
128
+ if $?.success?
129
+ puts output
130
+ else
131
+ abort 'Error: exit code for before_push command is not zero'
132
+ end
133
+ end
134
+ end
135
+
136
+ def after_push_hook
137
+ if configuration.after_push
138
+ output = `#{configuration.after_push}`
139
+ if $?.success?
140
+ puts output
141
+ else
142
+ abort 'Error: exit code for after_push command is not zero'
143
+ end
144
+ end
145
+ end
102
146
 
103
147
  def add
104
148
  complete_success = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Briere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-04 00:00:00.000000000 Z
11
+ date: 2022-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
- rubygems_version: 3.0.9
158
+ rubygems_version: 3.1.6
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: A CLI to sync locale files with WebTranslateIt.com.