class ReduxGen::CLI

Public Instance Methods

new(component, name) click to toggle source
# File lib/redux_gen.rb, line 10
def new(component, name)
  Validations.validate component
  Validations.validate_directory_for component
  Validations.validate_test_directory_for component
  make component, name
  make_test component, name
end

Private Instance Methods

make(component, name) click to toggle source
# File lib/redux_gen.rb, line 26
def make(component, name)
  path = Validations.component_path component, name
  template = Template.new(component, name).render
  write_out(path, template)
end
make_test(component, name) click to toggle source
# File lib/redux_gen.rb, line 32
def make_test(component, name)
  test_path = Validations.test_path component, name
  test_template = Template.new(component, name, test: true).render
  write_out(test_path, test_template)
end
write_out(path, content) click to toggle source
# File lib/redux_gen.rb, line 20
def write_out(path, content)
  open(path, 'w') do |output|
    output.write content
  end
end