rsodx 0.0.3 → 0.0.5
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 +4 -4
- data/lib/rsodx/cli/commands/scaffold_common.rb +6 -1
- data/lib/rsodx/configuration.rb +9 -0
- data/lib/rsodx/connect.rb +10 -4
- data/lib/rsodx/environment.rb +2 -2
- data/lib/rsodx/tasks.rb +3 -3
- data/lib/rsodx/version.rb +1 -1
- data/lib/rsodx.rb +10 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b217ac144c8fbb46a2bb7925dd8bb24c6d994527e395cc5b80d692678b0aafc3
|
4
|
+
data.tar.gz: 94a126bcac19393eb9eeefdb0188e20003f5c7d2e71dd4e0f609b9525727cfaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afaf0f6269158079ce894bb3ae483c0414bd9c0a76797c0bc2ffa9b958f235a9bbc739205ec7ababae85a1f2d76cc1f27805828b8e920e275eea9ee7e1e645b1
|
7
|
+
data.tar.gz: 6bc50511150506c1736888779f0564b6c1896b6811c0f0b818f07573431fe733ecc0b21bd2470338e4f156e9d303a96fffdf9ffeef46fc6e85e94167a0019d6a
|
@@ -52,7 +52,12 @@ module Rsodx::Cli::Commands::ScaffoldCommon
|
|
52
52
|
ENV_LOADER = <<~ENV_LOADER.freeze
|
53
53
|
require "rsodx"
|
54
54
|
Rsodx::Environment.load_dotenv(ENV["RACK_ENV"] || "development")
|
55
|
-
|
55
|
+
|
56
|
+
Rsodx.configure do |config|
|
57
|
+
config.database_url = ENV["DATABASE_URL"]
|
58
|
+
end
|
59
|
+
Rsodx::Connect.connect
|
60
|
+
|
56
61
|
Rsodx::Environment.load_initializers(File.expand_path("../..", __FILE__))
|
57
62
|
Rsodx::Boot.load_app_structure(File.expand_path("../..", __FILE__))
|
58
63
|
ENV_LOADER
|
data/lib/rsodx/connect.rb
CHANGED
@@ -2,12 +2,18 @@ require "sequel"
|
|
2
2
|
|
3
3
|
module Rsodx
|
4
4
|
module Connect
|
5
|
-
|
5
|
+
@db = nil
|
6
|
+
|
7
|
+
def self.connect(url = Rsodx.config.database_url)
|
6
8
|
raise "Missing DATABASE_URL" unless url
|
9
|
+
return @db if @db
|
10
|
+
|
11
|
+
@db = Sequel.connect(url)
|
12
|
+
Sequel::Model.db = @db
|
13
|
+
end
|
7
14
|
|
8
|
-
|
9
|
-
|
10
|
-
db
|
15
|
+
def self.db
|
16
|
+
@db || connect
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
data/lib/rsodx/environment.rb
CHANGED
@@ -5,8 +5,8 @@ module Rsodx
|
|
5
5
|
Dotenv.load('.env', ".env.#{env}") if env
|
6
6
|
end
|
7
7
|
|
8
|
-
def self.load_initializers(
|
9
|
-
Dir[File.join(
|
8
|
+
def self.load_initializers(app_root)
|
9
|
+
Dir[File.join(app_root, "config", "initializers", "*.rb")].sort.each { |file| require file }
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
data/lib/rsodx/tasks.rb
CHANGED
@@ -5,11 +5,11 @@ require "sequel/extensions/migration"
|
|
5
5
|
|
6
6
|
namespace :db do
|
7
7
|
task :migrate do
|
8
|
-
Sequel::Migrator.run(
|
8
|
+
Sequel::Migrator.run(Rsodx::Connect.db, "db/migrations")
|
9
9
|
end
|
10
10
|
|
11
11
|
task :rollback do
|
12
|
-
target = Sequel::Migrator.apply(
|
13
|
-
Sequel::Migrator.run(
|
12
|
+
target = Sequel::Migrator.apply(Rsodx::Connect.db, "db/migrations", :down) - 1
|
13
|
+
Sequel::Migrator.run(Rsodx::Connect.db, "db/migrations", target: target)
|
14
14
|
end
|
15
15
|
end
|
data/lib/rsodx/version.rb
CHANGED
data/lib/rsodx.rb
CHANGED
@@ -14,4 +14,14 @@ Dir.glob("#{base}/rsodx/**/*.rb").sort.each do |file|
|
|
14
14
|
end
|
15
15
|
|
16
16
|
module Rsodx
|
17
|
+
class << self
|
18
|
+
attr_accessor :config
|
19
|
+
|
20
|
+
def configure
|
21
|
+
self.config ||= Configuration.new
|
22
|
+
yield(config)
|
23
|
+
end
|
24
|
+
end
|
17
25
|
end
|
26
|
+
|
27
|
+
Rsodx.config ||= Rsodx::Configuration.new
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsodx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugene Pervushin
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-16 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- lib/rsodx/cli/commands/scaffold.rb
|
221
221
|
- lib/rsodx/cli/commands/scaffold_common.rb
|
222
222
|
- lib/rsodx/cli/commands/server.rb
|
223
|
+
- lib/rsodx/configuration.rb
|
223
224
|
- lib/rsodx/connect.rb
|
224
225
|
- lib/rsodx/constants.rb
|
225
226
|
- lib/rsodx/contract.rb
|