Class: Softcover::CLI
- Inherits:
-
Thor
- Object
- Thor
- Softcover::CLI
show all
- Includes:
- Utils
- Defined in:
- lib/softcover/cli.rb
Constant Summary
Constants included
from Utils
Utils::UNITS
Instance Method Summary
collapse
Methods included from Utils
#add_highlight_class!, #as_size, #current_book, #digest, #executable, #execute, #in_book_directory?, #logged_in?, #mkdir, #path, #reset_current_book!, #rm, #silence, #source, #tmpify, #write_pygments_file
Instance Method Details
#config ⇒ Object
204
205
206
207
|
# File 'lib/softcover/cli.rb', line 204
def config
require "softcover/config"
Softcover::Config.read
end
|
#login ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/softcover/cli.rb', line 86
def login
puts "Logging in."
logged_in = false
while not logged_in do
email = ask "Email:"
password = ask_without_echo "Password (won't be shown):"
unless logged_in = Softcover::Commands::Auth.login(email, password)
puts "Invalid login, please try again."
end
end
puts "Welcome back, #{email}!"
end
|
#publish ⇒ Object
114
115
116
117
118
119
120
121
|
# File 'lib/softcover/cli.rb', line 114
def publish
require 'softcover/commands/publisher'
invoke :login unless logged_in?
puts "Publishing..." unless options[:silent]
Softcover::Commands::Publisher.publish!(options)
end
|
#unpublish ⇒ Object
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/softcover/cli.rb', line 139
def unpublish
require 'softcover/commands/publisher'
invoke :login unless logged_in?
slug = Softcover::BookManifest.new.slug
if ask("Type '#{slug}' to unpublish:") == slug
puts "Unpublishing..." unless options[:silent]
Softcover::Commands::Publisher.unpublish!
else
puts "Canceled."
end
end
|
#version ⇒ Object
12
13
14
15
16
|
# File 'lib/softcover/cli.rb', line 12
def version
require 'softcover/version'
puts "Softcover #{Softcover::VERSION}"
exit 0
end
|