getlocal 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: e15a9540b794afcf52d76d7383881811fdda79d9
4
- data.tar.gz: 0a35261366023729e56932ab141b23e70b851b75
3
+ metadata.gz: 44e9e1d11b5c82afee354f10b3fe469a0fcc525c
4
+ data.tar.gz: 26a6f3c96f71412bca49fcb0b446f0958d2432bc
5
5
  SHA512:
6
- metadata.gz: f0563139f01209108a810a2110093a234dfc303e8b9d1e8f657ba876256ba76f994f18703253e059b83b347bb9b57853d57b992c3bfe831cef9d699ab563a0d3
7
- data.tar.gz: 33381dcf17e56b4a657af1b8c1035ca4406fb508e04a1692993faea8e6299137cd3f39d9aa567ee86d53a9992d595f0ad13b9746e0c87f12e2f0e1d0503fcc7d
6
+ metadata.gz: c0df3b44d0e9f5d7375915bac6ed510a4a16784cdae47e4da02c1a21b8a3d9cc636498b0d1d41e5586ad6557eb104c7bb7cc0e6137c2c23a706d7487543a26e2
7
+ data.tar.gz: 1be269374a4fc4b01c1c4ade918dd96e1925ab61e7abc542b00a3195bdffdb1b3a57f862ef38f96bc003dc8c7c1df01fecd392c44a01e6c4490a7f779a44e63e
data/lib/getlocal/cli.rb CHANGED
@@ -134,45 +134,41 @@ module Getlocal
134
134
 
135
135
  puts "Requesting the list of master files" if options[:verbose]
136
136
  response = HTTParty.get("https://api.getlocalization.com/#{project}/api/list-master/json/", :basic_auth => auth)
137
+
137
138
  if response.code == 200 then
138
139
  parsedResponse = JSON.parse(response.body)
139
140
  if parsedResponse['success'] == "1"
140
141
  puts "Recived list" if options[:verbose]
141
142
  currentMasterFiles = parsedResponse['master_files']
143
+ else
144
+ puts "couldn't fetch list of master files"
145
+ return
142
146
  end
147
+ else
148
+ puts "couldn't fetch list of master files"
149
+ return
143
150
  end
144
151
 
145
- responceCodes = []
146
-
147
152
  Dir.glob("Base.lproj/*.strings") do |stringFilePath|
148
153
 
149
154
  alreadyExists = currentMasterFiles.include?(stringFilePath.gsub("Base.lproj/", ""))
150
155
 
151
156
  body = {"file" => File.new(stringFilePath)}
152
157
 
153
- puts "Uploading " + stringFilePath if options[:verbose]
154
158
 
155
159
  if alreadyExists
156
160
  # Update master
161
+ puts "Updateing " + stringFilePath if options[:verbose]
157
162
  response = HTTMultiParty.post("https://api.getlocalization.com/#{project}/api/update-master/", :basic_auth => auth, :query => body)
158
- responceCodes << response.code
159
163
  else
160
164
  #Upload new master
165
+ puts "Creating " + stringFilePath if options[:verbose]
161
166
  response = HTTMultiParty.post("https://api.getlocalization.com/#{project}/api/create-master/ios/en/", :basic_auth => auth, :query => body)
162
- responceCodes << response.code
163
167
  end
164
168
 
165
- puts "Upload complete with responce code " + response.code if options[:verbose]
169
+ puts "Upload complete with responce code #{response.code}" if options[:verbose]
166
170
  puts "" if options[:verbose]
167
171
  end
168
-
169
- if responceCodes.include?(400)
170
- puts "The request was malformed please try again"
171
- elsif responceCodes.include?(404)
172
- puts "The username or password are invailed"
173
- else
174
- puts ""
175
- end
176
172
 
177
173
  end
178
174
  end
@@ -1,3 +1,3 @@
1
1
  module Getlocal
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getlocal
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
  - Benjamin Briggs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-10 00:00:00.000000000 Z
11
+ date: 2014-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler