web_translate_it 2.3.0 → 2.3.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: 5f850423c63c38bfb19c8964537117760adaf945
4
- data.tar.gz: 0bbe10898bf3f7bf64f62690a07ac89bc530ed1f
3
+ metadata.gz: 1bdcd0cd4aade89d74fde98a60a41426ccf84f1b
4
+ data.tar.gz: 6a75a120a3cbcd3b4bbca2481ae3f6dd0ab6b233
5
5
  SHA512:
6
- metadata.gz: f1353e6125cd781d3fc87e7d8b989ec8b206432e78d6b3a4036ed79ffb4d57c34af900aac154ff5ceb11422fab7070ee84855049296b6e1e84257c680f216456
7
- data.tar.gz: 1b7076d8fcc3c12b189cae121815378536498c3468756cb2a843bd41884ff717dda1c9dfa8f0f1819bbd679da423377656556f1f375dc4d1e1f32506ad6ebb17
6
+ metadata.gz: 9a94f470ae6fa25ee9431b4c7f59d0fbde967897d0998cf61ec5fbc3855a71cb7374ee5ddf0fe4ad4e5eb7197295a8188c80de845a5089f4a0eee1501253b78a
7
+ data.tar.gz: 58cca903874466f756ee2dfee217e2d67dce2e2d65022c3b89d72b0fc80ec60cbe6438395ec12a949acdd33cacb1c4c326b5c270c6da4ab26d433a63be26e98c
data/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 2.3.1 / 2014-05-07
2
+
3
+ * The `.wti` configuration file is now parsed by ERB so the API token can be stored in an environment variable instead of in the `.wti` file. #118
4
+
1
5
  ## Version 2.3.0 / 2014-04-18
2
6
 
3
7
  * Deprecate `wti push --all`.
@@ -10,15 +10,16 @@ module WebTranslateIt
10
10
  class Configuration
11
11
  require 'yaml'
12
12
  require 'fileutils'
13
+ require 'erb'
13
14
  attr_accessor :path, :api_key, :source_locale, :target_locales, :files, :ignore_locales, :needed_locales
14
- attr_accessor :logger, :before_pull, :after_pull, :before_push, :after_push, :project_name
15
+ attr_accessor :logger, :before_pull, :after_pull, :before_push, :after_push, :project_name, :path_to_config_file
15
16
 
16
17
  # Load configuration file from the path.
17
18
  def initialize(root_path = Rails.root, path_to_config_file = ".wti")
19
+ self.path_to_config_file = path_to_config_file
18
20
  self.path = root_path
19
21
  self.logger = logger
20
22
  if File.exists?(File.expand_path(path_to_config_file, self.path))
21
- configuration = YAML.load_file(File.expand_path(path_to_config_file, self.path))
22
23
  self.api_key = configuration['api_key']
23
24
  self.before_pull = configuration['before_pull']
24
25
  self.after_pull = configuration['after_pull']
@@ -85,5 +86,15 @@ module WebTranslateIt
85
86
  RAILS_DEFAULT_LOGGER
86
87
  end
87
88
  end
89
+
90
+ def configuration
91
+ @configuration ||= YAML.load(parse_erb_in_configuration)
92
+ end
93
+
94
+ private
95
+
96
+ def parse_erb_in_configuration
97
+ ERB.new(File.read(File.expand_path(path_to_config_file, self.path))).result
98
+ end
88
99
  end
89
100
  end
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.3.0
4
+ version: 2.3.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-04-18 00:00:00.000000000 Z
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post