-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
41 lines (36 loc) · 1.2 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'bundler/gem_tasks'
require 'dotenv/tasks'
task :default => [:test]
desc 'Run tests for project'
task :test do
sh 'bundle exec rspec'
end
desc 'Process the markdown files in a directory'
task :process, :source_directory do |t, args|
require_relative 'lib/dropdown'
processor = Dropdown::Processor.new
processor.source = args[:source_directory]
processor.destination = File.join(processor.source, 'html')
processor.storage = args[:storage] || :dropbox
processor.renderer = :markdown_renderer
processor.process
end
namespace :setup do
namespace :dropbox do
desc 'Store a new access token from Dropbox'
task :access_token => :dotenv do |t, args|
require 'launchy'
require_relative 'lib/dropdown'
key = args[:key] || ENV['DROPBOX_APP_KEY']
secret = args[:secret] || ENV['DROPBOX_APP_SECRET']
session = Dropdown::Dropbox::Session.new key, secret
url = session.authorize_url
puts "Opening the following url in your browser: #{url} ..."
Launchy.open url
puts "Paste the authorization code below and hit return: "
code = STDIN.gets.strip
token = session.access_token(code)
puts "Your access token is: #{token}"
end
end
end