Sha256: 8541b4de0eb1d1fb8440b25e1862a79c6df62a31b654b605a11204010cc4343c
Contents?: true
Size: 1.28 KB
Versions: 9
Compression:
Stored size: 1.28 KB
Contents
require_relative 'model_attribute' module Hippo module Command class GenerateScreen < NamedCommand OPTIONS = { title: '', description: '', icon: '', group_id: 'system', model_class: '', namespace: nil } class_options( OPTIONS ) attr_reader :screen_id, :screen_class def set_variables super options[:title] = name.titleize if options[:title].blank? @screen_id = class_name.underscore.dasherize @screen_class = class_name end 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 def add_definition insert_into_file "config/screens.rb", :after => /Hippo::Screen.for_extension.*?\n/ do source = File.expand_path(find_in_source_paths("config/screen.rb")) ERB.new(::File.binread(source), nil, "-","@output_buffer").result(binding) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems