Module: Orassh
- Defined in:
- lib/orassh/version.rb
Defined Under Namespace
Classes: Client=Module.new, CommandNotSpecified, ConfigNotFoundError, ConfigSyntaxError, GitHubTokenNotFoundError, MissingConfigItemError, MissingGistIdError, NgrokBadConfigError, NgrokNotFoundError, Server=Module.new, TunnelNotAvailable, TunnelsNotSpecifiedError, UnknownTunnelError
Constant Summary collapse
- VERSION =
"0.1.1"
- DEFAULT_NGROK_CONFIG =
case when /cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM File. '~/AppData/Local/ngrok/ngrok.yml' when /darwin/ =~ RUBY_PLATFORM File. '~/Library/Application Support/ngrok/ngrok.yml' else File. '~/.config/ngrok/ngrok.yml' end
- DEFAULT_CONFIG =
<<YAML gist_id: YOUR_GIST_ID gist_filename: YOUR_FILENAME.json server: github_token: YOUR_GITHUB_TOKEN ngrok_command: ngrok ngrok_webhook_url: http://localhost:4040 ngrok_config: - "#{Orassh::DEFAULT_NGROK_CONFIG}" client: tunnels: ssh: command: ssh -p {PORT} {DOMAIN} jupyter-notebook: command: xdg-open {URL} YAML
Class Attribute Summary collapse
-
.config ⇒ Object
readonly
Returns the value of attribute config.
-
.gist_filename ⇒ Object
readonly
Returns the value of attribute gist_filename.
-
.gist_id ⇒ Object
readonly
Returns the value of attribute gist_id.
Class Method Summary collapse
Class Attribute Details
.config ⇒ Object (readonly)
Returns the value of attribute config.
97 98 99 |
# File 'lib/orassh.rb', line 97 def config @config end |
.gist_filename ⇒ Object (readonly)
Returns the value of attribute gist_filename.
97 98 99 |
# File 'lib/orassh.rb', line 97 def gist_filename @gist_filename end |
.gist_id ⇒ Object (readonly)
Returns the value of attribute gist_id.
97 98 99 |
# File 'lib/orassh.rb', line 97 def gist_id @gist_id end |
Class Method Details
.load_config(path) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/orassh.rb', line 99 def load_config path begin @config = YAML.load_file path rescue Errno::ENOENT raise Orassh::ConfigNotFoundError, "Config file is not found at #{path}" rescue JSON::ParserError => e raise Orassh::ConfigSyntaxError, e. end unless @gist_id = @config['gist_id'] raise Orassh::MissingGistIdError, '`gist_id` is not specified in config' end @gist_filename = @config['gist_filename'] || 'orassh.json' end |