Class: RailsApp::OptionsData

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_app/options_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ OptionsData

Returns a new instance of OptionsData.



7
8
9
# File 'lib/rails_app/options_data.rb', line 7

def initialize(args)
  @options = args
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/rails_app/options_data.rb', line 5

def options
  @options
end

Instance Method Details

#app_nameObject



11
12
13
# File 'lib/rails_app/options_data.rb', line 11

def app_name
  @options[0]
end

#default_action_cableObject



77
78
79
# File 'lib/rails_app/options_data.rb', line 77

def default_action_cable
  @options.include?("skip_action_cable")
end

#default_action_mailboxObject



65
66
67
# File 'lib/rails_app/options_data.rb', line 65

def default_action_mailbox
  @options.include?("skip_action_mailbox")
end

#default_action_mailerObject



61
62
63
# File 'lib/rails_app/options_data.rb', line 61

def default_action_mailer
  @options.include?("skip_action_mailer")
end

#default_action_storageObject



73
74
75
# File 'lib/rails_app/options_data.rb', line 73

def default_action_storage
  @options.include?("skip_action_storage")
end

#default_action_textObject



69
70
71
# File 'lib/rails_app/options_data.rb', line 69

def default_action_text
  @options.include?("skip_action_text")
end

#default_assetsObject



15
16
17
18
19
# File 'lib/rails_app/options_data.rb', line 15

def default_assets
  # puts "@options: #{@options.include?("sprockets")}"

  @options.include?("sprockets") ? "sprockets" : "propshaft"
end

#default_databaseObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rails_app/options_data.rb', line 37

def default_database
  if @options.include?("postgresql")
    "postgresql"
  elsif @options.include?("mysql")
    "mysql"
  elsif @options.include?("trilogy")
    "trilogy"
  elsif @options.include?("oracle")
    "oracle"
  elsif @options.include?("sqlserver")
    "sqlserver"
  elsif @options.include?("jdbcmysql")
    "jdbcmysql"
  elsif @options.include?("jdbcsqlite3")
    "jdbcsqlite3"
  elsif @options.include?("jdbcpostgresql")
    "jdbcpostgresql"
  elsif @options.include?("jdbc")
    "jdbc"
  else
    "sqlite3"
  end
end

#default_stylingObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rails_app/options_data.rb', line 21

def default_styling
  if @options.any? { |option| option.end_with?("tailwind") }
    "tailwind".strip
  elsif @options.any? { |option| option.end_with?("bulma") }
    "bulma".strip
  elsif @options.any? { |option| option.end_with?("postcss") }
    "postcss".strip
  elsif @options.any? { |option| option.end_with?("sass") }
    "sass"
  elsif @options.any? { |option| option.end_with?("bootstrap") }
    "bootstrap"
  else
    "bootstrap"
  end
end