1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

Merge branch 'dev'

This commit is contained in:
cyril 2017-04-12 20:34:35 +02:00
commit 61278127d5
10 changed files with 56 additions and 14 deletions

View File

@ -1 +1 @@
2.5.1
2.5.2

View File

@ -1,5 +1,9 @@
# Changelog Fab Manager
## v2.5.2 April 12
- Extracts first admin created email and password into environment variables
- [OPTIONAL: Only for a new installation] add `ADMIN_EMAIL` and `ADMIN_PASSWORD` environment variable in `application.yml` or `env` file (with docker)
## v2.5.1 2017 March 28
- hide spaces in admin's credit management if spaces are disabled
- Fix a bug : Can not display training tracking (this bug was introduced in version 2.5.0)

View File

@ -277,6 +277,10 @@ Maximum size (in bytes) allowed for image uploaded on the platform.
This parameter concerns events, plans, user's avatars, projects and steps of projects.
If this parameter is not specified the maximum size allowed will be 2MB.
ADMIN_EMAIL, ADMIN_PASSWORD
Credentials for the first admin user created when seeding the project.
Settings related to Open Projects
See the [Open Projects](#open-projects) section for a detailed description of these parameters.

View File

@ -1,8 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'

View File

@ -1,8 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require_relative '../config/boot'
require 'rake'
Rake.application.run

29
bin/setup Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
require 'pathname'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
Dir.chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file:
puts "== Installing dependencies =="
system "gem install bundler --conservative"
system "bundle check || bundle install"
# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# system "cp config/database.yml.sample config/database.yml"
# end
puts "\n== Preparing database =="
system "bin/rake db:setup"
puts "\n== Removing old logs and tempfiles =="
system "rm -f log/*"
system "rm -rf tmp/cache"
puts "\n== Restarting application server =="
system "touch tmp/restart.txt"
end

View File

@ -27,6 +27,9 @@ SMTP_PASSWORD:
GA_ID: ''
##
ADMIN_EMAIL: 'admin@fab-manager.com'
ADMIN_PASSWORD: 'adminadmin'
DISQUS_SHORTNAME:
TWITTER_NAME: 'FablabGrenoble'

View File

@ -41,6 +41,8 @@ development:
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
admin_email: <%= ENV["ADMIN_EMAIL"] %>
admin_password: <%= ENV["ADMIN_PASSWORD"] %>
test:
secret_key_base: 83daf5e7b80d990f037407bab78dff9904aaf3c195a50f84fa8695a22287e707dfbd9524b403b1dcf116ae1d8c06844c3d7ed942564e5b46be6ae3ead93a9d30
@ -73,6 +75,8 @@ test:
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
elaticsearch_host: localhost
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
admin_email: <%= ENV["ADMIN_EMAIL"] %>
admin_password: <%= ENV["ADMIN_PASSWORD"] %>
staging:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@ -110,6 +114,8 @@ staging:
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
admin_email: <%= ENV["ADMIN_EMAIL"] %>
admin_password: <%= ENV["ADMIN_PASSWORD"] %>
# Do not keep production secrets in the repository,
# instead read values from the environment.
@ -150,3 +156,5 @@ production:
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
admin_email: <%= ENV["ADMIN_EMAIL"] %>
admin_password: <%= ENV["ADMIN_PASSWORD"] %>

View File

@ -83,11 +83,10 @@ if Group.count == 0
end
# Create the admin if it does not exist yet
if User.find_by(email: 'admin@fab-manager.com').nil?
admin = User.new(username: 'admin', email: 'admin@fab-manager.com', password: 'adminadmin', password_confirmation: 'adminadmin', group_id: Group.first.id,
profile_attributes: {first_name: 'admin', last_name: 'admin', gender: true, phone: '0123456789', birthday: Time.now})
if User.find_by(email: Rails.application.secrets.admin_email).nil?
admin = User.new(username: 'admin', email: Rails.application.secrets.admin_email, password: Rails.application.secrets.admin_password, password_confirmation: Rails.application.secrets.admin_password, group_id: Group.first.id, profile_attributes: {first_name: 'admin', last_name: 'admin', gender: true, phone: '0123456789', birthday: Time.now})
admin.add_role 'admin'
admin.save
admin.save!
end
if Component.count == 0

View File

@ -22,6 +22,9 @@ SMTP_PORT=587
SMTP_USER_NAME=
SMTP_PASSWORD=
ADMIN_EMAIL=
ADMIN_PASSWORD=
GA_ID=
DISQUS_SHORTNAME=