fci 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fci.rb +4 -2
- data/lib/fci/commands/02_import.rb +3 -2
- data/lib/fci/commands/03_download.rb +12 -4
- data/lib/fci/commands/04_export.rb +2 -3
- data/lib/fci/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea7f77e8704e3b17cbaf20154dd8a7b3fbafddf6
|
4
|
+
data.tar.gz: 6df339513937b041994330d584a5af8a42a4b943
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bdfc3f81062392e6096587ab13475731c005313ad418ef0693515d9cf91bad2d0718da605f0f47c78b7bf70b597f45045c2268e8201f12da43a50f4e0c76932
|
7
|
+
data.tar.gz: f7f9e629b783e2f419f042f0901e0aa5bb68690b1f3c633b1fb9fceaf4a873adeca44863de87a23d2d04de29e018a7bca886f499bb7b880072f0950fa4a45ba5
|
data/lib/fci.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
require 'fci/version.rb'
|
2
|
+
|
1
3
|
require 'freshdesk_api'
|
2
4
|
require 'crowdin-api'
|
3
|
-
require 'byebug'
|
4
5
|
require 'nokogiri'
|
5
6
|
require 'zip'
|
6
|
-
|
7
|
+
|
8
|
+
# require 'byebug'
|
7
9
|
|
8
10
|
# Add requires for other files you add to your project here, so
|
9
11
|
# you just need to require this one file in your bin file
|
@@ -17,11 +17,12 @@ command :'import:sources' do |c|
|
|
17
17
|
c.flag [:resources_config]
|
18
18
|
|
19
19
|
c.action do |global_options, options, args|
|
20
|
-
resources_dir = options[:resources_dir]
|
20
|
+
resources_dir = File.join(File.dirname(global_options[:config]), options[:resources_dir])
|
21
|
+
resources_config_file = File.join(File.dirname(global_options[:config]), options[:resources_config])
|
22
|
+
|
21
23
|
unless File.exists?(resources_dir)
|
22
24
|
FileUtils.mkdir(resources_dir)
|
23
25
|
end
|
24
|
-
resources_config_file = options[:resources_config]
|
25
26
|
|
26
27
|
File.open(resources_config_file, 'a+') do |f|
|
27
28
|
config = YAML.load(f)
|
@@ -8,21 +8,29 @@ command :'download:translations' do |c|
|
|
8
8
|
c.arg_name 'dir'
|
9
9
|
c.flag [:resources_dir]
|
10
10
|
|
11
|
+
c.desc 'Resources config file'
|
12
|
+
c.long_desc <<-EOS.strip_heredoc
|
13
|
+
This is the config file where the information about project's files will be store.
|
14
|
+
EOS
|
15
|
+
c.default_value 'resources/.resources.yml'
|
16
|
+
c.arg_name 'file'
|
17
|
+
c.flag [:resources_config]
|
18
|
+
|
11
19
|
c.action do |global_options, options, args|
|
20
|
+
resources_dir = File.join(File.dirname(global_options[:config]), options[:resources_dir])
|
21
|
+
resources_config_file = File.join(File.dirname(global_options[:config]), options[:resources_config])
|
22
|
+
|
12
23
|
language = 'all'
|
13
24
|
tempfile = Tempfile.new(language)
|
14
25
|
zipfile_name = tempfile.path
|
15
|
-
resources_dir = options[:resources_dir]
|
16
26
|
|
17
|
-
base_path = File.join(Dir.pwd, resources_dir)
|
18
27
|
begin
|
19
28
|
export_translations!(@crowdin)
|
20
29
|
|
21
30
|
puts 'Downloading translations'
|
22
31
|
@crowdin.download_translation(language, output: zipfile_name)
|
23
32
|
|
24
|
-
|
25
|
-
unzip_file_with_translations(zipfile_name, base_path)
|
33
|
+
unzip_file_with_translations(zipfile_name, resources_dir)
|
26
34
|
ensure
|
27
35
|
tempfile.close
|
28
36
|
tempfile.unlink # delete the tempfile
|
@@ -17,9 +17,8 @@ command :'export:translations' do |c|
|
|
17
17
|
c.flag [:resources_config]
|
18
18
|
|
19
19
|
c.action do |global_options, options, args|
|
20
|
-
|
21
|
-
resources_config_file = options[:resources_config]
|
22
|
-
resources_dir = options[:resources_dir]
|
20
|
+
resources_dir = File.join(File.dirname(global_options[:config]), options[:resources_dir])
|
21
|
+
resources_config_file = File.join(File.dirname(global_options[:config]), options[:resources_config])
|
23
22
|
|
24
23
|
# for store information about folders/articles ids
|
25
24
|
unless File.exists?(resources_config_file)
|
data/lib/fci/version.rb
CHANGED