Skip to content

Commit

Permalink
refactor: rename to gloogle
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Hivert <[email protected]>
  • Loading branch information
ghivert committed May 6, 2024
1 parent e89475e commit 7209ed0
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions apps/backend/scripts/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ import * as dotenv from 'https://deno.land/[email protected]/dotenv/mod.ts'
import * as path from 'https://deno.land/[email protected]/path/mod.ts'
import * as thread from './thread.ts'

export const NAME = 'gling-postgres'
export const NAME = 'gloogle-postgres'

export const createDatabases = async () => {
const runPg = ['run', '--name', NAME, '-e', 'POSTGRES_PASSWORD=gling', '-p', '5432:5432', '-d', 'postgres']
const runPg = ['run', '--name', NAME, '-e', 'POSTGRES_PASSWORD=gloogle', '-p', '5432:5432', '-d', 'postgres']
await new Deno.Command('docker', { args: runPg }).output()
await thread.sleep()
console.info('🎉 Postgres container successfully created!')
const id = await getDatabaseID()
if (id) {
await new Deno.Command('docker', { args: ['exec', id, 'createdb', '-U', 'postgres', 'gling_development'] }).output()
await new Deno.Command('docker', { args: ['exec', id, 'createdb', '-U', 'postgres', 'gling_test'] }).output()
await new Deno.Command('docker', { args: ['exec', id, 'createdb', '-U', 'postgres', 'gloogle_development'] }).output()
await new Deno.Command('docker', { args: ['exec', id, 'createdb', '-U', 'postgres', 'gloogle_test'] }).output()
await thread.sleep()
}
console.info('🥳 Database gling_development successfully created!')
console.info('🥳 Database gling_test successfully created!')
console.info('🥳 Database gloogle_development successfully created!')
console.info('🥳 Database gloogle_test successfully created!')
}

