Class: Hippo::Command::GenerateScreen
- Inherits:
-
NamedCommand
- Object
- Thor::Group
- NamedCommand
- Hippo::Command::GenerateScreen
- Defined in:
- lib/hippo/command/generate_screen.rb
Constant Summary collapse
- OPTIONS =
{ title: '', description: '', icon: '', group_id: 'system', model_class: '', namespace: nil }
Instance Attribute Summary collapse
-
#screen_class ⇒ Object
readonly
Returns the value of attribute screen_class.
-
#screen_id ⇒ Object
readonly
Returns the value of attribute screen_id.
Attributes inherited from NamedCommand
#class_name, #client_dir, #identifier, #namespace, #spec_dir
Instance Method Summary collapse
Methods inherited from NamedCommand
Instance Attribute Details
#screen_class ⇒ Object (readonly)
Returns the value of attribute screen_class.
17 18 19 |
# File 'lib/hippo/command/generate_screen.rb', line 17 def screen_class @screen_class end |
#screen_id ⇒ Object (readonly)
Returns the value of attribute screen_id.
17 18 19 |
# File 'lib/hippo/command/generate_screen.rb', line 17 def screen_id @screen_id end |
Instance Method Details
#add_definition ⇒ Object
31 32 33 34 35 36 |
# File 'lib/hippo/command/generate_screen.rb', line 31 def add_definition insert_into_file "config/screens.rb", :after => /Hippo::Screen.for_extension.*?\n/ do source = File.(find_in_source_paths("config/screen.rb")) ERB.new(::File.binread(source), nil, "-","@output_buffer").result(binding) end end |
#create_screen ⇒ Object
26 27 28 29 |
# File 'lib/hippo/command/generate_screen.rb', line 26 def create_screen template "client/screens/screen.jsx", "#{client_dir}/screens/#{screen_id}.jsx" template "spec/client/screen.spec.jsx", "spec/client/screens/#{screen_id}.spec.jsx" end |
#set_variables ⇒ Object
19 20 21 22 23 24 |
# File 'lib/hippo/command/generate_screen.rb', line 19 def set_variables super [:title] = name.titleize if [:title].blank? @screen_id = class_name.underscore.dasherize @screen_class = class_name end |