Class: Starter

Inherits:
Thor
  • Object
show all
Includes:
Odin, Thor::Actions
Defined in:
lib/r4/starter.rb

Instance Method Summary collapse

Methods included from Odin

#bundle, #concat, #content, #cp, #cp_template, #file, #git, #gsub, #rails, #rake, #rm, #sub

Constructor Details

#initialize(*args) ⇒ Starter

Returns a new instance of Starter.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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

Instance Method Details

#add_best_in_placeObject



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

def add_best_in_place
  say 'Not ready yet!', :red
  #gem 'best_in_place'
end

#add_datatablesObject



66
67
68
69
# 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_notificationObject



72
73
74
# File 'lib/r4/starter.rb', line 72

def add_exception_notification
  apply 'recipes/exception_notification.rb'
end

#add_lazy_chartsObject



61
62
63
# File 'lib/r4/starter.rb', line 61

def add_lazy_charts
  apply 'recipes/lazy_high_charts.rb'
end

#add_mail_gemObject



89
90
91
92
# File 'lib/r4/starter.rb', line 89

def add_mail_gem
  say 'Not ready yet!', :red
  #gem 'mail'
end

#add_skylightObject



77
78
79
80
# File 'lib/r4/starter.rb', line 77

def add_skylight
  say 'Not ready yet!', :red
  #gem 'skylight'
end

#add_wicked_pdfObject



51
52
53
# File 'lib/r4/starter.rb', line 51

def add_wicked_pdf
  apply 'recipes/wicked_pdf.rb'
end

#add_xlsx_supportObject



56
57
58
# File 'lib/r4/starter.rb', line 56

def add_xlsx_support
  apply 'recipes/xlsx_support.rb'
end

#new(project_name) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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