tmsync 0.1.0 → 0.2.0

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: 4b669e2b1c06e1cc474e939313acaa2cf03f0351
4
- data.tar.gz: 90d51951214baa0172f60b628cae085e96fdb83f
3
+ metadata.gz: fb59f477a2835fdd3d18cac8aa62b73aa64b1505
4
+ data.tar.gz: 726daf9b9a90166302ae6f02cda66e6aacdc0109
5
5
  SHA512:
6
- metadata.gz: 1fed1b0aecf0fe63c4a3f8bc90c86550944f803bb0eeb7a61069461a5eb21d5153256392e5689758c3b58aa12a1d412965f9c6a8b2c938d168c861bf5c66848d
7
- data.tar.gz: e62b7a7944ff1dff82fb5af679e062a7015406a7612508d80a71406de19378739c4eb78bd4500922329a7a150397affdcda39f626abbf3c3e38c1b91493d97f4
6
+ metadata.gz: 3329cafd6e68434cc8c6fb7c80934383a1399cd357053cff4c953e5a547bb7727a2ca8fae450a029bcfef64ab0b390f35e8bb9d3b42f6e4e94139e1a01e5b030
7
+ data.tar.gz: 6b7da8070d7b13ce546d51b514c20287b1942bab39960c883158009f7717c72bde574fcb1c3b4250086c9fac6a8f933bdf9ed4dd85eaacb3a9a56099e7f96cfb
data/README.md CHANGED
@@ -10,32 +10,32 @@ Simply run the following to install it:
10
10
 
11
11
  ## Usage
12
12
 
13
- Run TMSync simply by calling `tmsync execute` in the command line. The following options are *required*:
13
+ Run TMSync simply by calling `tmsync execute` in the command line. The following options are **required**:
14
14
 
15
15
  - `--path=` / `-p`: Specify the absolute path to search for localization files. Usually the root directory of your project.
16
- - `--command=` / `-cmd`: Specify the command of your translation manager to download/upload a single translation file. `<LANGUAGE>` and `<FILE_PATH>` will be replaced by the according values.
16
+ - `--command=` / `-cmd`: Specify the command of your translation manager to download/upload a single translation file. `<LANGUAGE>`, `<FILE_PATH>`, `<FILE_DIR>`, `<FILE_NAME>`, `<FILE_EXT>` will be replaced by the according values.
17
17
 
18
- In addition to the required fields you need to either specify a platform (currently supported: `ios`, `android`) *OR* you need to specify a matching regular expression as well as an exclusion regular expression yourself. Note that the matching regular expression needs to have a capture group which catches the language so you can access `<LANGUAGE>` in your command:
18
+ In addition to the required fields you need to either specify a platform (currently supported: `ios`, `android`) **OR** you need to specify a matching regular expression as well as an exclusion regular expression yourself. Note that the matching regular expression needs to have a capture group which catches the language so you can access `<LANGUAGE>` in your command:
19
19
  - `--platform=`: Preconfigured regexes for the iOS and Android platform. Specify `ios` or `android`.
20
20
  - `--matching_regex=` / `-matching`: Specify a custom regex for matching the translation files in search. This should include a catch group for the language.
21
21
  - `--exclude_regex=` / `-exclude`: Specify a custom for excluding some files that were found with the matching regex.
22
22
 
23
- Here's a *complete example for iOS*:
23
+ Here's a **complete example for iOS**:
24
24
 
25
25
  ```
26
- tmsync execute --command="echo <LANGUAGE> <FILE_PATH>" -p "/absolute/path/to/your/project" --platform=ios
26
+ tmsync execute --command="echo <LANGUAGE> <FILE_PATH> <FILE_DIR> <FILE_NAME> <FILE_EXT>" -p "/absolute/path/to/project" --platform=ios
27
27
  ```
28
28
 
29
- Here's a *complete example for iOS*:
29
+ Here's a **complete example for Android**:
30
30
 
31
31
  ```
32
- tmsync execute --command="echo <LANGUAGE> <FILE_PATH>" -p "/absolute/path/to/your/project" --platform=android
32
+ tmsync execute --command="echo <LANGUAGE> <FILE_PATH> <FILE_DIR> <FILE_NAME> <FILE_EXT>" -p "/absolute/path/to/project" --platform=android
33
33
  ```
34
34
 
35
- Here's a *complete custom example*:
35
+ Here's a **complete custom example**:
36
36
 
37
37
  ```
38
- tmsync execute --command="echo <LANGUAGE> <FILE_PATH>" -p "/Users/JamitLabs/Code/Apple/FitterYou" -matching ".*\/\S+\.(\S+)\.yml"
38
+ tmsync execute --command="echo <LANGUAGE> <FILE_PATH> <FILE_DIR> <FILE_NAME> <FILE_EXT>" -p "/Users/JamitLabs/Code/Apple/FitterYou" -matching ".*\/\S+\.(\S+)\.yml"
39
39
  ```
40
40
 
41
41
 
data/lib/tmsync/cli.rb CHANGED
@@ -45,7 +45,17 @@ module Tmsync
45
45
  else
46
46
  result.keys.each do |language|
47
47
  result[language].each do |file_path|
48
- command = options[:command].gsub('<LANGUAGE>', language).gsub('<FILE_PATH>', file_path)
48
+ file_directory = File.dirname(file_path)
49
+ file_extension = File.extname(file_path)
50
+ file_name = File.basename(file_path, file_extension)
51
+
52
+ command = options[:command]
53
+ .gsub('<LANGUAGE>', language)
54
+ .gsub('<FILE_PATH>', file_path)
55
+ .gsub('<FILE_DIR>', file_directory)
56
+ .gsub('<FILE_EXT>', file_extension)
57
+ .gsub('<FILE_NAME>', file_name)
58
+
49
59
  puts "Executing: '#{command}'"
50
60
  output = %x(#{command})
51
61
 
@@ -1,3 +1,3 @@
1
1
  module Tmsync
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cihat Gündüz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2017-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor