Skip to content

Commit

Permalink
Rename Lua module to "editorconfig"
Browse files Browse the repository at this point in the history
But not the LuaRocks package name.
  • Loading branch information
randstr committed Aug 3, 2018
1 parent ca3617e commit 3393dcf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,32 @@ find_package(Lua REQUIRED)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRE ON)

add_library(editorconfig_core MODULE editorconfig_lua.c)
target_compile_definitions(editorconfig_core
add_library(editorconfig_lua MODULE editorconfig_lua.c)
target_compile_definitions(editorconfig_lua
PRIVATE "LEC_VERSION=\"${LEC_VERSION}\""
)
if(CMAKE_COMPILER_IS_GNUCC)
target_compile_options(editorconfig_core
target_compile_options(editorconfig_lua
PUBLIC -Wall -Wextra
)
endif()
target_include_directories(editorconfig_core SYSTEM
target_include_directories(editorconfig_lua SYSTEM
PRIVATE ${EDITORCONFIG_INCLUDE_DIRS} ${LUA_INCLUDE_DIR}
)
target_link_libraries(editorconfig_core
target_link_libraries(editorconfig_lua
${EDITORCONFIG_LIBRARIES}
)
# Omit the lib<name>.so prefix from the DSO
set_target_properties(editorconfig_core PROPERTIES
set_target_properties(editorconfig_lua PROPERTIES
PREFIX ""
OUTPUT_NAME "editorconfig"
)

set(ECL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/lua/${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}"
CACHE PATH "Target installation directory."
)

install(TARGETS editorconfig_core
install(TARGETS editorconfig_lua
DESTINATION ${ECL_LIBDIR}
)

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ make
make test # optional
```

Then copy the `editorconfig_core.so` binary module to somewhere in
Then copy the `editorconfig.so` binary module to somewhere in
your `LUA_CPATH`.

To be able to run the tests you may have to update the git submodule
Expand All @@ -48,7 +48,7 @@ The `parse` module function returns a name/value property table. Typical usage
by plugins would be:

```lua
ec = require("editorconfig_core")
ec = require("editorconfig")

for name, value in pairs(ec.parse("/full/path/to/file")) do
configure_property[name](value)
Expand All @@ -75,7 +75,8 @@ property count for a given file.
Version 0.3.0 introduced major backward incompatibilities.

* The `open`function was removed.
* Every EditorConfig value has the Lua type `string`.
* Every EditorConfig value has the Lua type `string`.
* Lua module renamed to `editorconfig`.

Please update accordingly.

Expand Down
2 changes: 1 addition & 1 deletion editorconfig.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

require("pl")
ec = require("editorconfig_core")
ec = require("editorconfig")

local progname = arg[0]

Expand Down
8 changes: 4 additions & 4 deletions editorconfig_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

/***
* Lua bindings to the EditorConfig C Core library.
* @module editorconfig_core
* @module editorconfig
*/

/* Receives 3 arguments, two optional */
Expand Down Expand Up @@ -140,13 +140,13 @@ add_version(lua_State *L)
lua_setfield(L, -2, "_C_VERSION");
}

static const struct luaL_Reg editorconfig_core[] = {
static const struct luaL_Reg editorconfig_reg[] = {
{"parse", lec_parse},
{NULL, NULL}
};

int luaopen_editorconfig_core (lua_State *L) {
luaL_newlib(L, editorconfig_core);
int luaopen_editorconfig (lua_State *L) {
luaL_newlib(L, editorconfig_reg);
add_version(L);
return 1;
}

0 comments on commit 3393dcf

Please sign in to comment.