Skip to content

Commit

Permalink
Rename top-level roam.extensions -> roam.ext
Browse files Browse the repository at this point in the history
  • Loading branch information
chipsenkbeil committed May 3, 2024
1 parent f566e42 commit ce8b12d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions lua/org-roam.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end
---@field config org-roam.Config
---@field database org-roam.Database
---@field events org-roam.Events
---@field extensions org-roam.Extensions
---@field ext org-roam.Extensions
---@field setup org-roam.Setup
---@field ui org-roam.UserInterface
---@field utils org-roam.Utils
Expand Down Expand Up @@ -73,7 +73,7 @@ function M:new(config)
return require("org-roam.events")(instance)
end

lazy.extensions = function()
lazy.ext = function()
return require("org-roam.extensions")(instance)
end

Expand Down
22 changes: 11 additions & 11 deletions lua/org-roam/setup/keybindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -248,87 +248,87 @@ local function assign_dailies_keybindings(roam)
bindings.capture_date,
"Capture a specific date's note",
function()
roam.extensions.dailies.capture_date()
roam.ext.dailies.capture_date()
end
)

assign(
bindings.capture_today,
"Capture today's note",
function()
roam.extensions.dailies.capture_today()
roam.ext.dailies.capture_today()
end
)

assign(
bindings.capture_tomorrow,
"Capture tomorrow's note",
function()
roam.extensions.dailies.capture_tomorrow()
roam.ext.dailies.capture_tomorrow()
end
)

assign(
bindings.capture_yesterday,
"Capture yesterday's note",
function()
roam.extensions.dailies.capture_yesterday()
roam.ext.dailies.capture_yesterday()
end
)

assign(
bindings.find_directory,
"Navigate to dailies note directory",
function()
roam.extensions.dailies.find_directory()
roam.ext.dailies.find_directory()
end
)

assign(
bindings.goto_date,
"Navigate to a specific date's note",
function()
roam.extensions.dailies.goto_date()
roam.ext.dailies.goto_date()
end
)

assign(
bindings.goto_today,
"Navigate to today's note",
function()
roam.extensions.dailies.goto_today()
roam.ext.dailies.goto_today()
end
)

assign(
bindings.goto_tomorrow,
"Navigate to tomorrow's note",
function()
roam.extensions.dailies.goto_tomorrow()
roam.ext.dailies.goto_tomorrow()
end
)

assign(
bindings.goto_yesterday,
"Navigate to yesterday's note",
function()
roam.extensions.dailies.goto_yesterday()
roam.ext.dailies.goto_yesterday()
end
)

assign(
bindings.goto_next_date,
"Navigate to the next available note",
function()
roam.extensions.dailies.goto_next_date()
roam.ext.dailies.goto_next_date()
end
)

assign(
bindings.goto_prev_date,
"Navigate to the previous available note",
function()
roam.extensions.dailies.goto_prev_date()
roam.ext.dailies.goto_prev_date()
end
)
end
Expand Down
58 changes: 29 additions & 29 deletions spec/extensions_dailies_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("org-roam.extensions.dailies", function()
utils.mock_calendar("2024-04-27")

-- Start the capture process
local id = roam.extensions.dailies.capture_date()
local id = roam.ext.dailies.capture_date()

-- Wait a bit for the capture buffer to appear
utils.wait()
Expand Down Expand Up @@ -91,7 +91,7 @@ describe("org-roam.extensions.dailies", function()
})

