Sha256: 1d56d75bd6bfd04cec713b893a01e92d476d100394b452abec6a0e3ecaedb1f1
Contents?: true
Size: 1.67 KB
Versions: 3
Compression:
Stored size: 1.67 KB
Contents
module Jobshop module Generators class SiteGenerator < Rails::Generators::NamedBase source_root File.expand_path("../templates", __FILE__) desc "Create a jobshop site." attr_reader :site, :link_text, :first_site def require_environment ENV['RAILS_ENV'] ||= "development" require File.expand_path("config/environment.rb") end def create_site @site = Jobshop::Site.new end def generate_token @token = site.generate_configuration_token end def generate_secure_configuration_link link_protocol = Rails.env.development? ? "http" : "https" link_host = Rails.env.development? ? "localhost:3000" : "YOUR-HOST-NAME" # TODO: Give environments besides development a decent host and # protocol. HTTPS isn't mandatory in production but it is very, VERY # highly recommended. @link_text = Jobshop::Engine.routes.url_helpers.edit_site_url( @site, protocol: link_protocol, host: link_host, configuration_token: @token ) end def print_secure_configuration_link say <<-MESSAGE ### JOBSHOP - IMPORTANT INFORMATION ############################################ Your Jobshop site "#{name}" has been initialized. You may use the following link to complete the setup process. #{link_text} This link is valid for 30 minutes from now and will expire at: #{30.minutes.from_now.in_time_zone("Eastern Time (US & Canada)")} Thank you for using Jobshop! ################################################################################ MESSAGE end end end end
Version data entries
3 entries across 3 versions & 1 rubygems