lingohub 0.5.0 → 0.6.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
- SHA1:
3
- metadata.gz: 65feb5d33518892ae47f34dfc11ebaef2e2ebe5a
4
- data.tar.gz: 87c8a017164de1a32782e6000f10a13adb27f596
2
+ SHA256:
3
+ metadata.gz: bd55f8fec72532fd75d35d7de635dcb7f2210ba0e67532827b8431f4e601aa4e
4
+ data.tar.gz: '09a178901ff24c0517a667df35c3e69d5eb27ed2964354a6346172caff4762d4'
5
5
  SHA512:
6
- metadata.gz: 1ef0bf6c117158c469eadbf3f50b94af7b5423993dcc6357fa298935d9e347e8367e837ce4c5a514f5a83d065a915fb437ed4c3e0234b8cf730e3bfa137358b9
7
- data.tar.gz: 5241d965ba3d4052a62ee043b9ee2fca33851eee467c7236188b42edfae8de356be4dd72e586a131d47d2be8629aa3aaffcbf72c0721bd862b5fe73551e9faef
6
+ metadata.gz: a0b0a46257a4267e6ecb9a05bb2fd501ae1ff4f733bd891168e62e11af7ca9e559eb111ba123cce8152b03830291eb9c3e0c9772f08bdbb0fb2846e4422b400c
7
+ data.tar.gz: 29e51a7d6541cdac1d0a4f59e15434be3e1398b0ab593cc294c29466e211b80f04f847222527d2b7f36b26585a33a1f8f22fa33da3f702766ab7350122c91ee7
@@ -45,23 +45,19 @@ module Lingohub::Command
45
45
  group 'Project Commands' do |group|
46
46
  group.command 'project:list', 'list your projects'
47
47
  group.command 'project:open --project <name>', 'open the project in a web browser'
48
- group.space
49
48
  end
50
49
 
51
50
  group 'Translation Commands' do |group|
52
- group.command 'resource:down --all --directory <path> --project <name>', 'download all resource files'
53
- group.command 'resource:down --locale <iso2_code> --all --directory <path> --project <name>', 'download all resource files, using the given locale as filter'
54
- group.command 'resource:down <file1> <file2> ... --directory <path> --project <name>', 'download specific resource files'
55
-
56
- up_command = 'resource:up <file1> <file2> ... --locale <iso2_code> --project <name>'
51
+ group.command 'resource:down --all --directory <output-path> --project <name>', 'download all resource files'
52
+ group.command 'resource:down --locale <iso2_code> --all --directory <output-path> --project <name>', 'download all resource files, using the given locale as filter'
53
+ group.command 'resource:down <file1> <file2> ... --directory <output-path> --project <name>', 'download specific resource files'
57
54
 
58
55
  strategy_desc = ""
59
56
  Lingohub::Command::Resource::EXPECTED_STRATEGY_PARAMETERS.each do |parameter|
60
57
  strategy_desc << " --#{parameter} true|false"
61
58
  end
62
59
 
63
- group.command "resource:up <file1> <file2> ... --locale <iso2_code> --project <name> [#{strategy_desc}]", "upload specific resource files, a locale may be specified to tell lingohub the locale of file content"
64
- group.space
60
+ group.command "resource:up <file1> <file2> ... --locale <iso2_code> --project <name> --directory <path> [#{strategy_desc}]", "upload specific resource files, a locale may be specified to tell lingohub the locale of file content"
65
61
  end
66
62
  end
67
63
 
@@ -74,22 +70,21 @@ module Lingohub::Command
74
70
  end
75
71
 
76
72
  def usage
77
- longest_command_length = self.class.groups.map do |group|
78
- group.map { |g| g.first.length }
79
- end.flatten.max
80
-
81
73
  self.class.groups.inject(StringIO.new) do |output, group|
82
74
  output.puts "=== %s" % group.title
83
- output.puts
75
+ longest_command_length = 30
84
76
 
85
77
  group.each do |command, description|
86
78
  if command.empty?
87
79
  output.puts
88
80
  else
89
- output.puts "%-*s # %s" % [longest_command_length, command, description]
81
+ if command.length > longest_command_length
82
+ output.puts " %s\n %s\n " % [command, description]
83
+ else
84
+ output.puts " %-*s # %s" % [longest_command_length, command, description]
85
+ end
90
86
  end
91
87
  end
92
-
93
88
  output.puts
94
89
  output
95
90
  end.string
@@ -99,10 +99,11 @@ module Lingohub::Command
99
99
  end
100
100
 
101
101
  def upload_resources(resources)
102
+ path = extract_option('--path')
102
103
  resources.each do |file_name|
103
104
  begin
104
- path = File.expand_path(file_name, Dir.pwd)
105
- project.upload_resource(path, extract_locale_from_args, extract_strategy_parameters)
105
+ file = File.expand_path(file_name, Dir.pwd)
106
+ project.upload_resource(file, extract_locale_from_args, extract_strategy_parameters, path)
106
107
  display("#{file_name} uploaded")
107
108
  rescue
108
109
  display "Error uploading #{file_name}. Response: #{$!.message || $!.response}"
@@ -50,10 +50,11 @@ module Lingohub
50
50
  end
51
51
  end
52
52
 
53
- def upload_resource(path, locale, strategy_parameters = {})
54
- raise "Path #{path} does not exists" unless File.exists?(path)
55
- request = { :file => File.new(path, "rb") }
53
+ def upload_resource(file, locale, strategy_parameters = {}, path)
54
+ raise "Path #{file} does not exists" unless File.exists?(file)
55
+ request = { :file => File.new(file, "rb") }
56
56
  request.merge!({ :iso2_slug => locale }) if locale
57
+ request.merge!({ :path => path }) if path
57
58
  request.merge!(strategy_parameters)
58
59
  @client.post(self.resources_url, request)
59
60
  end
@@ -1,4 +1,4 @@
1
1
  module Lingohub
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  API_VERSION = 'v1'
4
4
  end
metadata CHANGED
@@ -1,57 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lingohub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lingohub GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-15 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.2
19
+ version: 1.6.7
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - '='
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.6.7
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 2.0.2
32
+ version: 3.0.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: launchy
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - '='
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: 2.4.3
39
+ version: '2.0'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - '='
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: 2.4.3
46
+ version: '2.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: stringex
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - '='
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: 2.7.1
53
+ version: 1.3.2
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: 3.0.0
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
51
60
  requirements:
52
- - - '='
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.3.2
64
+ - - "<"
53
65
  - !ruby/object:Gem::Version
54
- version: 2.7.1
66
+ version: 3.0.0
55
67
  description: Client library and command-line tool to translate Ruby based apps with
56
68
  lingohub.
57
69
  email:
@@ -103,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
115
  version: '0'
104
116
  requirements: []
105
117
  rubyforge_project:
106
- rubygems_version: 2.6.10
118
+ rubygems_version: 2.7.6
107
119
  signing_key:
108
120
  specification_version: 4
109
121
  summary: Client library and command-line tool to translate Ruby based apps with lingohub.