From b693dccb2b75a563cb33efd7bf267d416521a564 Mon Sep 17 00:00:00 2001 From: Adrian Salceanu Date: Mon, 19 Jul 2021 16:44:25 +0200 Subject: [PATCH] Fixed resource generation for irregular words --- Project.toml | 2 +- src/Generator.jl | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index ca2da4c..e7742fd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SearchLight" uuid = "340e8cb6-72eb-11e8-37ce-c97ebeb32050" authors = ["Adrian Salceanu "] -version = "1.0.0" +version = "1.0.1" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" diff --git a/src/Generator.jl b/src/Generator.jl index de3ecf9..aa4e7aa 100644 --- a/src/Generator.jl +++ b/src/Generator.jl @@ -17,7 +17,7 @@ Generates a new SearchLight model file and persists it to the resources folder. """ function newmodel(name::Union{String,Symbol}; path::Union{String,Nothing} = nothing, pluralize::Bool = true) :: Nothing name = string(name) |> uppercasefirst - model_name = Inflector.is_singular(name) ? Inflector.to_plural(name) : name + model_name = (Inflector.is_singular(name) ? Inflector.to_plural(name) : name) |> uppercasefirst model_path = setup_resource_path(model_name, path) mfn = model_file_name(model_name) @@ -39,12 +39,13 @@ function newresource(resource_name::Union{String,Symbol}; path::Union{String,Not sf = Inflector.to_singular(resource_name) model_name = (sf === nothing ? resource_name : sf) |> uppercasefirst + newmodel(model_name, path = path, pluralize = pluralize) new_table_migration(resource_name, pluralize = pluralize) resource_name = uppercasefirst(resource_name) pluralize && Inflector.is_singular(resource_name) && - (resource_name = Inflector.to_plural(resource_name)) + (resource_name = Inflector.to_plural(resource_name) |> uppercasefirst) resource_path = setup_resource_path(resource_name, path) for (resource_file, resource_type) in [(validator_file_name(resource_name), :validator)]