class Starter
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/r4/starter.rb, line 9 def initialize(*args) super if ARGV[0] =~ /new/ @dir = `pwd`.gsub("\n", '') elsif ARGV[0] =~ /add/ if yes? 'Are you in right folder of your app?' @project_path = `pwd`.gsub("\n", '') @project_name = @project_path.split('/').last @project_label = @project_name.capitalize.gsub('_', ' ') else say 'Get to proper directory', :red abort end end end
Public Instance Methods
add_best_in_place()
click to toggle source
# File lib/r4/starter.rb, line 83 def add_best_in_place say 'Not ready yet!', :red #gem 'best_in_place' end
add_datatables()
click to toggle source
# File lib/r4/starter.rb, line 66 def add_datatables say 'Not ready yet!', :red #gem 'jquery-datatables-rails', '~> 2.2.3' end
add_exception_notification()
click to toggle source
# File lib/r4/starter.rb, line 72 def add_exception_notification apply 'recipes/exception_notification.rb' end
add_gem(name)
click to toggle source
# File lib/r4/starter.rb, line 109 def add_gem name append_to_file "#{@project_path}/Gemfile" do "\ngem '#{name}'" end end
add_lazy_charts()
click to toggle source
# File lib/r4/starter.rb, line 61 def add_lazy_charts apply 'recipes/lazy_high_charts.rb' end
add_mail_gem()
click to toggle source
# File lib/r4/starter.rb, line 89 def add_mail_gem say 'Not ready yet!', :red #gem 'mail' end
add_skylight()
click to toggle source
# File lib/r4/starter.rb, line 77 def add_skylight say 'Not ready yet!', :red #gem 'skylight' end
add_wicked_pdf()
click to toggle source
# File lib/r4/starter.rb, line 51 def add_wicked_pdf apply 'recipes/wicked_pdf.rb' end
add_xlsx_support()
click to toggle source
# File lib/r4/starter.rb, line 56 def add_xlsx_support apply 'recipes/xlsx_support.rb' end
copy(filename)
click to toggle source
# File lib/r4/starter.rb, line 101 def copy filename copy_file filename, "#{@project_path}/#{filename}" end
new(project_name)
click to toggle source
# File lib/r4/starter.rb, line 33 def new project_name @project_name = project_name run "rails new #{@project_name} -T --skip-bundle" @project_path = "#{@dir}/#{@project_name}" @project_label = @project_name.capitalize.gsub('_', ' ') Dir.chdir @project_path # TODO read some config folder in home directory for user customized installations types unless options[:type] apply 'installations/default.rb' else apply "installations/#{options[:type]}.rb" end end
remove(filename)
click to toggle source
# File lib/r4/starter.rb, line 105 def remove filename remove_file "#{@project_path}/#{filename}" end
source_paths()
click to toggle source
# File lib/r4/starter.rb, line 96 def source_paths root_path = File.dirname __FILE__ [root_path + '/template', root_path] end