Skip to content

Commit

Permalink
Renaming hammerspoon dir to avoid package ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrady committed Mar 28, 2018
1 parent 6e271e3 commit ffe052c
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# lua-utils
A collection of utilities I've built as-needed for progamming in Lua and working with [Hammerspoon](hammerspoon.org).

Utilities compatible with vanilla Lua 5.3 are at the top level, while those intended for working with and/or extending Hammerspoon core libraries are nested within the `hs` directory.
Utilities compatible with vanilla Lua 5.3 are at the top level, while those intended for working with and/or extending Hammerspoon core libraries are nested within the `hammerspoon` directory.

**NOTE:** If using any `hammerspoon` utilities, be sure to add the `lua-utils/?.lua` and `lua-utils/hammerspoon/?.lua` patterns to your `package.path`: some of the Hammerspoon utilities rely on the vanilla Lua ones.
File renamed without changes.
2 changes: 1 addition & 1 deletion hs/canvas.lua → hammerspoon/canvas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module = module or require('hs.canvas')
assert(type(module) == 'table', 'must provide a table to extend')

require('hs.timer')
requrie('hs.fnutils')
require('hs.fnutils')

---- Rolling my own 'show and hide with fade-out': need to be able to cancel the animation.
module.flashable = {}
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions hs/fs.lua → hammerspoon/fs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ function module.dirs(path)
return directories
end

-- Load each file in a given directory, with any arguments given.
function module.loadAllFiles(rootDir, ...)
-- Load each file in a given directory with the given extension, with any arguments given.
function module.loadAllFiles(rootDir, ext, ...)
-- Make sure our root ends with a directory marker.
rootDir = rootDir:endsWith('/') and rootDir or rootDir..'/'

local loadedScripts = {}
local _,scripts = hs.fs.dir(rootDir)
repeat
local filename = scripts:next()
if filename and filename ~= '.' and filename ~= '..' then
if filename and filename ~= '.' and filename ~= '..' and filename:endsWith(ext) then
print('\t\tloading script: '..filename)
-- Load the script, passing the given arguments as parameters to the Lua chunk.
-- Using `assert(loadfile(...))` instead of `require` to be compatible with Spoons.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion hs/spotify.lua → hammerspoon/spotify.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local _,_,module = ...
module = module or {}
assert(type(module) == 'table', 'must provide a table to extend')

local tell = require('./application').tell
local tell = require('lua-utils/hammerspoon/application').tell

module.tell = function(...)
tell('Spotify', ...)
Expand Down

0 comments on commit ffe052c

Please sign in to comment.