Rakefile in fanswatch-0.1.1 vs Rakefile in fanswatch-0.1.2
- old
+ new
@@ -1,4 +1,31 @@
+# frozen_string_literal: true
+require 'rake/testtask'
+
+task default: :spec
+
+namespace :credentials do
+ require 'yaml'
+
+ desc 'generate access_token to STDOUT'
+ task :get_access_token do
+ credentials = YAML.load(File.read('config/credentials.yml'))
+ require_relative 'lib/fanswatch/fb_api'
+ ENV['FBAPI_CLIENT_ID'] = credentials[:client_id]
+ ENV['FBAPI_CLIENT_SECRET'] = credentials[:client_secret]
+
+ puts "Access Token: #{FansWatch::FbApi.access_token}"
+ end
+
+ desc 'Export sample credentials from file to bash'
+ task :export do
+ credentials = YAML.load(File.read('config/credentials.yml'))
+ puts 'Please run the following in bash:'
+ puts "export FB_CLIENT_ID=#{credentials[:client_id]}"
+ puts "export FB_CLIENT_SECRET=#{credentials[:client_secret]}"
+ end
+end
+
desc 'run tests'
task :spec do
sh 'ruby spec/fanswatch_spec.rb'
end