-- Start the capture process
local id = roam.extensions.dailies.capture_date({
local id = roam.ext.dailies.capture_date({
date = utils.date_from_string("2024-04-27"),
})

Expand Down Expand Up @@ -139,7 +139,7 @@ describe("org-roam.extensions.dailies", function()
local date = os.date("%Y-%m-%d", Date.today().timestamp)

-- Start the capture process
local id = roam.extensions.dailies.capture_today()
local id = roam.ext.dailies.capture_today()

-- Wait a bit for the capture buffer to appear
utils.wait()
Expand Down Expand Up @@ -185,7 +185,7 @@ describe("org-roam.extensions.dailies", function()
local date = os.date("%Y-%m-%d", Date.tomorrow().timestamp)

-- Start the capture process
local id = roam.extensions.dailies.capture_tomorrow()
local id = roam.ext.dailies.capture_tomorrow()

-- Wait a bit for the capture buffer to appear
utils.wait()
Expand Down Expand Up @@ -231,7 +231,7 @@ describe("org-roam.extensions.dailies", function()
local date = os.date("%Y-%m-%d", Date.today():subtract({ day = 1 }).timestamp)

-- Start the capture process
local id = roam.extensions.dailies.capture_yesterday()
local id = roam.ext.dailies.capture_yesterday()

-- Wait a bit for the capture buffer to appear
utils.wait()
Expand Down Expand Up @@ -275,7 +275,7 @@ describe("org-roam.extensions.dailies", function()
})

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_date({
local date = roam.ext.dailies.goto_date({
date = "2024-04-27",
}):wait()

Expand All @@ -292,7 +292,7 @@ describe("org-roam.extensions.dailies", function()
roam.database:load():wait()

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_date({
local date = roam.ext.dailies.goto_date({
date = "2024-04-27",
}):wait()

Expand Down Expand Up @@ -322,7 +322,7 @@ describe("org-roam.extensions.dailies", function()
})

-- Do the navigation without opening the calendar
roam.extensions.dailies.goto_today():wait()
roam.ext.dailies.goto_today():wait()

assert.are.same({
"some file",
Expand All @@ -337,7 +337,7 @@ describe("org-roam.extensions.dailies", function()
local date = os.date("%Y-%m-%d", Date.today().timestamp) --[[ @cast date string ]]

-- Do the navigation without opening the calendar
roam.extensions.dailies.goto_today():wait()
roam.ext.dailies.goto_today():wait()

local lines = utils.read_buffer()
lines[2] = string.sub(lines[2], 1, 4) .. " <ID>"
Expand All @@ -363,7 +363,7 @@ describe("org-roam.extensions.dailies", function()
})

-- Do the navigation without opening the calendar
roam.extensions.dailies.goto_tomorrow():wait()
roam.ext.dailies.goto_tomorrow():wait()

assert.are.same({
"some file",
Expand All @@ -378,7 +378,7 @@ describe("org-roam.extensions.dailies", function()
local date = os.date("%Y-%m-%d", Date.tomorrow().timestamp) --[[ @cast date string ]]

-- Do the navigation without opening the calendar
roam.extensions.dailies.goto_tomorrow():wait()
roam.ext.dailies.goto_tomorrow():wait()

local lines = utils.read_buffer()
lines[2] = string.sub(lines[2], 1, 4) .. " <ID>"
Expand All @@ -404,7 +404,7 @@ describe("org-roam.extensions.dailies", function()
})

-- Do the navigation without opening the calendar
roam.extensions.dailies.goto_yesterday():wait()
roam.ext.dailies.goto_yesterday():wait()

assert.are.same({
"some file",
Expand All @@ -419,7 +419,7 @@ describe("org-roam.extensions.dailies", function()
local date = os.date("%Y-%m-%d", Date.today():subtract({ day = 1 }).timestamp) --[[ @cast date string ]]

-- Do the navigation without opening the calendar
roam.extensions.dailies.goto_yesterday():wait()
roam.ext.dailies.goto_yesterday():wait()

local lines = utils.read_buffer()
lines[2] = string.sub(lines[2], 1, 4) .. " <ID>"
Expand All @@ -444,7 +444,7 @@ describe("org-roam.extensions.dailies", function()
write_date_file("2024-04-29", "c")

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_next_date():wait()
local date = roam.ext.dailies.goto_next_date():wait()
assert.is_nil(date)

assert.are.same({ "test" }, utils.read_buffer())
Expand All @@ -461,7 +461,7 @@ describe("org-roam.extensions.dailies", function()
vim.cmd.edit(path)

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_next_date():wait()
local date = roam.ext.dailies.goto_next_date():wait()
assert.is_nil(date)

assert.are.same({ "c" }, utils.read_buffer())
Expand All @@ -478,7 +478,7 @@ describe("org-roam.extensions.dailies", function()
vim.cmd.edit(path)

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_next_date({ n = -1 }):wait()
local date = roam.ext.dailies.goto_next_date({ n = -1 }):wait()
assert.is_nil(date)

assert.are.same({ "a" }, utils.read_buffer())
Expand All @@ -495,7 +495,7 @@ describe("org-roam.extensions.dailies", function()
vim.cmd.edit(path)

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_next_date():wait()
local date = roam.ext.dailies.goto_next_date():wait()
assert.are.equal(utils.date_from_string("2024-04-05"), date)

assert.are.same({ "c" }, utils.read_buffer())
Expand All @@ -512,7 +512,7 @@ describe("org-roam.extensions.dailies", function()
vim.cmd.edit(path)

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_next_date({ n = -1 }):wait()
local date = roam.ext.dailies.goto_next_date({ n = -1 }):wait()
assert.are.equal(utils.date_from_string("2024-04-01"), date)

assert.are.same({ "a" }, utils.read_buffer())
Expand All @@ -528,10 +528,10 @@ describe("org-roam.extensions.dailies", function()

vim.cmd.edit(path)

assert.is_nil(roam.extensions.dailies.goto_next_date({ n = 2 }):wait())
assert.is_nil(roam.ext.dailies.goto_next_date({ n = 2 }):wait())
assert.are.same({ "b" }, utils.read_buffer())

assert.is_nil(roam.extensions.dailies.goto_next_date({ n = -2 }):wait())
assert.is_nil(roam.ext.dailies.goto_next_date({ n = -2 }):wait())
assert.are.same({ "b" }, utils.read_buffer())
end)

Expand All @@ -547,7 +547,7 @@ describe("org-roam.extensions.dailies", function()

vim.cmd.edit(path)

local date = roam.extensions.dailies.goto_next_date({ n = 2 }):wait()
local date = roam.ext.dailies.goto_next_date({ n = 2 }):wait()
assert.are.equal(utils.date_from_string("2024-04-30"), date)
assert.are.same({ "e" }, utils.read_buffer())
end)
Expand All @@ -564,7 +564,7 @@ describe("org-roam.extensions.dailies", function()
write_date_file("2024-04-29", "c")

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_prev_date():wait()
local date = roam.ext.dailies.goto_prev_date():wait()
assert.is_nil(date)

assert.are.same({ "test" }, utils.read_buffer())
Expand All @@ -581,7 +581,7 @@ describe("org-roam.extensions.dailies", function()
vim.cmd.edit(path)

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_prev_date():wait()
local date = roam.ext.dailies.goto_prev_date():wait()
assert.is_nil(date)

assert.are.same({ "a" }, utils.read_buffer())
Expand All @@ -598,7 +598,7 @@ describe("org-roam.extensions.dailies", function()
vim.cmd.edit(path)

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_prev_date({ n = -1 }):wait()
local date = roam.ext.dailies.goto_prev_date({ n = -1 }):wait()
assert.is_nil(date)

assert.are.same({ "c" }, utils.read_buffer())
Expand All @@ -615,7 +615,7 @@ describe("org-roam.extensions.dailies", function()
vim.cmd.edit(path)

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_prev_date():wait()
local date = roam.ext.dailies.goto_prev_date():wait()
assert.are.equal(utils.date_from_string("2024-04-01"), date)

assert.are.same({ "a" }, utils.read_buffer())
Expand All @@ -632,7 +632,7 @@ describe("org-roam.extensions.dailies", function()
vim.cmd.edit(path)

-- Do the navigation without opening the calendar
local date = roam.extensions.dailies.goto_prev_date({ n = -1 }):wait()
local date = roam.ext.dailies.goto_prev_date({ n = -1 }):wait()
assert.are.equal(utils.date_from_string("2024-04-05"), date)

assert.are.same({ "c" }, utils.read_buffer())
Expand All @@ -648,10 +648,10 @@ describe("org-roam.extensions.dailies", function()

vim.cmd.edit(path)

assert.is_nil(roam.extensions.dailies.goto_prev_date({ n = 2 }):wait())
assert.is_nil(roam.ext.dailies.goto_prev_date({ n = 2 }):wait())
assert.are.same({ "b" }, utils.read_buffer())

assert.is_nil(roam.extensions.dailies.goto_prev_date({ n = -2 }):wait())
assert.is_nil(roam.ext.dailies.goto_prev_date({ n = -2 }):wait())
assert.are.same({ "b" }, utils.read_buffer())
end)

Expand All @@ -667,7 +667,7 @@ describe("org-roam.extensions.dailies", function()

vim.cmd.edit(path)

local date = roam.extensions.dailies.goto_prev_date({ n = 2 }):wait()
local date = roam.ext.dailies.goto_prev_date({ n = 2 }):wait()
assert.are.equal(utils.date_from_string("2024-04-10"), date)
assert.are.same({ "a" }, utils.read_buffer())
end)
Expand Down

0 comments on commit ce8b12d

Please sign in to comment.