Class: CiInACan::Cli::Files
- Inherits:
-
Object
- Object
- CiInACan::Cli::Files
- Defined in:
- lib/ci_in_a_can/cli/files.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#root ⇒ Object
Returns the value of attribute root.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/ci_in_a_can/cli/files.rb', line 9 def id @id end |
#root ⇒ Object
Returns the value of attribute root.
9 10 11 |
# File 'lib/ci_in_a_can/cli/files.rb', line 9 def root @root end |
Class Method Details
Instance Method Details
#rake_file ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ci_in_a_can/cli/files.rb', line 15 def rake_file <<EOF #!/usr/bin/env rake desc "Start #{@id}" task :start do location = File.expand_path(File.dirname(__FILE__)) system "ruby service/service.rb start" system "ruby web/stay_alive.rb start" end desc "Stop #{@id}" task :stop do location = File.expand_path(File.dirname(__FILE__)) system "ruby service/service.rb stop" end EOF end |
#service_file ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/ci_in_a_can/cli/files.rb', line 62 def service_file <<EOF require 'ci_in_a_can' require 'daemons' this_directory = File.expand_path(File.dirname(__FILE__) + '/../') eval("CiInACan.results_location = '\#{this_directory}' + '/results'") ::Daemons.run_proc('#{@id}_ci_server') do loop do options = { access_token: ENV['GITHUB_AUTH_TOKEN'], working_location: this_directory + "/repos", watching_location: this_directory + "/jobs", site_url: ENV['SITE_URL'] } CiInACan::Daemon.start options sleep end end EOF end |
#web_daemon ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ci_in_a_can/cli/files.rb', line 34 def web_daemon <<EOF require 'daemons' this_directory = File.expand_path(File.dirname(__FILE__)) ::Daemons.run_proc('#{@id}_ci_web') do loop do exec "cd \#{this_directory};rackup -p 80" end end EOF end |
#web_file ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ci_in_a_can/cli/files.rb', line 48 def web_file <<EOF require 'ci_in_a_can' this_directory = File.expand_path(File.dirname(__FILE__) + '/../') eval("CiInACan::Web.jobs_location = '\#{this_directory}' + '/jobs'") eval("CiInACan.results_location = '\#{this_directory}' + '/results'") use CiInACan::Sinatra run Sinatra::Application EOF end |