Module: Torba
- Defined in:
- lib/torba.rb,
lib/torba/ui.rb,
lib/torba/cli.rb,
lib/torba/rails.rb,
lib/torba/package.rb,
lib/torba/manifest.rb,
lib/torba/import_list.rb,
lib/torba/remote_sources/npm.rb,
lib/torba/remote_sources/zip.rb,
lib/torba/remote_sources/targz.rb,
lib/torba/remote_sources/common.rb,
lib/torba/remote_sources/get_file.rb,
lib/torba/css_url_to_erb_asset_path.rb,
lib/torba/remote_sources/github_release.rb
Overview
Defined Under Namespace
Modules: Errors, RemoteSources Classes: Cli, CssUrlToErbAssetPath, Engine, ImportList, Manifest, Package, Ui
Class Method Summary collapse
-
.cache_path ⇒ String
Root path to downloaded yet unprocessed asset packages.
-
.digest(string) ⇒ String
Unique short fingerprint/hash for given string.
-
.home_path ⇒ String
Root path to prepared asset packages.
-
.home_path=(val) ⇒ void
Override home path with a new value.
- .load_path ⇒ Object
- .manifest ⇒ Manifest
- .non_js_css_logical_paths ⇒ Object
- .pack ⇒ Object
- .pretty_errors { ... } ⇒ Object
- .ui ⇒ Ui
- .verify ⇒ Object
Class Method Details
.cache_path ⇒ String
use “TORBA_CACHE_PATH” env variable to override default value
Returns root path to downloaded yet unprocessed asset packages. By default it’s “cache” within home_path.
29 30 31 |
# File 'lib/torba.rb', line 29 def self.cache_path @cache_path ||= ENV["TORBA_CACHE_PATH"] || File.join(home_path, "cache") end |
.digest(string) ⇒ String
Returns unique short fingerprint/hash for given string.
69 70 71 |
# File 'lib/torba.rb', line 69 def self.digest(string) Digest::SHA1.hexdigest(string)[0..7] end |
.home_path ⇒ String
use “TORBA_HOME_PATH” env variable to override default value
Returns root path to prepared asset packages. By default it’s “.torba” within your OS home directory (i.e. packages are shared between projects).
15 16 17 |
# File 'lib/torba.rb', line 15 def self.home_path @home_path ||= ENV["TORBA_HOME_PATH"] || File.join(Dir.home, ".torba") end |
.home_path=(val) ⇒ void
This method returns an undefined value.
Override home path with a new value
22 23 24 |
# File 'lib/torba.rb', line 22 def self.home_path=(val) @home_path = val end |
.load_path ⇒ Object
49 50 51 |
# File 'lib/torba.rb', line 49 def self.load_path manifest.load_path end |
.manifest ⇒ Manifest
39 40 41 |
# File 'lib/torba.rb', line 39 def self.manifest @manifest ||= Manifest.build end |
.non_js_css_logical_paths ⇒ Object
55 56 57 |
# File 'lib/torba.rb', line 55 def self.non_js_css_logical_paths manifest.non_js_css_logical_paths end |
.pack ⇒ Object
44 45 46 |
# File 'lib/torba.rb', line 44 def self.pack manifest.pack end |
.pretty_errors { ... } ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/torba.rb', line 74 def self.pretty_errors yield rescue Errors::MissingPackages => e ui.error "Your Torba is not packed yet." ui.error "Missing packages:" e.packages.each do |package| ui.error " * #{package.name}" end ui.suggest "Run `bundle exec torba pack` to install missing packages." exit(false) rescue Errors::ShellCommandFailed => e ui.error "Couldn't execute command '#{e.}'" exit(false) rescue Errors::NothingToImport => e ui.error "Couldn't import an asset(-s) '#{e.path}' from import list in '#{e.package}'." ui.suggest "Check for typos." ui.suggest "Make sure that the path has trailing '/' if its a directory." exit(false) rescue Errors::AssetNotFound => e ui.error "Couldn't find an asset with path '#{e.}'." ui.suggest "Make sure that you've imported all image/font assets mentioned in a stylesheet(-s)." exit(false) end |
.verify ⇒ Object
60 61 62 |
# File 'lib/torba.rb', line 60 def self.verify manifest.verify end |