Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better error message when target dir for locales does not exist

  • Loading branch information...
commit cd368abb370667902e58e177e5b24263d88129dc 1 parent 2967dd3
@rmehner rmehner authored
Showing with 15 additions and 0 deletions.
  1. +10 −0 features/localeapp_binary.feature
  2. +5 −0 lib/localeapp/updater.rb
View
10 features/localeapp_binary.feature
@@ -99,6 +99,16 @@ Feature: localeapp executable
And help should not be displayed
And a file named "config/locales/en.yml" should exist
+ Scenario: Running pull without having a locales dir
+ In order to retreive my translations
+ Given I have a translations on localeapp.com for the project with api key "MYAPIKEY"
+ And an initializer file
+ When I run `localeapp pull`
+ Then the output should contain:
+ """
+ Could not write locale file, please make sure that config/locales exists and is writeable
+ """
+
Scenario: Running push on a file
In order to send my translations
When I have a valid project on localeapp.com with api key "MYAPIKEY"
View
5 lib/localeapp/updater.rb
@@ -57,6 +57,11 @@ def remove_child_keys!(sub_hash, keys)
# originally from ActiveSupport
def atomic_write(file_name, temp_dir = Dir.tmpdir)
+ target_dir = File.dirname(file_name)
+ unless Dir.exists?(target_dir)
+ raise "Could not write locale file, please make sure that #{target_dir} exists and is writeable"
+ end
+
temp_file = Tempfile.new(File.basename(file_name), temp_dir)
yield temp_file
temp_file.close
Please sign in to comment.
Something went wrong with that request. Please try again.