Class: Specfac::CLI

Inherits:
Thor
  • Object
show all
Includes:
E2eModule, FactoryModule, SpecModule, SupportModule, Thor::Actions, Utils
Defined in:
lib/specfac.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from E2eModule

create, destroy, edit, index, new, show, update

Methods included from SupportModule

database_cleaner, factory_bot

Methods included from FactoryModule

create

Methods included from Utils

define_utils_methods_params, pl, pluralize, si, si_ca, singularize

Methods included from SpecModule

create, destroy, edit, index, new, show, update

Instance Attribute Details

#available_methodsObject

Returns the value of attribute available_methods.



46
47
48
# File 'lib/specfac.rb', line 46

def available_methods
  @available_methods
end

#dir_controllersObject

Returns the value of attribute dir_controllers.



46
47
48
# File 'lib/specfac.rb', line 46

def dir_controllers
  @dir_controllers
end

#dir_factoriesObject

Returns the value of attribute dir_factories.



46
47
48
# File 'lib/specfac.rb', line 46

def dir_factories
  @dir_factories
end

#dir_featuresObject

Returns the value of attribute dir_features.



46
47
48
# File 'lib/specfac.rb', line 46

def dir_features
  @dir_features
end

#dir_supportObject

Returns the value of attribute dir_support.



46
47
48
# File 'lib/specfac.rb', line 46

def dir_support
  @dir_support
end

#pathsObject

Returns the value of attribute paths.



46
47
48
# File 'lib/specfac.rb', line 46

def paths
  @paths
end

#working_dirsObject

Returns the value of attribute working_dirs.



46
47
48
# File 'lib/specfac.rb', line 46

def working_dirs
  @working_dirs
end

#working_fileObject

Returns the value of attribute working_file.



46
47
48
# File 'lib/specfac.rb', line 46

def working_file
  @working_file
end

Instance Method Details

#__print_versionObject



104
105
106
# File 'lib/specfac.rb', line 104

def __print_version
  puts Specfac.show_v
end

#extract(dest) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/specfac.rb', line 72

def extract(dest)
  @paths = $paths
  @paths[:options]["path"] = dest
  puts "Setting extract destination..."
  create_file(@paths[:options_path])
  opener(nil, @paths[:options].to_json, "w", @paths[:options_path])
end

#generate(*args) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/specfac.rb', line 86

def generate(*args)
  init_vars(options)

  controller = args.shift
  actions = args

  if controller
    sanitize(controller, actions, options)
  else
    puts "Please provide a controller name."
    exit
  end
end

#setup(*args) ⇒ Object



111
112
113
114
115
116
# File 'lib/specfac.rb', line 111

def setup(*args)
  init_vars
  @working_file = "#{@dir_support}/specfac/config.rb"
  create_file(@working_file)
  args != nil ? args.each {|arg| opener("support", SupportModule.public_send(arg.to_sym), "a")} : nil
end