export const writeDotEnv = async () => {
const dirname = path.fromFileUrl(import.meta.url)
const envPath = path.resolve(dirname, '../../.env')
const envPathTest = path.resolve(dirname, '../../.env.test')
const envs = [[envPath, 'gling_development'], [envPathTest, 'gling_test']]
const envs = [[envPath, 'gloogle_development'], [envPathTest, 'gloogle_test']]
await Promise.all(envs.map(async ([envPath, dbName]) => {
const content = await dotenv.load({ envPath })
const dbUrl = ['postgres://postgres:gling@localhost:5432', dbName].join('/')
const dbUrl = ['postgres://postgres:gloogle@localhost:5432', dbName].join('/')
const sslDisabled = [dbUrl, 'sslmode=disable'].join('?')
const newContent: Record<string, string> = { ...content, DATABASE_URL: sslDisabled }
await Deno.writeTextFile(envPath, dotenv.stringify(newContent))
Expand Down
8 changes: 4 additions & 4 deletions apps/backend/src/api/hex.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn get_package_owners(package_name: String, secret hex_api_key: String) {
|> request.set_host("hex.pm")
|> request.set_path("/api/packages/" <> package_name <> "/owners")
|> request.prepend_header("authorization", hex_api_key)
|> request.prepend_header("user-agent", "gling / 0.0.0")
|> request.prepend_header("user-agent", "gloogle / 0.0.0")
|> httpc.send()
|> result.map_error(error.FetchError),
)
Expand All @@ -30,7 +30,7 @@ pub fn get_package(package_name: String, secret hex_api_key: String) {
|> request.set_host("hex.pm")
|> request.set_path("/api/packages/" <> package_name)
|> request.prepend_header("authorization", hex_api_key)
|> request.prepend_header("user-agent", "gling / 0.0.0")
|> request.prepend_header("user-agent", "gloogle / 0.0.0")
|> httpc.send()
|> result.map_error(error.FetchError),
)
Expand All @@ -57,7 +57,7 @@ pub fn lookup_release(release: hexpm.PackageRelease, secret hex_api_key: String)
|> request.set_host("hex.pm")
|> request.set_path(url.path)
|> request.prepend_header("authorization", hex_api_key)
|> request.prepend_header("user-agent", "gling / 0.0.0")
|> request.prepend_header("user-agent", "gloogle / 0.0.0")
|> httpc.send()
|> result.map_error(error.FetchError),
)
Expand All @@ -77,7 +77,7 @@ pub fn get_api_packages_page(page: Int, hex_api_key: String) {
#("page", int.to_string(page)),
])
|> request.prepend_header("authorization", hex_api_key)
|> request.prepend_header("user-agent", "gling / 0.0.0")
|> request.prepend_header("user-agent", "gloogle / 0.0.0")
|> httpc.send()
|> result.map_error(error.FetchError),
)
Expand Down
6 changes: 3 additions & 3 deletions apps/backend/src/api/hex_repo.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import simplifile
import tom
import wisp

@external(erlang, "gling_hex_ffi", "get_home")
@external(erlang, "gloogle_hex_ffi", "get_home")
pub fn get_home() -> Result(String, Nil)

@external(erlang, "gling_hex_ffi", "extract_tar")
@external(erlang, "gloogle_hex_ffi", "extract_tar")
fn extract_tar(
tarbin: BitArray,
base_name: String,
slug: String,
) -> Result(#(String, String, String), Nil)

@external(erlang, "gling_hex_ffi", "remove_tar")
@external(erlang, "gloogle_hex_ffi", "remove_tar")
fn remove_tar(slug: String) -> Nil

fn package_slug(name: String, version: String) {
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/gleam/verl.gleam
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@external(erlang, "gling_hex_ffi", "is_match")
@external(erlang, "gloogle_hex_ffi", "is_match")
pub fn is_match(
version version: BitArray,
requirement requirement: BitArray,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-module(gling_hex_ffi).
-module(gloogle_hex_ffi).
-export([extract_tar/3, remove_tar/1, is_match/2, get_home/0, set_level/1]).

package_interface_path(ContentDest, BaseName) ->
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/wisp/logger.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ pub type Level {
Debug
}

@external(erlang, "gling_hex_ffi", "set_level")
@external(erlang, "gloogle_hex_ffi", "set_level")
pub fn set_level(level: Level) -> Nil
2 changes: 1 addition & 1 deletion apps/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" href="/main.css" />
<link rel="stylesheet" href="/normalize.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Gling</title>
<title>gloogle</title>
</head>
<body>
<div id="app"></div>
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/frontend.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import tardis
pub fn main() {
let init = fn(_) { #(model.init(), effect.none()) }

let assert Ok(debugger_) = tardis.single("gling")
let assert Ok(debugger_) = tardis.single("gloogle")

let assert Ok(cache) =
sketch_options.node()
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/frontend/footer/links.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ pub const links = [
],
),
#(
"Gling",
"Gloogle",
[
#("https://github.com/sponsors/ghivert", "Sponsor"),
#("https://github.com/ghivert/gling", "Code"),
#("https://github.com/ghivert/gloogle", "Code"),
],
),
]
2 changes: 1 addition & 1 deletion apps/frontend/src/frontend/footer/view.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn view() {
})
}),
h.div([s.footer_built()], [
h.text("Gling is proudly built with 💜 in gleam for gleamlins"),
h.text("Gloogle is proudly built with 💜 in gleam for gleamlins"),
]),
])
}
4 changes: 2 additions & 2 deletions apps/frontend/src/frontend/view.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ fn body(model: Model) {
h.div([s.search_title_wrapper()], [
h.div([s.search_title()], [
h.img([a.src("/images/lucy.svg"), s.search_lucy()]),
h.text("Gling"),
h.text("Gloogle"),
]),
h.text(
"Gling can search through all public gleam packages, to help you find the function you're looking for! Enter a type or a function name to get some results.",
"Gloogle can search through all public gleam packages, to help you find the function you're looking for! Enter a type or a function name to get some results.",
),
]),
h.input([
Expand Down

0 comments on commit 7209ed0

Please sign in to comment.