Class: AgileProxy::Cli
- Inherits:
-
Thor
- Object
- Thor
- AgileProxy::Cli
- Defined in:
- lib/agile_proxy/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.data_dir ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/agile_proxy/cli.rb', line 24 def data_dir if Dir.pwd == File.('../..', File.dirname(__FILE__)) Dir.pwd else File.join data_dir_base, '.agile_proxy' end end |
.data_dir_base ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/agile_proxy/cli.rb', line 10 def data_dir_base if RUBY_PLATFORM =~ /win32/ ENV['APPDATA'] elsif RUBY_PLATFORM =~ /linux/ ENV['HOME'] elsif RUBY_PLATFORM =~ /darwin/ ENV['HOME'] elsif RUBY_PLATFORM =~ /freebsd/ ENV['HOME'] else ENV['HOME'] end end |
.environment ⇒ Object
32 33 34 |
# File 'lib/agile_proxy/cli.rb', line 32 def environment ENV['AGILE_PROXY_ENV'] || (Dir.pwd == File.('../..', File.dirname(__FILE__)) ? 'development' : 'production') end |
Instance Method Details
#start(proxy_port = nil, server_port = nil, webserver_port = nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/agile_proxy/cli.rb', line 39 def start(proxy_port = nil, server_port = nil, webserver_port = nil) ensure_database_config_file_exists database_config_file() puts "Data dir is #{.data_dir}, environment is #{.env}" setup_for_migrations() ::AgileProxy.configure do |config| config.proxy_port = proxy_port unless proxy_port.nil? config.server_port = server_port unless server_port.nil? config.webserver_port = webserver_port unless webserver_port.nil? config.environment = .env config.database_config_file = database_config_file() end server = AgileProxy::Server.new update_db server.start end |