Class: Chromecast::Tasks

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/chromecast/tasks.rb

Instance Method Summary collapse

Instance Method Details

#install_tasksObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/chromecast/tasks.rb', line 5

def install_tasks
  desc "Setup all necessary files"
  task setup: ['setup:protocol', 'setup:certificate']

  namespace :setup do
    desc "Generate certificates for TLS"
    task :certificate do
      system('openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout certificate.key -out certificate.crt')
    end

    desc "Generate Ruby code for Chromecast protocol"
    task :protocol do
      system('protoc --ruby_out lib/chromecast/ protocol.proto && echo Generated protocol code')
    end
  end
end