fci 0.0.2 → 0.0.3

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: 17c4cf031e24f5db18808f8ed41b5d29562ee496
4
- data.tar.gz: 0c9fb77525350f95887315629df94c70706214be
3
+ metadata.gz: ea7f77e8704e3b17cbaf20154dd8a7b3fbafddf6
4
+ data.tar.gz: 6df339513937b041994330d584a5af8a42a4b943
5
5
  SHA512:
6
- metadata.gz: 3d0e13a582ff67c993d568b01d4f1ed7c579ba4f9aa485cca78bed53c904942c01c600a7fd8d9afedd51e3081d627983fdbccdfeb4a4773e4ac8d4e4fef5eb95
7
- data.tar.gz: 704fa5620e141a7125df80622646d39d50f93bb908258503c013312baa6cd2aed7ab327888a66b6f52b2e657957941a6697b6f05e74686e6988e295054c56416
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
- require 'fci/version.rb'
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
- base_path = File.join(Dir.pwd, resources_dir)
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
- # DO NOT EDIT THIS FILE BY HAND!
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
@@ -1,3 +1,3 @@
1
1
  module FCI
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Maminov