blacklight_lando 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db4c85959afe781c562162efc621ba66f42b9f2caabe2c2e27099e91e818ee18
4
- data.tar.gz: 5eb81a1f0cf4fcbd1d6ab6e3e3a6197f3fd0aada8b458b2db6874aadd5600208
3
+ metadata.gz: c0a15bf9b2f3ad34326ff143d47ca2533281ab7385ebaf9b7852de17acfa7e0e
4
+ data.tar.gz: 75207c13914183bd17bb472474f8a0136856381da6726d336f171ca499e8f904
5
5
  SHA512:
6
- metadata.gz: cb050a766a19c495260d9f8b61d11a607961bce6d3017f51519885476170cd09b8ee2c3d18e4e280945b60f94f09511a8be287645671a3120af38d3cbca3c954
7
- data.tar.gz: 8bf828001abe8bf23f6b67e8aa1605ac931782920d0041bf9f80663d8bbde2d80654b62bdf5c630ff5101ef5512c09b9a0eb6ff9fd4e2fff6966a6bafc1079b3
6
+ metadata.gz: c544b5c0f541d514efe44186f8ed9c5891238ebbbebccd5fb31744756310faec3eaa954a7a084e6c45e9d7c04e1454be41632244a8670c93e3589c0f49585712
7
+ data.tar.gz: 43eb5f6a63ab6eed1c0bbab1a13460c4aac105423608ec854b81bef3b8f8cb95ad72f208e0605f34f52befd791c41e00fa1223de755dcb6541c024451b704465
data/CHANGELOG.md CHANGED
@@ -3,3 +3,9 @@
3
3
  ## [0.1.0] - 2024-02-21
4
4
 
5
5
  - Initial release
