Skip to content

Commit

Permalink
Merge pull request #122 from netbe/feature/fix_google_drive
Browse files Browse the repository at this point in the history
Generate client id and keys file
  • Loading branch information
netbe authored Dec 13, 2019
2 parents 13fc039 + a2eb6cd commit 4bde3a3
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .babelish.sample
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ langs: # Languages to convert. i.e. English:en
# sheet: 0 # Index of worksheet to download. First index is 0.
# macros_filename: Babelish.h # File to output the defines of localized strings
# stripping: false # Strips values inside the spreadsheet

###################################### General ######################################


# csv_separator: ',' # CSV column separator character, uses ',' by default
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ Gemfile.lock

doc
.yardoc


lib/babelish/keys.rb
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
language: ruby
sudo: false
rvm:
- 2.1.0
- 2.2
- 2.3.1
- 2.1.0
- 2.2
- 2.3.1
script:
- bundle exec rake generate_keys
- bundle exec rake test
before_deploy:
- bundle exec rake generate_keys
deploy:
provider: rubygems
api_key:
Expand All @@ -13,3 +18,7 @@ deploy:
tags: true
repo: netbe/Babelish
all_branches: true
env:
global:
- secure: btKN46sftTFZ9RmmCvVveHt6JGRBt+ausRoWoy/n5iwgdjrHGOPnyLwMkRoZkAvWt6F2AlhzoNiNfcLhrlhtySJgZS2fw/yvkCdCu92vBxuOhhzp0vq5LuNTWL9feTRjDx1kfVLPBDJUS2Ejn7zi8x7BUKnfSJN2lZ3FkkHkUxQ=
- secure: qBnld5DOrn+coyVc7ls271REiIN9KY4+dyrZh451mfVbcGX/n2yyu6HG0PaTU8XwS2S6jBDWzaX0Oq1V+1BsKdjZb8OTtbKG0bQ8/F+V8nNG6w1gbNIFRHxTgFK69ASEpwHPmqPt50h6duNeLcc1h+wu43lGaMn8CMN0HqaW5D4=
15 changes: 13 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,24 @@ require 'yard'
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/babelish/**/test_*.rb']
# t.warning = true
t.verbose = true
end

task :generate_keys do
f = File.open("lib/babelish/keys.rb", "w")
f.puts <<-FOO
module Babelish
module Keys
GOOGLE_DRIVE_CLIENT_SECRET = "#{ENV['google_drive_client_secret']}"
GOOGLE_DRIVE_CLIENT_ID = "#{ENV['google_drive_client_id']}"
end
end
FOO
f.close
end

YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb']
# t.options = ['--any', '--extra', '--opts']
end

task :default => :test
2 changes: 1 addition & 1 deletion babelish.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |s|

s.add_dependency "thor"

s.add_dependency "google_drive", "~> 3.0"
s.add_dependency "google_drive", "~> 3.0.3"
s.add_dependency "nokogiri"
# google_drive dependency to ask for mail and password
s.add_dependency "highline"
Expand Down
7 changes: 5 additions & 2 deletions lib/babelish/google_doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ def open(requested_filename)

def authenticate
# will try to get token and store in file below
@session = GoogleDrive.saved_session ".babelish.token"
@session = GoogleDrive.saved_session(".babelish.token",
nil,
Babelish::Keys::GOOGLE_DRIVE_CLIENT_ID,
Babelish::Keys::GOOGLE_DRIVE_CLIENT_SECRET)
end

def file_with_name(name)
unless @session
authenticate
end
@session.spreadsheet_by_title(name)
@session.file_by_title(name)
end
end
end
2 changes: 1 addition & 1 deletion lib/babelish/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Babelish
VERSION = "0.6.0"
VERSION = "0.6.1"
end

0 comments on commit 4bde3a3

Please sign in to comment.