google_spreadsheet2yml 0.1.4 → 0.1.5

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.
@@ -1,3 +1,3 @@
1
1
  module GoogleSpreadsheet2yml
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -1,15 +1,9 @@
1
- desc 'my plugins rake task'
2
- task :do_something do
3
- puts "the rake task did something"
4
- end
5
-
6
1
  namespace :gs2yml do
7
2
 
8
3
  desc "gets translations from google doc and creates YML files"
9
4
  task :translate do
10
5
  puts "Starting Translation"
11
6
 
12
- # require "rubygems"
13
7
  require "google_spreadsheet"
14
8
  require 'yaml'
15
9
  require 'google_spreadsheet2yml'
@@ -41,17 +35,18 @@ namespace :gs2yml do
41
35
  languages["#{ws[1,c]}"] = c
42
36
  end
43
37
 
44
- puts "Connecting to Google Docs"
45
-
46
38
  # Create flat HASH from Spreedsheet that will be processed
47
39
  languages.keys.each do |lang|
48
40
  hash = Hash.new
49
41
  (2..ws.num_rows).each do |row|
50
- unless ws[row, 1].blank? || ws[row, languages[lang]].blank?
42
+ if !ws[row, 1].blank? && !ws[row, languages[lang]].blank? && !ws[row, languages[lang]] == "missing"
51
43
  hash.store([lang, ws[row, 1].strip.rstrip].join('.'), ws[row, languages[lang]].strip.rstrip)
44
+ elsif !ws[row, 1].blank?
45
+ hash.store([lang, ws[row, 1].strip.rstrip].join('.'), ws[row, languages["en"]].strip.rstrip)
52
46
  end
53
47
  end
54
48
 
49
+ puts "Writting file to: #{lang}.gdoc.yml"
55
50
  File.open("./config/locales/#{lang}.gdocs.yml", 'w') {|f| f.write(GoogleSpreadsheet2yml.create_yaml(hash)) }
56
51
  end
57
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_spreadsheet2yml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-21 00:00:00.000000000 Z
12
+ date: 2012-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-spreadsheet-ruby