lumina-rails 0.2.1 → 0.3.0
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/lumina/commands/base_command.rb +32 -0
- data/lib/lumina/commands/blueprint_command.rb +16 -18
- data/lib/lumina/commands/export_postman_command.rb +12 -8
- data/lib/lumina/commands/generate_command.rb +2 -5
- data/lib/lumina/commands/install_command.rb +2 -6
- data/lib/lumina/commands/invitation_link_command.rb +8 -10
- data/lib/lumina/railtie.rb +4 -6
- data/lib/lumina/tasks/lumina.rake +39 -0
- data/lib/lumina/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0af5be07773c7e8defc513c5bc7314cb1b15183d449fea5e9a3259bd55dfabcd
|
|
4
|
+
data.tar.gz: bff1aff0e26aee1bbe1be2ed3aec2bb6fb0e3ec110fa2a370a1a42bd2ed8cdb0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e680de73d59dbf29bfeaf2e605a906d3f254df9e992a31a703bffa89b4ee48ca082cb89902066b2cc05e9a34e198cceb4d7c9c3fb5c65d4468c20a166958cd22
|
|
7
|
+
data.tar.gz: b930d356d779316cdd5e1003d93f275e7ac61b821e93989b0fd40bd05e6ac12a5289fc869c4bb0bf1fa08359a7fb8e02ee68f6155c8736a81521a960accaf1c2
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "thor"
|
|
4
|
+
|
|
5
|
+
module Lumina
|
|
6
|
+
module Commands
|
|
7
|
+
# Lightweight base for Lumina CLI commands.
|
|
8
|
+
# Provides Thor's say/ask/yes? helpers without relying on Rails::Command::Base,
|
|
9
|
+
# which cannot be discovered by Rails when defined inside a gem.
|
|
10
|
+
class BaseCommand
|
|
11
|
+
include Thor::Shell
|
|
12
|
+
|
|
13
|
+
def initialize(shell = Thor::Shell::Color.new)
|
|
14
|
+
@shell = shell
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def say(message = "", color = nil)
|
|
20
|
+
@shell.say(message, color)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def ask(message, *args)
|
|
24
|
+
@shell.ask(message, *args)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def yes?(message, *args)
|
|
28
|
+
@shell.yes?(message, *args)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "lumina/commands/base_command"
|
|
4
4
|
require "fileutils"
|
|
5
5
|
require "lumina/blueprint/blueprint_parser"
|
|
6
6
|
require "lumina/blueprint/blueprint_validator"
|
|
@@ -16,23 +16,21 @@ module Lumina
|
|
|
16
16
|
# Port of lumina-server BlueprintCommand.php / lumina-adonis-server blueprint.ts.
|
|
17
17
|
#
|
|
18
18
|
# Usage: rails lumina:blueprint [OPTIONS]
|
|
19
|
-
class BlueprintCommand <
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
desc "blueprint", "Generate resources from YAML blueprint specs"
|
|
19
|
+
class BlueprintCommand < BaseCommand
|
|
20
|
+
attr_accessor :options
|
|
21
|
+
|
|
22
|
+
def initialize(shell = Thor::Shell::Color.new)
|
|
23
|
+
super(shell)
|
|
24
|
+
@options = {
|
|
25
|
+
dir: ".lumina/blueprints",
|
|
26
|
+
model: nil,
|
|
27
|
+
force: false,
|
|
28
|
+
dry_run: false,
|
|
29
|
+
skip_tests: false,
|
|
30
|
+
skip_seeders: false
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
|
|
36
34
|
def perform
|
|
37
35
|
print_banner
|
|
38
36
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "lumina/commands/base_command"
|
|
4
4
|
require "json"
|
|
5
5
|
|
|
6
6
|
module Lumina
|
|
@@ -9,14 +9,18 @@ module Lumina
|
|
|
9
9
|
# Mirrors Laravel `php artisan lumina:export-postman` exactly.
|
|
10
10
|
#
|
|
11
11
|
# Usage: rails lumina:export_postman [--output=postman_collection.json] [--base-url=http://localhost:3000/api]
|
|
12
|
-
class ExportPostmanCommand <
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
class ExportPostmanCommand < BaseCommand
|
|
13
|
+
attr_accessor :options
|
|
14
|
+
|
|
15
|
+
def initialize(shell = Thor::Shell::Color.new)
|
|
16
|
+
super(shell)
|
|
17
|
+
@options = {
|
|
18
|
+
output: "postman_collection.json",
|
|
19
|
+
base_url: "http://localhost:3000/api",
|
|
20
|
+
project_name: nil
|
|
21
|
+
}
|
|
22
|
+
end
|
|
18
23
|
|
|
19
|
-
desc "export_postman", "Generate a Postman Collection v2.1 for all registered models"
|
|
20
24
|
def perform
|
|
21
25
|
output_path = options[:output]
|
|
22
26
|
base_url = options[:base_url].chomp("/")
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "lumina/commands/base_command"
|
|
4
4
|
|
|
5
5
|
module Lumina
|
|
6
6
|
module Commands
|
|
7
7
|
# Interactive scaffold generator — mirrors Laravel `php artisan lumina:generate` exactly.
|
|
8
8
|
#
|
|
9
9
|
# Usage: rails lumina:generate (or rails lumina:g)
|
|
10
|
-
class GenerateCommand <
|
|
11
|
-
namespace "lumina:generate"
|
|
12
|
-
|
|
13
|
-
desc "generate", "Generate Lumina resources (Model, Policy, Scope)"
|
|
10
|
+
class GenerateCommand < BaseCommand
|
|
14
11
|
def perform
|
|
15
12
|
print_banner
|
|
16
13
|
print_styled_header
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
4
|
-
require "thor"
|
|
3
|
+
require "lumina/commands/base_command"
|
|
5
4
|
|
|
6
5
|
module Lumina
|
|
7
6
|
module Commands
|
|
8
7
|
# Interactive setup wizard — mirrors Laravel `php artisan lumina:install` exactly.
|
|
9
8
|
#
|
|
10
9
|
# Usage: rails lumina:install
|
|
11
|
-
class InstallCommand <
|
|
12
|
-
namespace "lumina:install"
|
|
13
|
-
|
|
14
|
-
desc "install", "Install and configure Lumina for your Rails application"
|
|
10
|
+
class InstallCommand < BaseCommand
|
|
15
11
|
def perform
|
|
16
12
|
print_banner
|
|
17
13
|
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "lumina/commands/base_command"
|
|
4
4
|
|
|
5
5
|
module Lumina
|
|
6
6
|
module Commands
|
|
7
7
|
# Generate an invitation link for testing — mirrors Laravel `php artisan invitation:link` exactly.
|
|
8
8
|
#
|
|
9
9
|
# Usage: rails invitation:link EMAIL ORG [--role=ROLE] [--create]
|
|
10
|
-
class InvitationLinkCommand <
|
|
11
|
-
|
|
10
|
+
class InvitationLinkCommand < BaseCommand
|
|
11
|
+
attr_accessor :email, :organization_identifier, :options
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class_option :create, type: :boolean, default: false, desc: "Create a new invitation if one does not exist"
|
|
13
|
+
def initialize(shell = Thor::Shell::Color.new)
|
|
14
|
+
super(shell)
|
|
15
|
+
@options = { role: nil, create: false }
|
|
16
|
+
end
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
def perform(email, organization_identifier)
|
|
18
|
+
def perform(email = @email, organization_identifier = @organization_identifier)
|
|
21
19
|
role_identifier = options[:role]
|
|
22
20
|
should_create = options[:create]
|
|
23
21
|
|
data/lib/lumina/railtie.rb
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "lumina/commands/install_command"
|
|
4
|
-
require "lumina/commands/generate_command"
|
|
5
|
-
require "lumina/commands/blueprint_command"
|
|
6
|
-
require "lumina/commands/export_postman_command"
|
|
7
|
-
require "lumina/commands/invitation_link_command"
|
|
8
|
-
|
|
9
3
|
module Lumina
|
|
10
4
|
class Railtie < ::Rails::Railtie
|
|
11
5
|
railtie_name :lumina
|
|
6
|
+
|
|
7
|
+
rake_tasks do
|
|
8
|
+
load File.expand_path("tasks/lumina.rake", __dir__)
|
|
9
|
+
end
|
|
12
10
|
end
|
|
13
11
|
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
namespace :lumina do
|
|
4
|
+
desc "Install and configure Lumina for your Rails application"
|
|
5
|
+
task install: :environment do
|
|
6
|
+
require "lumina/commands/install_command"
|
|
7
|
+
Lumina::Commands::InstallCommand.new.perform
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
desc "Generate Lumina resources (Model, Policy, Scope)"
|
|
11
|
+
task generate: :environment do
|
|
12
|
+
require "lumina/commands/generate_command"
|
|
13
|
+
Lumina::Commands::GenerateCommand.new.perform
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
desc "Generate code from YAML blueprint files"
|
|
17
|
+
task blueprint: :environment do
|
|
18
|
+
require "lumina/commands/blueprint_command"
|
|
19
|
+
Lumina::Commands::BlueprintCommand.new.perform
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc "Export Postman collection for all registered models"
|
|
23
|
+
task export_postman: :environment do
|
|
24
|
+
require "lumina/commands/export_postman_command"
|
|
25
|
+
cmd = Lumina::Commands::ExportPostmanCommand.new
|
|
26
|
+
cmd.perform
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
namespace :invitation do
|
|
31
|
+
desc "Generate an invitation link for testing"
|
|
32
|
+
task :link, [:email, :organization] => :environment do |_t, args|
|
|
33
|
+
require "lumina/commands/invitation_link_command"
|
|
34
|
+
cmd = Lumina::Commands::InvitationLinkCommand.new
|
|
35
|
+
cmd.email = args[:email]
|
|
36
|
+
cmd.organization_identifier = args[:organization]
|
|
37
|
+
cmd.perform
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/lumina/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lumina-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- StartSoft
|
|
@@ -167,6 +167,7 @@ files:
|
|
|
167
167
|
- lib/lumina/blueprint/generators/seeder_generator.rb
|
|
168
168
|
- lib/lumina/blueprint/generators/test_generator.rb
|
|
169
169
|
- lib/lumina/blueprint/manifest_manager.rb
|
|
170
|
+
- lib/lumina/commands/base_command.rb
|
|
170
171
|
- lib/lumina/commands/blueprint_command.rb
|
|
171
172
|
- lib/lumina/commands/export_postman_command.rb
|
|
172
173
|
- lib/lumina/commands/generate_command.rb
|
|
@@ -195,6 +196,7 @@ files:
|
|
|
195
196
|
- lib/lumina/query_builder.rb
|
|
196
197
|
- lib/lumina/railtie.rb
|
|
197
198
|
- lib/lumina/routes.rb
|
|
199
|
+
- lib/lumina/tasks/lumina.rake
|
|
198
200
|
- lib/lumina/templates/audit_trail/create_audit_logs.rb.erb
|
|
199
201
|
- lib/lumina/templates/generate/factory.rb.erb
|
|
200
202
|
- lib/lumina/templates/generate/migration.rb.erb
|