bridgetown-arcade-db 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1d52d25cfcb9a864ee279ec5ecf0e9950fa57cfb3670e69935c2a1600c2ad52f
4
+ data.tar.gz: e376ae39416a83aa964c69f75f86022e2f71bf33cf03dfdf59ba96dc5f41cc89
5
+ SHA512:
6
+ metadata.gz: 1ee21b74c8076380fce609551c9fa81ed484abeb069a8ce6514e1ef4633ba99a3431a97102d224a13e00621b49a214ec4bc0afce6f50a197aa1589aca01c278a
7
+ data.tar.gz: 3f52361c65a241c0ee8b4c1732eb610bf4e76ea13786331aab5e6102cfe2742e91d0b5467d9b06fb1a513f93a02e02c99f1dba75d40e5e61b5e629222c410647
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+
6
+ ## 0.1 - 2023-01-16
7
+
8
+ - First version
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec
5
+
6
+ gem "bridgetown", ENV["BRIDGETOWN_VERSION"] if ENV["BRIDGETOWN_VERSION"]
7
+ gem "arcadedb", path: "/home/ubuntu/hieronymus/arcadedb"
8
+ gem "arcade-time-graph", path: "/home/ubuntu/hieronymus/arcade-time-graph"
9
+
10
+ group :test do
11
+ gem "minitest"
12
+ gem "minitest-reporters"
13
+ gem "shoulda"
14
+ end
15
+
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Hartmut Bischoff
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/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # Bridgetown ArcadeDB plugin
2
+
3
+ This plugin grants Bridgetown sites (v1.2 or higher) to ArcadeDB-Databases. You can pull data from a database during a static build or during server requests (or both!). [ArcadeDB](https://arcadedb.com/) is a multi-model NOSQL-Database supporting Document-, KeyStore-
4
+ and Graph-Databases including standard-protocols (SQL, Redis, MongoDB, Gremlin, GraphQL). Most important: ArcadeDB supports inheritance,
5
+ ArcadDB is a native object-orientated database. This fits nicely to ruby.
6
+
7
+ ## Installation
8
+
9
+ An automation script is planned
10
+
11
+ ```shell
12
+ $ bin/bridgetown apply https://github.com/bridgetownrb/bridgetown-arcade-db (future use)
13
+ ```
14
+
15
+ Manual setup:
16
+
17
+ * Add the following to `Gemfile`
18
+ ```
19
+
20
+ gem 'arcadedb', git: 'https://github.com/topofocus/arcadedb"
21
+ gem 'arcade-time-graph', git: 'https://github.com/topofocus/-arcade-time-graph"
22
+ gem 'bridgetown-arcade-db' , git: 'https://github.com/topofocus/bridgetown-arcade-db"
23
+ ```
24
+ ( the gem is not released jet. so, reference to the github-repositories or clone everything an refer to their local location )
25
+ * activate the plugin in `config/initializers.rb`
26
+ ``` ruby
27
+ init :ssr
28
+ init :"bridgetown-routes"
29
+ init :"bridgetown-arcade-db"
30
+ ```
31
+ or if the DB should only referenced through deployment from static pages
32
+ ``` ruby
33
+ only :static, :console do
34
+ init :bridgetown-arcade-db
35
+ end
36
+
37
+ ```
38
+
39
+ * add `arcade.yml` to the `config`-dir
40
+ ```
41
+ --- #/config/arcade.yml
42
+ :environment:
43
+ :test:
44
+ dbname: test
45
+ user: root
46
+ pass: ****
47
+ :development:
48
+ dbname: playground
49
+ user: root
50
+ pass: ****
51
+ :production:
52
+ dbname: bridgetown
53
+ user: root
54
+ pass: ****
55
+ :admin:
56
+ :host: localhost # enter ip-address or name of the arcadeDB-Server
57
+ :port: 2480 #
58
+ :user: root # this is used for lowlevel Api-Access
59
+ :pass: **** #
60
+ :autoload: true # load model if a link is detected in a record
61
+ :logger: stdout # 'file' or 'stdout'
62
+ :namespace: Arcade # default namespace
63
+ ```
64
+
65
+ * create a `model`-directory, and there an `arcade`-Namespace-Directory.
66
+ * for testing: create a file `model/arcade/person.rb`
67
+ ```
68
+ module Arcade
69
+ class Person
70
+ attribute :name, Types::Nominal::String
71
+ attribute :surname, Types::Nominal::String.default( "".freeze )
72
+ attribute :email?, Types::Email
73
+ attribute :age?, Types::Nominal::Integer
74
+ attribute :active, Types::Nominal::Bool.default( true )
75
+ attribute :conterfeil?, Types::Nominal::Any
76
+
77
+ def self.db_init
78
+ File.read(__FILE__).gsub(/.*__END__/m, '')
79
+ end
80
+ end
81
+ end
82
+ ## The code below is executed on the database after the database-type is created
83
+ ## Use the output of `ModelClass.database_name` as DB type name
84
+ ##
85
+ __END__
86
+ CREATE PROPERTY user.name STRING
87
+ CREATE PROPERTY user.surname STRING
88
+ CREATE PROPERTY user.email STRING
89
+ CREATE INDEX ON user ( name ) NOTUNIQUE
90
+ CREATE INDEX ON user ( name, surname, email ) UNIQUE
91
+ ```
92
+
93
+ * Assuming you got a running database-instance, you are ready to go.
94
+
95
+ ## First steps
96
+
97
+ * Create the database
98
+ * Open the Bridgetown-Console (bin/bt c)
99
+ * execute `Api.create_database {name of the database in arcade.yml}`
100
+ * create the Person type: `Arcade::Person.create_type`
101
+ * add a person: `Arcade::Person.create name: "Hogo"`
102
+ * query the database: `Arcade::Person.where name: 'Hugo'`
103
+
104
+ The records are available in Frontmatter, components and in Bridgetown-Documents.
105
+
106
+
107
+ ## Contributing
108
+
109
+ 1. Fork it (https://github.com/topofocus/bridgetown-arcade-db/fork)
110
+ 2. Clone the fork using `git clone` to your local development machine.
111
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
112
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
113
+ 5. Push to the branch (`git push origin my-new-feature`)
114
+ 6. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/test_*.rb"]
8
+ t.warning = false
9
+ end
10
+
11
+ task :default => :test
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/bridgetown-arcade-db/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bridgetown-arcade-db"
7
+ spec.version = BridgetownArcadeDb::VERSION
8
+ spec.author = "Dr. Hartmut Bischoff"
9
+ spec.email = "topofocus@gmail.com"
10
+ spec.summary = "Plugin to add ArcadeDB support to Bridgetown sites"
11
+ spec.homepage = "https://github.com/topofocus/bridgetown-arcade-db"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features|frontend)/!) }
15
+ spec.test_files = spec.files.grep(%r!^test/!)
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.required_ruby_version = ">= 3.1.0"
19
+
20
+ spec.add_dependency "bridgetown", ">= 1.2.0.beta5", "< 2.0"
21
+ spec.add_dependency "arcadedb", ">= 0.4"
22
+ spec.add_dependency "arcade-time-graph"
23
+
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "rake", ">= 13.0"
26
+ end
@@ -0,0 +1,41 @@
1
+
2
+ add_gem "bridgetown-arcade-db"
3
+ add_gem "annotate", group: :development
4
+
5
+ # TODO: modify file to enable installation of arcadedb
6
+ # this is borrowed from bridgetown-activerecord
7
+ #
8
+
9
+
10
+ ## do not use ##
11
+
12
+ create_file "config/arcade.yml" do
13
+ <<~YML
14
+ default: &default
15
+ adapter: #{dbadapter}
16
+ encoding: unicode
17
+ pool: 5
18
+
19
+ development:
20
+ <<: *default
21
+ database: #{dbprefix}_development
22
+
23
+ test: &test
24
+ <<: *default
25
+ database: #{dbprefix}_test
26
+
27
+ production:
28
+ <<: *default
29
+ url: <%= ENV['DATABASE_URL'] %>
30
+ database: #{dbprefix}_production
31
+ YML
32
+ end
33
+
34
+
35
+
36
+
37
+ add_initializer :"bridgetown-arcade-db"
38
+
39
+ say_status :"arcade-db", "The plugin has been configured. For usage help visit:"
40
+ say_status :"arcade-db", "https://github.com/topofocus/arcade-db/blob/main/README.md"
41
+
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "arcade"
4
+ require "arcade-time-graph"
5
+ require "active_support/configuration_file"
6
+ require "zeitwerk"
7
+
8
+ module BridgetownArcadeDb
9
+
10
+ def self.load_models(config)
11
+ loader = Zeitwerk::Loader.new
12
+ root= Pathname.new( config.root_dir )
13
+ loader.push_dir root.join( configuration(config)[:modeldir] || "model")
14
+ loader.setup
15
+ end
16
+ def self.configuration(config)
17
+ ActiveSupport::ConfigurationFile.parse(File.join(config.root_dir, "config", "arcade.yml"))
18
+ end
19
+
20
+ def self.log_writer
21
+ Bridgetown::LogWriter.new.tap(&:enable_prefix)
22
+ end
23
+ end
24
+
25
+ Bridgetown.initializer :"bridgetown-arcade-db" do |config|
26
+ BridgetownArcadeDb.load_models config
27
+ Arcade::Init.connect Bridgetown.environment
28
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BridgetownArcadeDb
4
+ VERSION = "0.2"
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bridgetown"
4
+ ProjectRoot = Pathname.new( Dir.pwd ) + 'config'
5
+ require "bridgetown-arcade-db/initializer"
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bridgetown-arcade-db
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.2'
5
+ platform: ruby
6
+ authors:
7
+ - Dr. Hartmut Bischoff
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-12-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bridgetown
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.2.0.beta5
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.2.0.beta5
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: arcadedb
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0.4'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0.4'
47
+ - !ruby/object:Gem::Dependency
48
+ name: arcade-time-graph
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: bundler
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '13.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '13.0'
89
+ description:
90
+ email: topofocus@gmail.com
91
+ executables: []
92
+ extensions: []
93
+ extra_rdoc_files: []
94
+ files:
95
+ - ".gitignore"
96
+ - CHANGELOG.md
97
+ - Gemfile
98
+ - LICENSE
99
+ - README.md
100
+ - Rakefile
101
+ - bridgetown-arcade-db.gemspec
102
+ - bridgetown.automation.rb
103
+ - lib/bridgetown-arcade-db.rb
104
+ - lib/bridgetown-arcade-db/initializer.rb
105
+ - lib/bridgetown-arcade-db/version.rb
106
+ homepage: https://github.com/topofocus/bridgetown-arcade-db
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 3.1.0
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubygems_version: 3.3.7
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Plugin to add ArcadeDB support to Bridgetown sites
129
+ test_files: []