Top Level Namespace

Defined Under Namespace

Modules: BaseHelper, BulletTrain, Colorizer, DeviseCurrentAttributes, DocumentationSupport, EmailHelper, InvitationOnlyHelper, Invitations, InvitationsHelper, InviteOnlySupport, Memberships, RootRedirect, Teams, Users Classes: Address, ApplicationController, ApplicationHash, ApplicationRecord, DeviseMailer, Invitation, Membership, RegistrationsController, RemovingLastTeamAdminException, RemovingLastTeamException, SessionsController, Team, User, UserMailer

Instance Method Summary collapse

Instance Method Details

#any_oauth_enabled?Boolean

Returns:

  • (Boolean)


136
137
138
139
140
141
# File 'lib/bullet_train.rb', line 136

def any_oauth_enabled?
  [
    stripe_enabled?,
    # 🚅 super scaffolding will insert new oauth provider checks above this line.
  ].select(&:present?).any?
end

#billing_enabled?Boolean

Returns:

  • (Boolean)


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

def billing_enabled?
  (ENV["STRIPE_SECRET_KEY"].present? || ENV["PADDLE_SECRET_KEY"].present?) && defined?(BulletTrain::Billing)
end

#billing_subscription_creation_disabled?Boolean

TODO This should be in an initializer or something.

Returns:

  • (Boolean)


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

def billing_subscription_creation_disabled?
  false
end

#bulk_invitations_enabled?Boolean

Returns:

  • (Boolean)


172
173
174
# File 'lib/bullet_train.rb', line 172

def bulk_invitations_enabled?
  BulletTrain::Configuration.enable_bulk_invitations
end

#cloudinary_enabled?Boolean

Returns:

  • (Boolean)


126
127
128
# File 'lib/bullet_train.rb', line 126

def cloudinary_enabled?
  ENV["CLOUDINARY_URL"].present?
end

#default_url_options_from_base_urlObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/bullet_train.rb', line 52

def default_url_options_from_base_url
  unless ENV["BASE_URL"].present?
    if Rails.env.development?
      ENV["BASE_URL"] = "http://localhost:3000"
    else
      return {}
    end
  end

  parsed_base_url = URI.parse(ENV["BASE_URL"])
  default_url_options = [:user, :password, :host, :port].map { |key| [key, parsed_base_url.send(key)] }.to_h

  # the name of this property doesn't match up.
  default_url_options[:protocol] = parsed_base_url.scheme
  default_url_options.compact!

  if default_url_options.empty?
    raise "ENV['BASE_URL'] has not been configured correctly. Please check your environment variables and try one more time."
  end

  default_url_options
end

#demo?Boolean

Returns:

  • (Boolean)


122
123
124
# File 'lib/bullet_train.rb', line 122

def demo?
  ENV["DEMO"].present?
end

#disable_developer_menu?Boolean

Returns:

  • (Boolean)


176
177
178
# File 'lib/bullet_train.rb', line 176

def disable_developer_menu?
  ENV["DISABLE_DEVELOPER_MENU"].present?
end

#font_awesome?Boolean

Returns:

  • (Boolean)


152
153
154
# File 'lib/bullet_train.rb', line 152

def font_awesome?
  ENV["FONTAWESOME_NPM_AUTH_TOKEN"].present?
end

#free_trial?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/bullet_train.rb', line 92

def free_trial?
  ENV["STRIPE_FREE_TRIAL_LENGTH"].present?
end

#heroku?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/bullet_train.rb', line 75

def heroku?
  ENV["HEROKU_APP_NAME"].present?
end

#hide_examples?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/bullet_train.rb', line 110

def hide_examples?
  ActiveModel::Type::Boolean.new.cast(ENV["HIDE_EXAMPLES"])
end

#hide_things?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/bullet_train.rb', line 106

def hide_things?
  ActiveModel::Type::Boolean.new.cast(ENV["HIDE_THINGS"])
end

#inbound_email_enabled?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/bullet_train.rb', line 79

def inbound_email_enabled?
  ENV["INBOUND_EMAIL_DOMAIN"].present?
end

#invitation_keysObject



148
149
150
# File 'lib/bullet_train.rb', line 148

def invitation_keys
  ENV["INVITATION_KEYS"].split(",").map(&:strip)
end

#invitation_only?Boolean

Returns:

  • (Boolean)


144
145
146
# File 'lib/bullet_train.rb', line 144

def invitation_only?
  ENV["INVITATION_KEYS"].present?
end

#multiple_locales?Boolean

Returns:

  • (Boolean)


156
157
158
# File 'lib/bullet_train.rb', line 156

def multiple_locales?
  @multiple_locales ||= I18n.available_locales.many?
end

#openai_enabled?Boolean

Returns:

  • (Boolean)


164
165
166
# File 'lib/bullet_train.rb', line 164

def openai_enabled?
  ENV["OPENAI_ACCESS_TOKEN"].present?
end

#openai_organization_exists?Boolean

Returns:

  • (Boolean)


168
169
170
# File 'lib/bullet_train.rb', line 168

def openai_organization_exists?
  ENV["OPENAI_ORGANIZATION_ID"]
end

#sample_role_disabled?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/bullet_train.rb', line 118

def sample_role_disabled?
  hide_examples?
end

#scaffolding_things_disabled?Boolean

Returns:

  • (Boolean)


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

def scaffolding_things_disabled?
  hide_things? || hide_examples?
end

#silence_logs?Boolean

Returns:

  • (Boolean)


160
161
162
# File 'lib/bullet_train.rb', line 160

def silence_logs?
  ENV["SILENCE_LOGS"].present?
end

#stripe_enabled?Boolean

Returns:

  • (Boolean)


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

def stripe_enabled?
  ENV["STRIPE_CLIENT_ID"].present?
end

#two_factor_authentication_enabled?Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/bullet_train.rb', line 130

def two_factor_authentication_enabled?
  Rails.application.credentials.active_record_encryption&.primary_key.present? || Rails.configuration&.active_record&.encryption&.primary_key.present?
end

#webhooks_enabled?Boolean

🚅 super scaffolding will insert new oauth providers above this line.

Returns:

  • (Boolean)


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

def webhooks_enabled?
  true
end