Class: Repub::App

Inherits:
Object show all
Includes:
Builder, Fetcher, Logger, Options, Parser, Profile, Singleton
Defined in:
lib/repub/app.rb,
lib/repub/app/logger.rb,
lib/repub/app/parser.rb,
lib/repub/app/builder.rb,
lib/repub/app/fetcher.rb,
lib/repub/app/options.rb,
lib/repub/app/profile.rb

Defined Under Namespace

Modules: Builder, Fetcher, Logger, Options, Parser, Profile

Constant Summary

Constants included from Logger

Logger::LOGGER_NORMAL, Logger::LOGGER_QUIET, Logger::LOGGER_VERBOSE

Constants included from Profile

Profile::PROFILE_KEYS

Constants included from Fetcher

Fetcher::AssetTypes

Constants included from Parser

Parser::Selectors

Instance Attribute Summary

Attributes included from Options

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Options

#help, #parse_options

Methods included from Logger

#log

Methods included from Profile

#dump_profile, #list_profiles, #load_profile, #write_profile

Methods included from Fetcher

#fetch

Methods included from Parser

#parse

Methods included from Builder

#build

Class Method Details

.data_pathObject



23
24
25
26
27
# File 'lib/repub/app.rb', line 23

def self.data_path
  data_path = File.join(File.expand_path('~'), '.repub')
  FileUtils.mkdir_p(data_path) unless File.exist?(data_path)
  data_path
end

.nameObject



19
20
21
# File 'lib/repub/app.rb', line 19

def self.name
  File.basename($0)
end

Instance Method Details

#run(args) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/repub/app.rb', line 29

def run(args)
  parse_options(args)
  
  log.level = options[:verbosity]
  log.info "Making ePub from #{options[:url]}"
  builder = build(parse(fetch))
  log.info "Saved #{builder.output_path}"
  
  Launchy::Browser.run(builder.document_path) if options[:browser]

rescue RuntimeError => ex
  log.fatal "** ERROR: #{ex.to_s}"
end