Class: RubyNative::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_native/cli.rb,
lib/ruby_native/cli/login.rb,
lib/ruby_native/cli/deploy.rb,
lib/ruby_native/cli/preview.rb,
lib/ruby_native/cli/credentials.rb

Defined Under Namespace

Classes: Credentials, Deploy, Login, Preview

Class Method Summary collapse

Class Method Details



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ruby_native/cli.rb', line 39

def self.print_usage
  puts "Usage: ruby_native <command> [options]"
  puts ""
  puts "Commands:"
  puts "  deploy        Trigger a build and wait for it to finish"
  puts "    --android          Build for Android instead of iOS"
  puts "    --platform=NAME    Build for ios or android"
  puts "    --if-needed        Skip when this gem version is already built"
  puts "  login         Authenticate with Ruby Native"
  puts "  logout        Remove stored credentials"
  puts "  preview       Start a tunnel and display a QR code"
  puts "    --port PORT        Rails server port (default: PORT or 3000)"
  puts "    --url URL          Tunnel to this URL instead of localhost"
end

.start(argv) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ruby_native/cli.rb', line 8

def self.start(argv)
  command = argv.shift
  case command
  when "deploy"
    RubyNative::CLI::Deploy.new(argv).run
  when "preview"
    RubyNative::CLI::Preview.new(argv).run
  when "login"
    RubyNative::CLI::Login.new(argv).run
  when "logout"
    RubyNative::CLI::Credentials.clear
    puts "Logged out of Ruby Native."
  when "screenshots"
    warn "ruby_native screenshots was removed in 0.9.0."
    warn "Screenshots are now captured by rubynative.com against your deployed site."
    warn "See https://rubynative.com/docs/screenshots for the new flow."
    exit 1
  when nil
    print_usage
  else
    puts "Unknown command: #{command}"
    puts ""
    print_usage
    exit 1
  end
rescue => error
  puts "Something went wrong: #{error.class}: #{error.message}"
  puts "If this keeps happening, report it: https://github.com/ruby-native/gem/issues"
  exit 1
end