Class: Xnlogic::CLI::Core
- Inherits:
-
Object
- Object
- Xnlogic::CLI::Core
- Defined in:
- lib/xnlogic/cli/core.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#ignore_options ⇒ Object
readonly
Returns the value of attribute ignore_options.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#thor ⇒ Object
readonly
Returns the value of attribute thor.
Instance Method Summary collapse
- #in_existing_project ⇒ Object
-
#initialize(options, thor) ⇒ Core
constructor
A new instance of Core.
- #write_options ⇒ Object
Constructor Details
#initialize(options, thor) ⇒ Core
Returns a new instance of Core.
8 9 10 11 12 13 |
# File 'lib/xnlogic/cli/core.rb', line 8 def initialize(, thor) @ignore_options ||= [] @options = {}.merge @thor = thor @app = Pathname.pwd end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
6 7 8 |
# File 'lib/xnlogic/cli/core.rb', line 6 def app @app end |
#ignore_options ⇒ Object (readonly)
Returns the value of attribute ignore_options.
6 7 8 |
# File 'lib/xnlogic/cli/core.rb', line 6 def @ignore_options end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/xnlogic/cli/core.rb', line 6 def @options end |
#thor ⇒ Object (readonly)
Returns the value of attribute thor.
6 7 8 |
# File 'lib/xnlogic/cli/core.rb', line 6 def thor @thor end |
Instance Method Details
#in_existing_project ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/xnlogic/cli/core.rb', line 15 def in_existing_project if .exist? = YAML.load_file(.to_s) @options = .merge else Xnlogic.ui.info "Not in an existing project. Please run the 'application' command first." exit 1 end self end |
#write_options ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/xnlogic/cli/core.rb', line 26 def Dir.mkdir(app.join('config')) unless app.join('config').exist? opts = .clone .each do |x| opts.delete x end File.open(.to_s, 'w') do |f| f.puts YAML.dump opts end end |