Class: RubyRaider

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

Instance Method Summary collapse

Instance Method Details

#browser(default_browser) ⇒ Object



96
97
98
# File 'lib/ruby_raider.rb', line 96

def browser(default_browser)
  Utilities.new.browser = default_browser
end

#feature(name) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/ruby_raider.rb', line 37

def feature(name)
  path = options[:path].nil? ? load_config_path('feature') : options[:path]
  if options[:delete]
    Scaffolding.new([name, path]).delete_feature
  else
    Scaffolding.new([name, path]).generate_feature
  end
end

#helper(name) ⇒ Object



67
68
69
70
71
72
73
74
# File 'lib/ruby_raider.rb', line 67

def helper(name)
  path = options[:path].nil? ? load_config_path('helper') : options[:path]
  if options[:delete]
    Scaffolding.new([name, path]).delete_helper
  else
    Scaffolding.new([name, path]).generate_helper
  end
end

#new(project_name) ⇒ Object



12
13
14
# File 'lib/ruby_raider.rb', line 12

def new(project_name)
  MenuGenerator.generate_choice_menu(project_name)
end

#page(name) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/ruby_raider.rb', line 22

def page(name)
  path = options[:path].nil? ? load_config_path('page') : options[:path]
  if options[:delete]
    Scaffolding.new([name, path]).delete_class
  else
    Scaffolding.new([name, path]).generate_class
  end
end

#path(default_path) ⇒ Object



83
84
85
86
# File 'lib/ruby_raider.rb', line 83

def path(default_path)
  type = options.empty? ? 'page' : options.keys.first
  Utilities.new.send("#{type}_path=", default_path)
end

#raid ⇒ Object



102
103
104
# File 'lib/ruby_raider.rb', line 102

def raid
  Utilities.new.run
end

#scaffold(name) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/ruby_raider.rb', line 107

def scaffold(name)
  if Pathname.new('spec').exist? && !Pathname.new('features').exist?
    Scaffolding.new([name, load_config_path('spec')]).generate_spec
    Scaffolding.new([name, load_config_path('page')]).generate_class
  elsif Pathname.new('features').exist?
    Scaffolding.new([name, load_config_path('feature')]).generate_feature
    Scaffolding.new([name, load_config_path('page')]).generate_class
  else
    raise 'No features or spec folders where found. We are not sure which type of project you are running'
  end
end

#spec(name) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/ruby_raider.rb', line 52

def spec(name)
  path = options[:path].nil? ? load_config_path('spec') : options[:path]
  if options[:delete]
    Scaffolding.new([name, path]).delete_spec
  else
    Scaffolding.new([name, path]).generate_spec
  end
end

#url(default_url) ⇒ Object



90
91
92
# File 'lib/ruby_raider.rb', line 90

def url(default_url)
  Utilities.new.url = default_url
end