isomorfeus 1.0.0.zeta6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/bin/isomorfeus +33 -0
- data/bin/yandle +9 -0
- data/lib/isomorfeus/cli.rb +33 -0
- data/lib/isomorfeus/console.rb +21 -0
- data/lib/isomorfeus/installer/databases/arangodb.rb +13 -0
- data/lib/isomorfeus/installer/new_project.rb +56 -0
- data/lib/isomorfeus/installer/options_mangler.rb +16 -0
- data/lib/isomorfeus/installer/rack_servers.rb +11 -0
- data/lib/isomorfeus/installer/templates/.gitignore.erb +25 -0
- data/lib/isomorfeus/installer/templates/.gitkeep.erb +0 -0
- data/lib/isomorfeus/installer/templates/Gemfile.erb +28 -0
- data/lib/isomorfeus/installer/templates/Procfile.erb +3 -0
- data/lib/isomorfeus/installer/templates/ProcfileDebug.erb +3 -0
- data/lib/isomorfeus/installer/templates/anonymous_policy.rb.erb +4 -0
- data/lib/isomorfeus/installer/templates/app.rb.erb +57 -0
- data/lib/isomorfeus/installer/templates/app_loader.rb.erb +8 -0
- data/lib/isomorfeus/installer/templates/application.css.erb +0 -0
- data/lib/isomorfeus/installer/templates/application.js.erb +25 -0
- data/lib/isomorfeus/installer/templates/application_common.js.erb +13 -0
- data/lib/isomorfeus/installer/templates/application_ssr.js.erb +23 -0
- data/lib/isomorfeus/installer/templates/application_web_worker.js.erb +6 -0
- data/lib/isomorfeus/installer/templates/arango_config.rb.erb +19 -0
- data/lib/isomorfeus/installer/templates/config.ru.erb +23 -0
- data/lib/isomorfeus/installer/templates/debug.js.erb +131 -0
- data/lib/isomorfeus/installer/templates/development.js.erb +110 -0
- data/lib/isomorfeus/installer/templates/development_ssr.js.erb +111 -0
- data/lib/isomorfeus/installer/templates/hello_component.rb.erb +6 -0
- data/lib/isomorfeus/installer/templates/iodine_config.rb.erb +14 -0
- data/lib/isomorfeus/installer/templates/isomorfeus_loader.rb.erb +16 -0
- data/lib/isomorfeus/installer/templates/isomorfeus_web_worker_loader.rb.erb +2 -0
- data/lib/isomorfeus/installer/templates/my_app.rb.erb +11 -0
- data/lib/isomorfeus/installer/templates/navigation_links.rb.erb +9 -0
- data/lib/isomorfeus/installer/templates/not_found_404_component.rb.erb +7 -0
- data/lib/isomorfeus/installer/templates/package.json.erb +42 -0
- data/lib/isomorfeus/installer/templates/production.js.erb +91 -0
- data/lib/isomorfeus/installer/templates/spec_helper.rb.erb +22 -0
- data/lib/isomorfeus/installer/templates/test_spec.rb.erb +13 -0
- data/lib/isomorfeus/installer/templates/welcome_component.rb.erb +6 -0
- data/lib/isomorfeus/installer.rb +257 -0
- data/lib/isomorfeus/version.rb +3 -0
- metadata +211 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b7a30b79b8586ebe435462fdee09c274f84fd1b2c6878bcb52f5349ba3ecda09
|
4
|
+
data.tar.gz: 956825ef7b526af2d508b16ee4bcf20b890d110c4156c9885f128fbf0270b62a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 03acc9c28ac94f97faf43ecc16981994a770d625208d486c0d3748c5766d9cc5bce7b267695ab467f0294c294526fbd98204724ec943ac6bb5ef4e47ac105cc5
|
7
|
+
data.tar.gz: f161426747e384537f4afc5a84f768058e7d5fdd28620ed10b205155d9183e80803364421d55ef39155b26eb93bf04d3a32ffa65169bf7ac687e33cb9da78869
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018, 2019 Jan Biedermann
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/bin/isomorfeus
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'thor'
|
3
|
+
require_relative '../lib/isomorfeus/installer'
|
4
|
+
require_relative '../lib/isomorfeus/installer/rack_servers'
|
5
|
+
|
6
|
+
if %w[c con console].include?(ARGV[0])
|
7
|
+
require 'pry'
|
8
|
+
require_relative '../lib/isomorfeus/console'
|
9
|
+
require_relative '../lib/isomorfeus/cli'
|
10
|
+
|
11
|
+
Isomorfeus::Installer::CLI.start(ARGV)
|
12
|
+
else
|
13
|
+
require 'bundler'
|
14
|
+
require 'fileutils'
|
15
|
+
require 'erb'
|
16
|
+
require 'active_support/core_ext/string'
|
17
|
+
require 'opal-webpack-loader/installer_cli'
|
18
|
+
require_relative '../lib/isomorfeus/version'
|
19
|
+
require_relative '../lib/isomorfeus/installer/options_mangler'
|
20
|
+
require_relative '../lib/isomorfeus/installer/new_project'
|
21
|
+
|
22
|
+
Isomorfeus::Installer.module_directories.each do |mod_dir|
|
23
|
+
mod_path = File.realpath(File.join(Isomorfeus::Installer.base_path, mod_dir))
|
24
|
+
modules = Dir.glob('*.rb', base: mod_path)
|
25
|
+
modules.each do |mod|
|
26
|
+
require_relative File.join(mod_path, mod)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
require_relative '../lib/isomorfeus/cli'
|
31
|
+
|
32
|
+
Isomorfeus::Installer::CLI.start(ARGV)
|
33
|
+
end
|
data/bin/yandle
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Isomorfeus
|
2
|
+
module Installer
|
3
|
+
class CLI < Thor
|
4
|
+
|
5
|
+
desc "new project_name", "Create a new isomorfeus project with project_name."
|
6
|
+
option :rack_server, default: 'iodine', aliases: '-r',
|
7
|
+
desc: "Select rack server, one of: #{Isomorfeus::Installer.sorted_rack_servers.join(', ')}. (optional)"
|
8
|
+
option :yarn_and_bundle, default: true, required: false, type: :boolean, aliases: '-y', desc: "Execute yarn install and bundle install. (optional)"
|
9
|
+
def new(project_name)
|
10
|
+
Isomorfeus::Installer.set_project_names(project_name)
|
11
|
+
Isomorfeus::Installer.options = options
|
12
|
+
Isomorfeus::Installer::NewProject.execute(yarn_and_bundle: options[:yarn_and_bundle])
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "console", "Open console for current project."
|
16
|
+
def console
|
17
|
+
Isomorfeus::Console.new.run
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "test_app", "Create a test_app for internal framework tests."
|
21
|
+
option :module, required: true, type: :string, aliases: '-m', desc: "Isomorfeus module name for which to generate the test app, eg: 'i18n'. (required)"
|
22
|
+
option :source_dir, required: false, type: :string, aliases: '-s', desc: "Recursively copy files from source dir into app. (optional)"
|
23
|
+
option :rack_server, default: 'iodine', aliases: '-r',
|
24
|
+
desc: "Select rack server, one of: #{Isomorfeus::Installer.sorted_rack_servers.join(', ')}. (optional)"
|
25
|
+
option :yarn_and_bundle, default: true, required: false, type: :boolean, aliases: '-y', desc: "Execute yarn install and bundle install. (optional)"
|
26
|
+
def test_app
|
27
|
+
Isomorfeus::Installer.set_project_names('test_app')
|
28
|
+
Isomorfeus::Installer.options = options
|
29
|
+
Isomorfeus::Installer::NewProject.execute(yarn_and_bundle: options[:yarn_and_bundle])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Isomorfeus
|
2
|
+
class Console
|
3
|
+
def initialize
|
4
|
+
config_ru = File.read('config.ru')
|
5
|
+
config_ru.each_line do |line|
|
6
|
+
if line.start_with?('require_relative')
|
7
|
+
file = line[17..-1].rstrip.tr('"','').tr("'",'')
|
8
|
+
file = file + '.rb' unless file.end_with?('.rb')
|
9
|
+
require File.join(Dir.pwd, file)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
Isomorfeus.zeitwerk.enable_reloading
|
13
|
+
Isomorfeus.zeitwerk.setup
|
14
|
+
Isomorfeus.zeitwerk.eager_load
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
Isomorfeus.pry
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Isomorfeus
|
2
|
+
module Installer
|
3
|
+
module Databases
|
4
|
+
module ArangoDB
|
5
|
+
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
Isomorfeus::Installer.add_database('arangodb',
|
12
|
+
gems: [ { name: 'arango-driver', version: "~> 3.5.0.alpha0" } ],
|
13
|
+
installer: Isomorfeus::Installer::Databases::ArangoDB)
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'opal-webpack-loader/installer_cli'
|
2
|
+
require 'opal-webpack-loader/version'
|
3
|
+
|
4
|
+
module Isomorfeus
|
5
|
+
module Installer
|
6
|
+
class NewProject
|
7
|
+
def self.execute(yarn_and_bundle: true)
|
8
|
+
begin
|
9
|
+
Dir.mkdir(Isomorfeus::Installer.project_dir)
|
10
|
+
Dir.chdir(Isomorfeus::Installer.project_dir)
|
11
|
+
rescue
|
12
|
+
puts "Directory #{installer.project_dir} could not be created!"
|
13
|
+
exit 1
|
14
|
+
end
|
15
|
+
|
16
|
+
begin
|
17
|
+
Isomorfeus::Installer.create_directories
|
18
|
+
Isomorfeus::Installer.install_framework
|
19
|
+
|
20
|
+
OpalWebpackLoader::Installer::CLI.start(['iso'])
|
21
|
+
Isomorfeus::Installer.install_webpack_config
|
22
|
+
|
23
|
+
Isomorfeus::Installer.install_styles
|
24
|
+
Isomorfeus::Installer.install_js_entries
|
25
|
+
Isomorfeus::Installer.install_isomorfeus_entries
|
26
|
+
|
27
|
+
Isomorfeus::Installer.create_components
|
28
|
+
Isomorfeus::Installer.create_policy
|
29
|
+
Isomorfeus::Installer.create_spec
|
30
|
+
|
31
|
+
Isomorfeus::Installer.create_package_json
|
32
|
+
Isomorfeus::Installer.create_gemfile
|
33
|
+
Isomorfeus::Installer.create_procfile
|
34
|
+
|
35
|
+
Isomorfeus::Installer.copy_source_dir_files if Isomorfeus::Installer.source_dir
|
36
|
+
|
37
|
+
if yarn_and_bundle
|
38
|
+
puts 'Executing yarn install:'
|
39
|
+
system('env -i PATH=$PATH yarn install')
|
40
|
+
puts 'Executing bundle install:'
|
41
|
+
bundle_command = Gem.bin_path("bundler", "bundle")
|
42
|
+
Bundler.with_original_env do
|
43
|
+
system("#{Gem.ruby} #{bundle_command} install")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Dir.chdir('..')
|
48
|
+
puts 'Project setup finished, make your dreams come true :)'
|
49
|
+
rescue Exception => e
|
50
|
+
puts e.backtrace.join("\n")
|
51
|
+
puts "Installation failed: #{e.message}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Isomorfeus
|
2
|
+
module Installer
|
3
|
+
module OptionsMangler
|
4
|
+
def self.mangle_options(options)
|
5
|
+
if options.key?(:rack_server) && Isomorfeus::Installer.sorted_rack_servers.include?(options[:rack_server])
|
6
|
+
Isomorfeus::Installer.rack_server = Isomorfeus::Installer.rack_servers[options[:rack_server]]
|
7
|
+
Isomorfeus::Installer.rack_server_name = options[:rack_server]
|
8
|
+
else
|
9
|
+
Isomorfeus::Installer.rack_server = Isomorfeus::Installer.rack_servers['iodine']
|
10
|
+
end
|
11
|
+
Isomorfeus::Installer.source_dir = File.expand_path(options[:source_dir]) if options.key?(:source_dir)
|
12
|
+
Isomorfeus::Installer.isomorfeus_module = "isomorfeus-#{options[:module]}".to_sym if options.key?(:module)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Isomorfeus::Installer.add_rack_server('agoo', {
|
2
|
+
# gems: [ { name: 'agoo', version: "~> 2.8.3" } ],
|
3
|
+
# start_command: 'bundle exec rackup -s agoo'
|
4
|
+
# })
|
5
|
+
|
6
|
+
Isomorfeus::Installer.add_rack_server('iodine', {
|
7
|
+
gems: [ { name: 'iodine', version: "~> 0.7.38", require: true } ],
|
8
|
+
start_command: 'bundle exec iodine',
|
9
|
+
init_template: 'iodine_config.rb.erb',
|
10
|
+
rack_server_init: "require_relative 'iodine_config'"
|
11
|
+
})
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore all logfiles and tempfiles.
|
11
|
+
/log/*
|
12
|
+
/tmp/*
|
13
|
+
!/log/.keep
|
14
|
+
!/tmp/.keep
|
15
|
+
|
16
|
+
node_modules
|
17
|
+
public/assets
|
18
|
+
|
19
|
+
.byebug_history
|
20
|
+
|
21
|
+
yarn-error.log
|
22
|
+
yarn-debug.log*
|
23
|
+
.yarn-integrity
|
24
|
+
|
25
|
+
.DS_Store
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
|
4
|
+
<%= rack_server_gems %>
|
5
|
+
gem 'foreman', require: false
|
6
|
+
|
7
|
+
gem 'roda', '~> 3.25.0'
|
8
|
+
|
9
|
+
gem 'opal', github: 'janbiedermann/opal', branch: 'es6_modules_1_1'
|
10
|
+
gem 'opal-activesupport', '~> 0.3.3'
|
11
|
+
gem 'opal-webpack-loader', '>= 0.9.9'
|
12
|
+
|
13
|
+
gem 'isomorfeus-redux', '~> 4.0.16'
|
14
|
+
gem 'isomorfeus-react', '>= 16.12.1'
|
15
|
+
gem 'isomorfeus-policy', <%= isomorfeus_policy %>
|
16
|
+
gem 'isomorfeus-transport', <%= isomorfeus_transport %>
|
17
|
+
gem 'isomorfeus-i18n', <%= isomorfeus_i18n %>
|
18
|
+
gem 'isomorfeus-data', <%= isomorfeus_data %>
|
19
|
+
gem 'isomorfeus-operation', <%= isomorfeus_operation %>
|
20
|
+
|
21
|
+
group :development do
|
22
|
+
gem 'pry', '~> 0.12.2'
|
23
|
+
end
|
24
|
+
|
25
|
+
group :test do
|
26
|
+
gem 'rspec', '~> 3.8.0'
|
27
|
+
gem 'isomorfeus-puppetmaster', '~> 0.3.0'
|
28
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require_relative 'app_loader'
|
2
|
+
require_relative 'owl_init'
|
3
|
+
# require_relative 'arango_config'
|
4
|
+
<%= rack_server_init %>
|
5
|
+
|
6
|
+
class <%= app_class %> < Roda
|
7
|
+
extend Isomorfeus::Transport::Middlewares
|
8
|
+
include OpalWebpackLoader::ViewHelper
|
9
|
+
include Isomorfeus::ReactViewHelper
|
10
|
+
|
11
|
+
use_isomorfeus_middlewares
|
12
|
+
plugin :public, root: 'public'
|
13
|
+
|
14
|
+
def page_content(env, location)
|
15
|
+
locale = env.http_accept_language.preferred_language_from(Isomorfeus.available_locales)
|
16
|
+
locale = env.http_accept_language.compatible_language_from(Isomorfeus.available_locales) unless locale
|
17
|
+
locale = Isomorfeus.locale unless locale
|
18
|
+
rendered_tree = mount_component('<%= app_class %>', location_host: env['HTTP_HOST'], location: location, locale: locale)
|
19
|
+
<<~HTML
|
20
|
+
<!DOCTYPE html>
|
21
|
+
<html>
|
22
|
+
<head>
|
23
|
+
<title>Welcome to <%= app_class %></title>
|
24
|
+
<meta charset="utf-8"/>
|
25
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
26
|
+
<style id="jss-server-side" type="text/css">#{ssr_styles}</style>
|
27
|
+
#{owl_script_tag 'application.js'}
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
#{rendered_tree}
|
31
|
+
</body>
|
32
|
+
</html>
|
33
|
+
HTML
|
34
|
+
end
|
35
|
+
|
36
|
+
route do |r|
|
37
|
+
r.root do
|
38
|
+
page_content(env, '/')
|
39
|
+
end
|
40
|
+
|
41
|
+
r.public
|
42
|
+
|
43
|
+
r.get 'favicon.ico' do
|
44
|
+
r.public
|
45
|
+
end
|
46
|
+
|
47
|
+
r.get 'robots.txt' do
|
48
|
+
r.public
|
49
|
+
end
|
50
|
+
|
51
|
+
r.get do
|
52
|
+
content = page_content(env, env['PATH_INFO'])
|
53
|
+
response.status = ssr_response_status
|
54
|
+
content
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// entry file for the browser environment
|
2
|
+
// import stylesheets here
|
3
|
+
import '../styles/application.css';
|
4
|
+
|
5
|
+
// import npm modules that are valid to use only in the browser
|
6
|
+
import ReactDOM from 'react-dom';
|
7
|
+
global.ReactDOM = ReactDOM;
|
8
|
+
import { BrowserRouter, Link, NavLink, Route, Switch } from 'react-router-dom';
|
9
|
+
// global.History = History;
|
10
|
+
global.Router = BrowserRouter;
|
11
|
+
global.Link = Link;
|
12
|
+
global.NavLink = NavLink;
|
13
|
+
global.Route = Route;
|
14
|
+
global.Switch = Switch;
|
15
|
+
import deepForceUpdate from 'react-deep-force-update'
|
16
|
+
global.deepForceUpdate = deepForceUpdate;
|
17
|
+
// import modules common to browser and server side rendering (ssr)
|
18
|
+
// environments from application_common.js
|
19
|
+
import './application_common.js';
|
20
|
+
|
21
|
+
import init_app from 'isomorfeus_loader.rb';
|
22
|
+
init_app();
|
23
|
+
Opal.load('isomorfeus_loader');
|
24
|
+
|
25
|
+
if (module.hot) { module.hot.accept(); }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// import javascript modules common to browser and server side rendering environments
|
2
|
+
import * as Redux from 'redux';
|
3
|
+
global.Redux = Redux;
|
4
|
+
import React from 'react';
|
5
|
+
global.React = React;
|
6
|
+
import * as ReactRouter from 'react-router';
|
7
|
+
import * as ReactRouterDOM from 'react-router-dom';
|
8
|
+
global.ReactRouter = ReactRouter;
|
9
|
+
global.ReactRouterDOM = ReactRouterDOM;
|
10
|
+
import * as ReactJSS from 'react-jss';
|
11
|
+
global.ReactJSS = ReactJSS;
|
12
|
+
|
13
|
+
if (module.hot) { module.hot.accept(); }
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// entry file for the server side rendering environment (ssr)
|
2
|
+
// import npm modules that are only valid to use in the server side rendering environment
|
3
|
+
// for example modules which depend on objects provided by node js
|
4
|
+
import ReactDOMServer from 'react-dom/server';
|
5
|
+
global.ReactDOMServer = ReactDOMServer;
|
6
|
+
import { StaticRouter, Link, NavLink, Route, Switch } from 'react-router-dom';
|
7
|
+
// global.History = History;
|
8
|
+
global.Router = StaticRouter;
|
9
|
+
global.Link = Link;
|
10
|
+
global.NavLink = NavLink;
|
11
|
+
global.Route = Route;
|
12
|
+
global.Switch = Switch;
|
13
|
+
import WebSocket from 'ws';
|
14
|
+
global.WebSocket = WebSocket;
|
15
|
+
// import modules common to browser and server side rendering (ssr)
|
16
|
+
// environments from application_common.js
|
17
|
+
import './application_common.js';
|
18
|
+
|
19
|
+
import init_app from 'isomorfeus_loader.rb';
|
20
|
+
init_app();
|
21
|
+
global.Opal.load('isomorfeus_loader');
|
22
|
+
|
23
|
+
if (module.hot) { module.hot.accept(); }
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Arango DB
|
2
|
+
# set all to nil to disable arango
|
3
|
+
Isomorfeus.arango_production = { username: ENV['ARANGO_USER'], password: ENV['ARANGO_PASSWORD'],
|
4
|
+
host: "localhost", port: "8529",
|
5
|
+
database: "<%= app_class %>Production" }
|
6
|
+
|
7
|
+
Isomorfeus.arango_development = { username: ENV['ARANGO_USER'], password: ENV['ARANGO_PASSWORD'],
|
8
|
+
host: "localhost", port: "8529",
|
9
|
+
database: "<%= app_class %>Development" }
|
10
|
+
|
11
|
+
Isomorfeus.arango_test = { username: ENV['ARANGO_USER'], password: ENV['ARANGO_PASSWORD'],
|
12
|
+
host: "localhost", port: "8529",
|
13
|
+
database: "<%= app_class %>Test" }
|
14
|
+
|
15
|
+
# create database, if possible
|
16
|
+
# initialize Isomorfeus collections
|
17
|
+
# create housekeeping tasks
|
18
|
+
# keep it, it will take care of updates to the Isomorfeus collections when required
|
19
|
+
Isomorfeus.prepare_arango_database
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '<%= app_require %>'
|
2
|
+
|
3
|
+
if !Isomorfeus.development?
|
4
|
+
Isomorfeus.zeitwerk.setup
|
5
|
+
Isomorfeus.zeitwerk.eager_load
|
6
|
+
|
7
|
+
run <%= app_class %>.app
|
8
|
+
else
|
9
|
+
Isomorfeus.zeitwerk.enable_reloading
|
10
|
+
Isomorfeus.zeitwerk.setup
|
11
|
+
Isomorfeus.zeitwerk.eager_load
|
12
|
+
|
13
|
+
run ->(env) do
|
14
|
+
write_lock = Isomorfeus.zeitwerk_lock.try_write_lock
|
15
|
+
if write_lock
|
16
|
+
Isomorfeus.zeitwerk.reload
|
17
|
+
Isomorfeus.zeitwerk_lock.release_write_lock
|
18
|
+
end
|
19
|
+
Isomorfeus.zeitwerk_lock.with_read_lock do
|
20
|
+
<%= app_class %>.call env
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
const webpack = require('webpack');
|
3
|
+
const OwlResolver = require('opal-webpack-loader/resolver'); // to resolve ruby files
|
4
|
+
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin'); // to watch for added ruby files
|
5
|
+
|
6
|
+
const common_config = {
|
7
|
+
target: 'web',
|
8
|
+
context: path.resolve(__dirname, '../isomorfeus'),
|
9
|
+
mode: "development",
|
10
|
+
optimization: {
|
11
|
+
removeAvailableModules: false,
|
12
|
+
removeEmptyChunks: false,
|
13
|
+
minimize: false // dont minimize for debugging
|
14
|
+
},
|
15
|
+
performance: {
|
16
|
+
maxAssetSize: 20000000,
|
17
|
+
maxEntrypointSize: 20000000
|
18
|
+
},
|
19
|
+
// use one of these below for source maps
|
20
|
+
devtool: 'source-map', // this works well, good compromise between accuracy and performance
|
21
|
+
// devtool: 'cheap-eval-source-map', // less accurate
|
22
|
+
// devtool: 'inline-source-map', // slowest
|
23
|
+
// devtool: 'inline-cheap-source-map',
|
24
|
+
output: {
|
25
|
+
filename: '[name].js',
|
26
|
+
path: path.resolve(__dirname, '../public/assets'),
|
27
|
+
publicPath: 'http://localhost:3035/assets/'
|
28
|
+
},
|
29
|
+
externals: { crypto: 'Crypto' },
|
30
|
+
resolve: {
|
31
|
+
plugins: [new OwlResolver('resolve', 'resolved')], // this makes it possible for webpack to find ruby files
|
32
|
+
alias: {
|
33
|
+
'react-dom': 'react-dom/profiling',
|
34
|
+
'schedule/tracing': 'schedule/tracing-profiling',
|
35
|
+
}
|
36
|
+
},
|
37
|
+
plugins: [
|
38
|
+
// both for hot reloading
|
39
|
+
new webpack.HotModuleReplacementPlugin(),
|
40
|
+
// watch for added files in opal dir
|
41
|
+
new ExtraWatchWebpackPlugin({ dirs: [path.resolve(__dirname, '../isomorfeus')] }),
|
42
|
+
new webpack.DefinePlugin({
|
43
|
+
OPAL_DEVTOOLS_OBJECT_REGISTRY: true
|
44
|
+
})
|
45
|
+
],
|
46
|
+
module: {
|
47
|
+
rules: [
|
48
|
+
{
|
49
|
+
test: /\.s[ac]ss$/,
|
50
|
+
use: [ "style-loader",
|
51
|
+
{
|
52
|
+
loader: "css-loader",
|
53
|
+
options: { sourceMap: true }
|
54
|
+
},
|
55
|
+
{
|
56
|
+
loader: "sass-loader",
|
57
|
+
options: {
|
58
|
+
sassOptions: { includePaths: [path.resolve(__dirname, '../isomorfeus/styles')] },
|
59
|
+
sourceMap: true // set to false to speed up hot reloads
|
60
|
+
}
|
61
|
+
}
|
62
|
+
]
|
63
|
+
},
|
64
|
+
{
|
65
|
+
test: /\.css$/,
|
66
|
+
use: [ "style-loader",
|
67
|
+
{
|
68
|
+
loader: "css-loader",
|
69
|
+
options: { sourceMap: true }
|
70
|
+
}
|
71
|
+
]
|
72
|
+
},
|
73
|
+
{
|
74
|
+
test: /\.(png|svg|jpg|gif|woff|woff2|eot|ttf|otf)$/,
|
75
|
+
use: [ "file-loader" ]
|
76
|
+
},
|
77
|
+
{
|
78
|
+
test: /(\.js)?\.rb$/,
|
79
|
+
use: [
|
80
|
+
{
|
81
|
+
loader: 'opal-webpack-loader', // opal-webpack-loader will compile and include ruby files in the pack
|
82
|
+
options: {
|
83
|
+
sourceMap: true,
|
84
|
+
hmr: true,
|
85
|
+
hmrHook: 'Opal.Isomorfeus.$force_render()'
|
86
|
+
}
|
87
|
+
}
|
88
|
+
]
|
89
|
+
}
|
90
|
+
]
|
91
|
+
},
|
92
|
+
// configuration for webpack-dev-server
|
93
|
+
devServer: {
|
94
|
+
open: false,
|
95
|
+
lazy: false,
|
96
|
+
port: 3035,
|
97
|
+
hot: true,
|
98
|
+
// hotOnly: true,
|
99
|
+
inline: true,
|
100
|
+
https: false,
|
101
|
+
disableHostCheck: true,
|
102
|
+
headers: {
|
103
|
+
"Access-Control-Allow-Origin": "*",
|
104
|
+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
105
|
+
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
|
106
|
+
},
|
107
|
+
watchOptions: {
|
108
|
+
// in case of problems with hot reloading uncomment the following two lines:
|
109
|
+
// aggregateTimeout: 250,
|
110
|
+
// poll: 50,
|
111
|
+
ignored: /\bnode_modules\b/
|
112
|
+
},
|
113
|
+
contentBase: path.resolve(__dirname, 'public'),
|
114
|
+
useLocalIp: false
|
115
|
+
}
|
116
|
+
};
|
117
|
+
|
118
|
+
const browser_config = {
|
119
|
+
entry: { application: [path.resolve(__dirname, '../isomorfeus/imports/application.js')] }
|
120
|
+
};
|
121
|
+
|
122
|
+
//const web_worker_config = {
|
123
|
+
// target: 'webworker',
|
124
|
+
// entry: { web_worker: [path.resolve(__dirname, '../isomorfeus/imports/application_web_worker.js')] },
|
125
|
+
// externals: { crypto: 'Crypto' }
|
126
|
+
//};
|
127
|
+
|
128
|
+
const browser = Object.assign({}, common_config, browser_config);
|
129
|
+
// const web_worker = Object.assign({}, common_config, web_worker_config);
|
130
|
+
|
131
|
+
module.exports = [ browser ];
|