6
+
7
+ ## [0.2.0] - 2024-02-21
8
+ - Add postgresql
9
+
10
+ ## [0.2.1] - 2024-02-21
11
+ - Add pg gem to Gemfile
data/README.md CHANGED
@@ -9,7 +9,7 @@ This gem creates a [Lando](https://lando.dev/) config file for running [Solr](ht
9
9
  ## Installation
10
10
  1. Add this gem to the `Gemfile` of your Blacklight application:
11
11
  ```
12
- gem "blacklight_lando", "~> 0.1"
12
+ gem "blacklight_lando", "~> 0.2"
13
13
  ```
14
14
  2. Run `bundle install`
15
15
  3. Run `rails generate blacklight_lando:lando`
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlacklightLando
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.1"
5
5
  end
@@ -3,6 +3,11 @@
3
3
  require_relative "blacklight_lando/version"
4
4
  require_relative "generators/lando_generator"
5
5
 
6
+ # Configure a Blacklight application to use Lando for Solr and Postresql
6
7
  module BlacklightLando
7
8
  class Error < StandardError; end
9
+
10
+ def self.root
11
+ File.dirname __dir__
12
+ end
8
13
  end
@@ -12,13 +12,30 @@ module BlacklightLando
12
12
  1. Adds .lando.yml to your application
13
13
  2. Adds lando_env.rb to your application and includes it in application.rb
14
14
  3. Copies lando-configured config/blacklight.yml into your application
15
- 4. Adds rsolr to your Gemfile
15
+ 4. Copies lando-configured config/database.yml into your application
16
16
  EOF
17
17
  # rubocop:enable Naming/HeredocDelimiterNaming
18
18
 
19
+ # Add postgres gem to Gemfile
20
+ def add_pg_gem
21
+ gem "pg"
22
+ end
23
+
24
+ def bundle_install
25
+ return if Rails.env.test?
26
+
27
+ inside destination_root do
28
+ Bundler.with_unbundled_env do
29
+ run "bundle install"
30
+ end
31
+ end
32
+ end
33
+
19
34
  def create_lando_config
20
35
  copy_file ".lando.yml"
21
36
  copy_file "lando_env.rb", "config/initializers/lando_env.rb"
37
+ copy_file "blacklight.yml", "config/blacklight.yml"
38
+ copy_file "database.yml", "config/database.yml"
22
39
  end
23
40
  end
24
41
  end
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: search_app
2
+ name: blacklight
3
3
  services:
4
4
  test_solr:
5
5
  type: solr:8.4
@@ -13,6 +13,9 @@ services:
13
13
  core: blacklight-core-dev
14
14
  config:
15
15
  dir: "solr/conf"
16
+ database:
17
+ type: postgres:15
18
+ portforward: true
16
19
  proxy:
17
20
  test_solr:
18
21
  - blacklight.test.solr.lndo.site:8983
@@ -0,0 +1,13 @@
1
+ load_defaults: 7.19.2
2
+ development:
3
+ adapter: solr
4
+ url: <%= ENV['SOLR_URL'] || ENV['lando_development_solr'] %>
5
+ test: &test
6
+ adapter: solr
7
+ url: <%= ENV['SOLR_URL'] || ENV['lando_test_solr'] %>
8
+ production:
9
+ adapter: solr
10
+ url: <%= ENV['SOLR_URL'] %>
11
+ staging:
12
+ adapter: solr
13
+ url: <%= ENV['SOLR_URL'] %>
@@ -0,0 +1,26 @@
1
+ default: &default
2
+ adapter: postgresql
3
+ encoding: utf8
4
+ min_messages: warning
5
+ pool: <%= Integer(ENV.fetch("DB_POOL", 40)) %>
6
+ reaping_frequency: <%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
7
+ timeout: 5000
8
+ host: <%= ENV["lando_database_conn_host"] || ENV["APP_DB_HOST"] || "localhost" %>
9
+ port: <%= ENV["lando_database_conn_port"] || 5432 %>
10
+ username: <%= ENV["lando_database_creds_user"] || ENV["APP_DB_USERNAME"] %>
11
+ password: <%= ENV["lando_database_creds_password"] || ENV["APP_DB_PASSWORD"] %>
12
+ database: <%= ENV['APP_DB'] %>
13
+
14
+ development:
15
+ <<: *default
16
+ database: <%= ENV["lando_database_creds_database"] || ENV["APP_DB"] %>
17
+
18
+ test:
19
+ <<: *default
20
+ database: <%= ENV["lando_database_creds_database"] || ENV["APP_DB"] %>
21
+
22
+ production:
23
+ <<: *default
24
+
25
+ staging:
26
+ <<: *default
@@ -2,7 +2,8 @@
2
2
 
3
3
  if Rails.env.development? || Rails.env.test?
4
4
  begin
5
- lando_services = JSON.parse(`lando info --format json`, symbolize_names: true)
5
+ lando_info = `lando info --format json`
6
+ lando_services = JSON.parse(lando_info, symbolize_names: true)
6
7
  lando_services.each do |service|
7
8
  case service[:service]
8
9
  when "test_solr"
@@ -10,6 +11,11 @@ if Rails.env.development? || Rails.env.test?
10
11
  when "development_solr"
11
12
  ENV["lando_development_solr"] = "http://#{service[:external_connection][:host]}:#{service[:external_connection][:port]}/solr/#{service[:core]}"
12
13
  end
14
+ next unless service[:creds]
15
+
16
+ service[:creds].each do |key, value|
17
+ ENV["lando_#{service[:service]}_creds_#{key}"] = value
18
+ end
13
19
  end
14
20
  rescue StandardError
15
21
  nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_lando
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bess Sadler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-26 00:00:00.000000000 Z
11
+ date: 2024-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blacklight
@@ -90,8 +90,6 @@ executables: []
90
90
  extensions: []
91
91
  extra_rdoc_files: []
92
92
  files:
93
- - ".byebug_history"
94
- - ".lando.yml"
95
93
  - ".rspec"
96
94
  - ".rubocop.yml"
97
95
  - CHANGELOG.md
@@ -99,11 +97,12 @@ files:
99
97
  - LICENSE
100
98
  - README.md
101
99
  - Rakefile
102
- - config/lando_env.rb
103
100
  - lib/blacklight_lando.rb
104
101
  - lib/blacklight_lando/version.rb
105
102
  - lib/generators/lando_generator.rb
106
103
  - lib/generators/templates/.lando.yml
104
+ - lib/generators/templates/blacklight.yml
105
+ - lib/generators/templates/database.yml
107
106
  - lib/generators/templates/lando_env.rb
108
107
  - sig/blacklight_lando.rbs
109
108
  homepage: https://github.com/bess/blacklight_lando
data/.byebug_history DELETED
@@ -1,22 +0,0 @@
1
- n
2
- fixture_file_destination
3
- fixture_file
4
- exit
5
- generator.generate
6
- generator.shell.destination_stack
7
- generator.shell
8
- generator.shell.base.destination_stack
9
- generator.shell.base
10
- generator.shell.public_methods - Object.methods
11
- generator.shell
12
- generator.shell.destination_stack
13
- generator.shell
14
- generator.options
15
- generator
16
- generator.base
17
- generator
18
- generator.destination_stack
19
- generator
20
- exit
21
- BlacklightLando::LandoGenerator.generate
22
- BlacklightLando::LandoGenerator
data/.lando.yml DELETED
@@ -1,20 +0,0 @@
1
- ---
2
- name: search_app
3
- services:
4
- test_solr:
5
- type: solr:8.4
6
- portforward: true
7
- core: blacklight-core-test
8
- config:
9
- dir: "solr/conf"
10
- development_solr:
11
- type: solr:8.4
12
- portforward: true
13
- core: blacklight-core-dev
14
- config:
15
- dir: "solr/conf"
16
- proxy:
17
- test_solr:
18
- - blacklight.test.solr.lndo.site:8983
19
- development_solr:
20
- - blacklight.dev.solr.lndo.site:8983
data/config/lando_env.rb DELETED
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if Rails.env.development? || Rails.env.test?
4
- begin
5
- lando_services = JSON.parse(`lando info --format json`, symbolize_names: true)
6
- lando_services.each do |service|
7
- case service[:service]
8
- when "test_solr"
9
- ENV["lando_test_solr"] = "http://#{service[:external_connection][:host]}:#{service[:external_connection][:port]}/solr/#{service[:core]}"
10
- when "development_solr"
11
- ENV["lando_development_solr"] = "http://#{service[:external_connection][:host]}:#{service[:external_connection][:port]}/solr/#{service[:core]}"
12
- end
13
- end
14
- rescue StandardError
15
- nil
16
- end
17
- end