Class: Xnlogic::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/xnlogic/cli.rb
Defined Under Namespace
Classes: Application, Core, Deploy
Class Method Summary collapse
- .handle_no_command_error(command, has_namespace = $thor_runner) ⇒ Object
- .source_root ⇒ Object
- .start ⇒ Object
- .vm_config_options ⇒ Object
Instance Method Summary collapse
- #application(name = nil) ⇒ Object
- #destroy ⇒ Object
- #gem_sources ⇒ Object
- #halt ⇒ Object
- #help(cli = nil) ⇒ Object
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
- #key(xn_key) ⇒ Object
- #provision ⇒ Object
- #server_profile(hostname) ⇒ Object
- #ssh ⇒ Object
- #up ⇒ Object
- #version ⇒ Object
- #vm_config ⇒ Object
Constructor Details
Class Method Details
.handle_no_command_error(command, has_namespace = $thor_runner) ⇒ Object
53 54 55 56 |
# File 'lib/xnlogic/cli.rb', line 53 def self.handle_no_command_error(command, has_namespace = $thor_runner) return super unless command_path = Xnlogic.which("xnlogic-#{command}") Kernel.exec(command_path, *ARGV[1..-1]) end |
.source_root ⇒ Object
175 176 177 |
# File 'lib/xnlogic/cli.rb', line 175 def self.source_root File.(File.join(File.dirname(__FILE__), 'templates')) end |
.start ⇒ Object
9 10 11 12 13 14 |
# File 'lib/xnlogic/cli.rb', line 9 def self.start(*) super rescue Exception => e Xnlogic.ui = UI::Shell.new raise e end |
.vm_config_options ⇒ Object
59 60 61 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/xnlogic/cli.rb', line 59 def self. method_option "key", type: :string, banner: "You must supply an XN key to be able to download the proprietary dependencies needed to boot your application" method_option "cpus", type: :numeric, banner: "Number of Virtual CPUs the Development VM should use (default 2)" method_option "memory", type: :numeric, banner: "Amount of RAM to allow the Development VM to use (default 2048, in MB)" method_option "root", type: :string, banner: "Optionally specify a different root directory name" method_option "provision", type: :boolean, banner: "Update the VM with the new provisioning settings" method_option "up", type: :boolean, banner: "Start the the VM (will provision automatically only on the first run)" method_option "datomic_version", type: :string, banner: "Optionally specify the desired Datomic version number" method_option "datomic_pro", type: :boolean, banner: "Use pacer-mcfly-pro instead of pacer-mcfly-free" method_option "datomic_mysql", type: :boolean, banner: "Add pacer-mcfly-mysql dependency. Implies datomic-pro." method_option "datomic_username", type: :string, banner: "Your my.datomic.com account username, needed for Datomic jar downloads" method_option "datomic_key", type: :string, banner: "Your my.datomic.com download key, needed for Datomic jar downloads" method_option "datomic_license", type: :string, banner: "File location of your my.datomic.com license key, needed for the Datomic Pro transactor" end |
Instance Method Details
#application(name = nil) ⇒ Object
96 97 98 99 100 101 102 103 104 |
# File 'lib/xnlogic/cli.rb', line 96 def application(name = nil) app = Application.new(, self) if ['same'] or name.nil? app.in_existing_project else app.set_name(name) end app.application end |
#destroy ⇒ Object
146 147 148 |
# File 'lib/xnlogic/cli.rb', line 146 def destroy exec 'vagrant destroy' end |
#gem_sources ⇒ Object
119 120 121 122 123 |
# File 'lib/xnlogic/cli.rb', line 119 def gem_sources app = Application.new(, self).in_existing_project app.show_source "https://rubygems.org/" app.show_source "https://#{app.['key']}@gems.xnlogic.com/" end |
#halt ⇒ Object
141 142 143 |
# File 'lib/xnlogic/cli.rb', line 141 def halt exec 'vagrant halt' end |
#help(cli = nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/xnlogic/cli.rb', line 35 def help(cli = nil) case cli when nil then command = "xnlogic" else command = "xnlogic-#{cli}" end manpages = %w(xnlogic) if manpages.include?(command) root = File.("../man", __FILE__) if Xnlogic.which("man") && root !~ %r{^file:/.+!/META-INF/jruby.home/.+} Kernel.exec "man #{root}/#{command}" else puts File.read("#{root}/#{command}.txt") end else super end end |
#key(xn_key) ⇒ Object
151 152 153 154 |
# File 'lib/xnlogic/cli.rb', line 151 def key(xn_key) app = Application.new(, self) app.update_key(xn_key) end |
#provision ⇒ Object
131 132 133 |
# File 'lib/xnlogic/cli.rb', line 131 def provision system 'vagrant provision' end |
#server_profile(hostname) ⇒ Object
164 165 166 167 |
# File 'lib/xnlogic/cli.rb', line 164 def server_profile(hostname) app = Deploy.new(, self) app.server_profile(hostname) end |
#ssh ⇒ Object
136 137 138 |
# File 'lib/xnlogic/cli.rb', line 136 def ssh exec 'vagrant ssh' end |
#up ⇒ Object
126 127 128 |
# File 'lib/xnlogic/cli.rb', line 126 def up system 'vagrant up' end |
#version ⇒ Object
170 171 172 |
# File 'lib/xnlogic/cli.rb', line 170 def version puts(Xnlogic::VERSION) end |
#vm_config ⇒ Object
110 111 112 |
# File 'lib/xnlogic/cli.rb', line 110 def vm_config Application.new(, self).in_existing_project.vm_config end |