Class: ScaffoldingCommands

Inherits:
Thor
  • Object
show all
Defined in:
lib/commands/scaffolding_commands.rb

Overview

:reek:FeatureEnvy { enabled: false } :reek:UtilityFunction { enabled: false } :reek:RepeatedConditional { enabled: false }

Instance Method Summary collapse

Instance Method Details

#feature(name) ⇒ Object



32
33
34
35
36
# File 'lib/commands/scaffolding_commands.rb', line 32

def feature(name)
  return delete_scaffolding(name, 'feature') if options[:delete]

  generate_scaffolding(name, 'feature', options[:path])
end

#helper(name) ⇒ Object



56
57
58
59
60
# File 'lib/commands/scaffolding_commands.rb', line 56

def helper(name)
  return delete_scaffolding(name, 'helper') if options[:delete]

  generate_scaffolding(name, 'helper', options[:path])
end

#page(name) ⇒ Object



18
19
20
21
22
# File 'lib/commands/scaffolding_commands.rb', line 18

def page(name)
  return delete_scaffolding(name, 'page') if options[:delete]

  generate_scaffolding(name, 'page', options[:path])
end

#scaffold(name) ⇒ Object



76
77
78
79
80
81
82
83
84
# File 'lib/commands/scaffolding_commands.rb', line 76

def scaffold(name)
  if Pathname.new('spec').exist? && !Pathname.new('features').exist?
    Scaffolding.new([name, load_config_path('spec')]).generate_spec
  else
    Scaffolding.new([name, load_config_path('feature')]).generate_feature
    Scaffolding.new([name, load_config_path('steps')]).generate_steps
  end
  Scaffolding.new([name, load_config_path('page')]).generate_page
end

#spec(name) ⇒ Object



44
45
46
47
48
# File 'lib/commands/scaffolding_commands.rb', line 44

def spec(name)
  return delete_scaffolding(name, 'spec') if options[:delete]

  generate_scaffolding(name, 'spec', options[:path])
end

#steps(name) ⇒ Object



68
69
70
71
72
# File 'lib/commands/scaffolding_commands.rb', line 68

def steps(name)
  return delete_scaffolding(name, 'steps') if options[:delete]

  generate_scaffolding(name, 'steps', options[:path])
end