-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1246 from dradis/setup-tweaks
Setup tweaks
- Loading branch information
Showing
2 changed files
with
17 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,12 @@ def new | |
def create | ||
case @kit | ||
when :none | ||
# weaksauce alert: this creates a Node which flags the Setup as done. | ||
Project.new.issue_library | ||
mark_as_done | ||
when :welcome | ||
kit_folder = Rails.root.join('lib','tasks', 'templates','welcome').to_s | ||
kit_folder = Rails.root.join('lib', 'tasks', 'templates', 'welcome').to_s | ||
logger = Log.new.info('Loading Welcome kit...') | ||
# Before we import the Kit we need at least 1 user | ||
User.create!(email: '[email protected]') | ||
User.create!(email: '[email protected]') unless defined?(Dradis::Pro) | ||
KitImportJob.perform_later(kit_folder, logger: logger) | ||
end | ||
|
||
|
@@ -24,9 +23,22 @@ def create | |
|
||
private | ||
def ensure_pristine | ||
defined?(Dradis::Pro) ? ensure_pristine_pro : ensure_pristine_ce | ||
end | ||
|
||
def ensure_pristine_ce | ||
redirect_to project_path(1) unless Node.count.zero? | ||
end | ||
|
||
def mark_as_done | ||
defined?(Dradis::Pro) ? mark_as_done_pro : mark_as_done_ce | ||
end | ||
|
||
def mark_as_done_ce | ||
# weaksauce alert: this creates a Node which flags the Setup as done. | ||
Project.new.issue_library | ||
end | ||
|
||
def set_kit | ||
if %w{none welcome}.include?(params[:kit]) | ||
@kit = params[:kit].to_sym | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters