Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
jarod022 committed Apr 12, 2017
2 parents f3392e3 + 2971fd2 commit 6127812
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .fabmanager-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.1
2.5.2
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -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'
4 changes: 0 additions & 4 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -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 changes: 29 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ SMTP_PASSWORD:
GA_ID: ''
##

ADMIN_EMAIL: '[email protected]'
ADMIN_PASSWORD: 'adminadmin'

DISQUS_SHORTNAME:

TWITTER_NAME: 'FablabGrenoble'
Expand Down
8 changes: 8 additions & 0 deletions config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"] %>
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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"] %>
7 changes: 3 additions & 4 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@
end

# Create the admin if it does not exist yet
if User.find_by(email: '[email protected]').nil?
admin = User.new(username: 'admin', email: '[email protected]', 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
Expand Down
3 changes: 3 additions & 0 deletions docker/env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ SMTP_PORT=587
SMTP_USER_NAME=
SMTP_PASSWORD=

ADMIN_EMAIL=
ADMIN_PASSWORD=

GA_ID=

DISQUS_SHORTNAME=
Expand Down

0 comments on commit 6127812

Please sign in to comment.