Class: SnapshotUI::Configuration
- Inherits:
-
Object
- Object
- SnapshotUI::Configuration
- Defined in:
- lib/snapshot_ui/configuration.rb
Instance Attribute Summary collapse
-
#live_websocket_url ⇒ Object
Returns the value of attribute live_websocket_url.
- #project_root_directory ⇒ Object
- #storage_directory ⇒ Object
-
#web_url ⇒ Object
Returns the value of attribute web_url.
Instance Method Summary collapse
- #exit_if_not_configured! ⇒ Object
-
#initialize(project_root_directory:, storage_directory:, web_url:, live_websocket_url:) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(project_root_directory:, storage_directory:, web_url:, live_websocket_url:) ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 |
# File 'lib/snapshot_ui/configuration.rb', line 10 def initialize(project_root_directory:, storage_directory:, web_url:, live_websocket_url:) @project_root_directory = project_root_directory @storage_directory = storage_directory @web_url = web_url @live_websocket_url = live_websocket_url end |
Instance Attribute Details
#live_websocket_url ⇒ Object
Returns the value of attribute live_websocket_url.
8 9 10 |
# File 'lib/snapshot_ui/configuration.rb', line 8 def live_websocket_url @live_websocket_url end |
#project_root_directory ⇒ Object
21 22 23 |
# File 'lib/snapshot_ui/configuration.rb', line 21 def project_root_directory Pathname.new(@project_root_directory) if @project_root_directory end |
#storage_directory ⇒ Object
17 18 19 |
# File 'lib/snapshot_ui/configuration.rb', line 17 def storage_directory Pathname.new(@storage_directory) if @storage_directory end |
#web_url ⇒ Object
Returns the value of attribute web_url.
8 9 10 |
# File 'lib/snapshot_ui/configuration.rb', line 8 def web_url @web_url end |
Instance Method Details
#exit_if_not_configured! ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/snapshot_ui/configuration.rb', line 25 def exit_if_not_configured! return unless project_root_directory.nil? || storage_directory.nil? || web_url.nil? puts Colorize.red("Looks like SnapshotUI is not configured yet. Example configuration:\n") puts <<~CONFIG #{Colorize.green("SnapshotUI.configure do |config|")} #{Colorize.green('config.storage_directory = "/path/to/tmp/snapshot_ui"')} #{Colorize.red("# Current value is `#{storage_directory.inspect}`")} #{Colorize.green('config.project_root_directory = "/path/to/project/root"')} #{Colorize.red("# Current value is `#{project_root_directory.inspect}`")} #{Colorize.green("config.web_url = \"#{web_url}\"")} #{Colorize.red("# Current value is `#{web_url.inspect}`")} #{Colorize.green("end")} CONFIG raise SystemExit.new(1) end |