Extract BimSeeder to a module

pull/7115/head
Wieland Lindenthal 6 years ago
parent 1931d03d51
commit 898514102b
  1. 6
      Gemfile.lock
  2. 2
      Gemfile.modules
  3. 6
      app/seeders/root_seeder.rb
  4. 19
      modules/bim_seeder/CHANGELOG.md
  5. 7
      modules/bim_seeder/README.md
  6. 0
      modules/bim_seeder/app/seeders/bim_seeder/basic_data/activity_seeder.rb
  7. 0
      modules/bim_seeder/app/seeders/bim_seeder/basic_data/status_seeder.rb
  8. 0
      modules/bim_seeder/app/seeders/bim_seeder/basic_data/type_seeder.rb
  9. 0
      modules/bim_seeder/app/seeders/bim_seeder/basic_data/workflow_seeder.rb
  10. 0
      modules/bim_seeder/app/seeders/bim_seeder/basic_data_seeder.rb
  11. 13
      modules/bim_seeder/app/seeders/bim_seeder/root_seeder.rb
  12. 26
      modules/bim_seeder/bin/rails
  13. 5
      modules/bim_seeder/lib/open_project/bim_seeder.rb
  14. 16
      modules/bim_seeder/lib/open_project/bim_seeder/engine.rb
  15. 1
      modules/bim_seeder/lib/openproject-bim_seeder.rb
  16. 18
      modules/bim_seeder/openproject-bim_seeder.gemspec

@ -124,6 +124,11 @@ PATH
acts_as_silent_list (~> 3.0.0)
openproject-pdf_export
PATH
remote: modules/bim_seeder
specs:
openproject-bim_seeder (1.0.0)
PATH
remote: modules/boards
specs:
@ -970,6 +975,7 @@ DEPENDENCIES
openproject-auth_saml!
openproject-avatars!
openproject-backlogs!
openproject-bim_seeder!
openproject-boards!
openproject-costs!
openproject-documents!

@ -41,4 +41,6 @@ group :opf_plugins do
gem 'grids', path: 'modules/grids'
gem 'openproject-boards', path: 'modules/boards'
gem 'openproject-bim_seeder', path: 'modules/bim_seeder'
end

@ -131,10 +131,6 @@ class RootSeeder < Seeder
def seed_basic_data
puts "*** Seeding basic data for #{OpenProject::Configuration['edition']} edition"
if OpenProject::Configuration['edition'] == 'bim'
BimSeeder::BasicDataSeeder.new.seed!
else
StandardSeeder::BasicDataSeeder.new.seed!
end
::StandardSeeder::BasicDataSeeder.new.seed!
end
end

@ -0,0 +1,19 @@
<!---- copyright
OpenProject Plugins Plugin
Copyright (C) 2013 - 2014 the OpenProject Foundation (OPF)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See doc/COPYRIGHT.md for more details.
++-->
# Changelog
* `#29280` Create module for seeding BIM data

@ -0,0 +1,7 @@
# OpenProject Bim Seeder Plugin
Seeds basic data and demo projects for the OpenProject BIM edition.
## Issue Tracker
https://community.openproject.org/projects/bim-seeder/work_packages

@ -0,0 +1,13 @@
module BimSeeder
module RootSeeder
def seed_basic_data
if OpenProject::Configuration['edition'] == 'bim'
return ::BimSeeder::BasicDataSeeder.new.seed!
end
super
end
end
end
RootSeeder.prepend BimSeeder::RootSeeder

@ -0,0 +1,26 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/open_project/bim_seeder/engine', __FILE__)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
##
# This is not ideal but better than nothing.
if ENV['OPENPROJECT_ROOT']
# /Users/mkahl/dev/openproject/release/lib
path = Pathname(ENV["OPENPROJECT_ROOT"]).join("lib")
$LOAD_PATH.unshift(path.to_s)
else
puts
puts "Error: please define OPENPROJECT_ROOT pointing to your OpenProject core's root directory"
puts
Kernel.exit(1)
end
require 'rails/all'
require 'rails/engine/commands'

@ -0,0 +1,5 @@
module OpenProject
module BimSeeder
require "open_project/bim_seeder/engine"
end
end

@ -0,0 +1,16 @@
# Prevent load-order problems in case openproject-plugins is listed after a plugin in the Gemfile
# or not at all
require 'open_project/plugins'
module OpenProject::BimSeeder
class Engine < ::Rails::Engine
engine_name :bim_seeder
include OpenProject::Plugins::ActsAsOpEngine
register 'openproject-bim_seeder',
:author_url => 'https://openproject.org',
:requires_openproject => '>= 9.0.0'
end
end

@ -0,0 +1 @@
require 'open_project/bim_seeder'

@ -0,0 +1,18 @@
# encoding: UTF-8
$:.push File.expand_path("../lib", __FILE__)
$:.push File.expand_path("../../lib", __dir__)
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "openproject-bim_seeder"
s.authors = "OpenProject GmbH"
s.email = "info@openproject.org"
s.homepage = "https://community.openproject.org/projects/openproject-bim-seeder" # TODO check this URL
s.summary = 'OpenProject BIM Seeder'
s.license = "GPLv3"
s.version = "1.0.0"
s.files = Dir["{app,lib}/**/*"] + %w(CHANGELOG.md README.md)
end
Loading…
Cancel
Save