Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added administrate. #352

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions recipes/admin.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
# Application template recipe for the rails_apps_composer. Change the recipe here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/admin.rb
# This is the file where you can add other admin backends.

prefs[:admin] = config['admin'] unless (config['admin'] == 'none')

if prefer :admin, 'activeadmin'
add_gem 'activeadmin', '~> 1.0.0.pre2'

elsif prefer :admin, 'rails_admin'
add_gem 'rails_admin'

elsif prefer :admin, 'administrate'
add_gem 'administrate', '~> 0.1.2' #Adding administrate

end

stage_two do
say_wizard "recipe stage two"

if prefer :admin, 'activeadmin'
say_wizard "recipe installing activeadmin"
generate 'active_admin:install'
end

if prefer :admin, 'rails_admin'
say_wizard "recipe installing rails_admin"
generate 'rails_admin:install'
end

if prefer :admin, 'administrate'
say_wizard "recipe installing administrate"
generate 'administrate:install'
### GIT
git :add => '-A' if prefer :git, true
git :commit => %Q(-qm "rails_apps_composer: installed #{prefs[:admin]}") if prefer :git, true
Expand All @@ -28,7 +40,7 @@

name: admin
description: "Adding rails admin gem to your application"
author: JangoSteve
author: JangoSteve, Bishisht Bhatta

category: admin
requires: [setup]
Expand All @@ -39,4 +51,4 @@
- admin:
type: multiple_choice
prompt: Install admin gem?
choices: [ ["None", "none"], ["ActiveAdmin", "activeadmin"], ["RailsAdmin", "rails_admin"] ]
choices: [ ["None", "none"], ["ActiveAdmin", "activeadmin"], ["RailsAdmin", "rails_admin"], ["Administrate by Thoughtbot", "administrate"] ]
1 change: 1 addition & 0 deletions recipes/analytics.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Application template recipe for the rails_apps_composer. Change the recipe here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/analytics.rb
# If you want to use other analytics engine add them here and you are ready to go.

prefs[:analytics] = multiple_choice "Install page-view analytics?", [["None", "none"],
["Google Analytics", "ga"],
Expand Down
5 changes: 5 additions & 0 deletions recipes/roles.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Application template recipe for the rails_apps_composer. Change the recipe here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/roles.rb

# Helps to assign different kinds of roles to users. Like guest, moderator etc.

stage_two do
say_wizard "recipe stage two"

if (prefer :authorization, 'roles') || (prefer :authorization, 'pundit')
if prefer :authentication, 'none'
generate 'model User email:string'
Expand All @@ -29,6 +32,8 @@ def set_default_role
git :commit => '-qm "rails_apps_composer: add roles to a User model"' if prefer :git, true
end

# Normally, ruby scripts are finished when you reach the end of a file; however, this is not always the case. You can end your script sooner by using the __END__ keyword in your script.
# Once added, everything you type after that will not be parsed by ruby.
__END__

name: roles
Expand Down
13 changes: 10 additions & 3 deletions recipes/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@
## Ruby on Rails
HOST_OS = RbConfig::CONFIG['host_os']
say_wizard "Your operating system is #{HOST_OS}."
say_wizard "You are using Ruby version #{RUBY_VERSION}."
say_wizard "You are using Rails version #{Rails::VERSION::STRING}."
say_wizard "You are using Ruby version: #{RUBY_VERSION}."
say_wizard "You are using Rails version: #{Rails::VERSION::STRING}."

## Is sqlite3 in the Gemfile?
gemfile = File.read(destination_root() + '/Gemfile')
sqlite_detected = gemfile.include? 'sqlite3'

## Web Server
## Web Server ##

# Select for development
prefs[:dev_webserver] = multiple_choice "Web server for development?", [["WEBrick (default)", "webrick"],
["Thin", "thin"], ["Unicorn", "unicorn"], ["Puma", "puma"], ["Phusion Passenger (Apache/Nginx)", "passenger"],
["Phusion Passenger (Standalone)", "passenger_standalone"]] unless prefs.has_key? :dev_webserver

# Select for production
prefs[:prod_webserver] = multiple_choice "Web server for production?", [["Same as development", "same"],
["Thin", "thin"], ["Unicorn", "unicorn"], ["Puma", "puma"], ["Phusion Passenger (Apache/Nginx)", "passenger"],
["Phusion Passenger (Standalone)", "passenger_standalone"]] unless prefs.has_key? :prod_webserver

# A cool trick comparing if two arrays are 'same'
prefs[:prod_webserver] = prefs[:dev_webserver] if prefs[:prod_webserver] == 'same'

## Database Adapter
Expand Down Expand Up @@ -66,6 +72,7 @@
prefs[:devise_modules] = multiple_choice "Devise modules?", [["Devise with default modules","default"],
["Devise with Confirmable module","confirmable"],
["Devise with Confirmable and Invitable modules","invitable"]] unless prefs.has_key? :devise_modules

when 'omniauth'
prefs[:omniauth_provider] = multiple_choice "OmniAuth provider?", [["Facebook", "facebook"], ["Twitter", "twitter"], ["GitHub", "github"],
["LinkedIn", "linkedin"], ["Google-Oauth-2", "google_oauth2"], ["Tumblr", "tumblr"]] unless prefs.has_key? :omniauth_provider
Expand Down