Class: RubyRaider

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

Instance Method Summary collapse

Instance Method Details

#browser(default_browser = nil) ⇒ Object



106
107
108
109
110
# File 'lib/ruby_raider.rb', line 106

def browser(default_browser = nil)
  Utilities.new.browser = default_browser unless default_browser.nil?
  Utilities.new.browser_options = options[:opts] unless options[:opts].nil?
  Utilities.new.delete_browser_options if options[:delete]
end

#configObject



138
139
140
141
142
143
144
# File 'lib/ruby_raider.rb', line 138

def config
  if options[:delete]
    Scaffolding.new.delete_config
  else
    Scaffolding.new.generate_config
  end
end

#feature(name) ⇒ Object



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

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



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

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



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

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



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

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

#raidObject



114
115
116
# File 'lib/ruby_raider.rb', line 114

def raid
  Utilities.new.run
end

#scaffold(name) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/ruby_raider.rb', line 120

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



55
56
57
58
59
60
61
62
# File 'lib/ruby_raider.rb', line 55

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



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

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