web_translate_it 2.2.0 → 2.2.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
  SHA1:
3
- metadata.gz: 83685baa1186e0e541843f709812ab2742f2b7fa
4
- data.tar.gz: c576acecd80cdf48f78b018ae13dd86d1aefc424
3
+ metadata.gz: 255cee3843737732023933b96f1139214af761e2
4
+ data.tar.gz: 39a4ad19cd6ffa90b0316f9e17de1e560f45b34d
5
5
  SHA512:
6
- metadata.gz: eb89f5166efde65e05884f08d6ede6dd704d6487acfcb8b4ded4d6c6528e8a01870fc506a6179ceaf28b4dafcd4a4dc7bdcc8c3802a45ac22afd8095a9a8b081
7
- data.tar.gz: 0d3992a10b8a5e6882e1cce2cf1592bc4bb2d70be7ded1dc79ed203b12a43c2f7135de82dfd16848ef5f03a92fa2e2bc1bbaae25518bd6cae1b8a89215e595b1
6
+ metadata.gz: d0779b7176c462a30efbd7cf412c4e924247b28577ff3481abda2794121c0bf183e1f806992a1c7a5cf839d074e15e8486f637623067fc250af930436c704eed
7
+ data.tar.gz: 3865f41d37f0d1436db49c4bdd579db5fe58817d7db99bf6cb3959fab5c74799520283c4ac856cd36418f8750d3448ed3e53084756b6306541f30dfa0a2d866a
data/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 2.2.1 / 2014-01-16
2
+
3
+ * New configuration option: `needed_locale`: an array containing all the locales you want to sync with WebTranslateIt. #110
4
+
1
5
  ## Version 2.2.0 / 2014-01-10
2
6
 
3
7
  * Update dependencies.
@@ -246,8 +246,14 @@ module WebTranslateIt
246
246
  end
247
247
  locales = command_options.locale.split
248
248
  else
249
- locales = configuration.target_locales
250
- configuration.ignore_locales.each{ |locale_to_delete| locales.delete(locale_to_delete) }
249
+ if configuration.needed_locales.any?
250
+ locales = configuration.needed_locales
251
+ else
252
+ locales = configuration.target_locales
253
+ if configuration.ignore_locales.any?
254
+ configuration.ignore_locales.each{ |locale_to_delete| locales.delete(locale_to_delete) }
255
+ end
256
+ end
251
257
  end
252
258
  locales.push(configuration.source_locale) if command_options.all
253
259
  return locales.uniq
@@ -293,11 +299,14 @@ module WebTranslateIt
293
299
  file = <<-FILE
294
300
  api_key: #{api_key}
295
301
 
296
- # Optional: locales not to sync with Web Translate It.
302
+ # Optional: locales not to sync with WebTranslateIt.
297
303
  # Takes a string, a symbol, or an array of string or symbol.
298
304
  # More information here: https://github.com/AtelierConvivialite/webtranslateit/wiki
299
305
  # ignore_locales: '#{project_info["source_locale"]["code"]}'
300
306
 
307
+ # Or if you prefer a list of locales to sync with WebTranslateIt:
308
+ # needed_locales: #{project_info["target_locales"].map {|locale| locale["code"]}.to_s}
309
+
301
310
  # Optional
302
311
  # before_pull: "echo 'some unix command'" # Command executed before pulling files
303
312
  # after_pull: "touch tmp/restart.txt" # Command executed after pulling files
@@ -10,7 +10,7 @@ module WebTranslateIt
10
10
  class Configuration
11
11
  require 'yaml'
12
12
  require 'fileutils'
13
- attr_accessor :path, :api_key, :source_locale, :target_locales, :files, :ignore_locales
13
+ attr_accessor :path, :api_key, :source_locale, :target_locales, :files, :ignore_locales, :needed_locales
14
14
  attr_accessor :logger, :before_pull, :after_pull, :before_push, :after_push, :project_name
15
15
 
16
16
  # Load configuration file from the path.
@@ -26,6 +26,7 @@ module WebTranslateIt
26
26
  self.after_push = configuration['after_push']
27
27
  project_info = YAML.load WebTranslateIt::Project.fetch_info(api_key)
28
28
  set_locales_to_ignore(configuration)
29
+ set_locales_needed(configuration)
29
30
  set_files(project_info['project'])
30
31
  set_locales(project_info['project'])
31
32
  self.project_name = project_info['project']['name']
@@ -65,6 +66,11 @@ module WebTranslateIt
65
66
  def set_locales_to_ignore(configuration)
66
67
  self.ignore_locales = Array(configuration['ignore_locales']).map{ |locale| locale.to_s }
67
68
  end
69
+
70
+ # Set locales to specifically pull from the configuration file, if set
71
+ def set_locales_needed(configuration)
72
+ self.needed_locales = Array(configuration['needed_locales']).map{ |locale| locale.to_s }
73
+ end
68
74
 
69
75
  # Convenience method which returns the endpoint for fetching a list of locales for a project.
70
76
  def api_url
data/license CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2009-2013 Atelier Convivialite
3
+ Copyright (c) 2009-2014 Atelier Convivialite
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
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.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Briere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-10 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post