Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Commit

Permalink
Switch to Wordsmith (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcsmith committed Oct 19, 2018
1 parent 7792e2b commit 47c6a54
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ dependencies:
habitat:
github: luckyframework/habitat
version: ~> 0.4.0
lucky_inflector:
github: luckyframework/lucky_inflector
version: ~> 0.1.1
wordsmith:
github: luckyframework/wordsmith
version: ~> 0.2

scripts:
postinstall: |
Expand Down
2 changes: 1 addition & 1 deletion src/lucky_record.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "lucky_cli"
require "lucky_inflector"
require "wordsmith"
require "habitat"
require "./lucky_record/criteria"
require "./lucky_record/type"
Expand Down
4 changes: 2 additions & 2 deletions src/lucky_record/join.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "lucky_inflector"
require "wordsmith"

module LuckyRecord::Join
abstract class SqlClause
Expand Down Expand Up @@ -26,7 +26,7 @@ module LuckyRecord::Join
end

def default_foreign_key
LuckyInflector::Inflector.singularize(@from) + "_id"
Wordsmith::Inflector.singularize(@from) + "_id"
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/lucky_record/migrator/alter_table_statement.cr
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LuckyRecord::Migrator::AlterTableStatement
{% end %}

{% foreign_key_name = type_declaration.var + "_id" %}
%table_name = {{ references }} || LuckyInflector::Inflector.pluralize({{ underscored_class }})
%table_name = {{ references }} || Wordsmith::Inflector.pluralize({{ underscored_class }})

add_index :{{ foreign_key_name }}
add_column :{{ foreign_key_name }},
Expand Down
2 changes: 1 addition & 1 deletion src/lucky_record/migrator/create_foreign_key_statement.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LuckyRecord::Migrator::CreateForeignKeyStatement
end

def build
foreign_key = @column || LuckyInflector::Inflector.singularize(@to.to_s) + "_id"
foreign_key = @column || Wordsmith::Inflector.singularize(@to.to_s) + "_id"
String.build do |index|
index << "ALTER TABLE"
index << " #{@from}"
Expand Down
2 changes: 1 addition & 1 deletion src/lucky_record/migrator/create_table_statement.cr
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class LuckyRecord::Migrator::CreateTableStatement
{% end %}

{% foreign_key_name = type_declaration.var + "_id" %}
%table_name = {{ references }} || LuckyInflector::Inflector.pluralize({{ underscored_class }})
%table_name = {{ references }} || Wordsmith::Inflector.pluralize({{ underscored_class }})
add_column(:{{ foreign_key_name }}, {{ foreign_key_type.id }}.db_type, {{ optional }}, reference: %table_name, on_delete: {{ on_delete }})
add_index :{{ foreign_key_name }}
end
Expand Down
4 changes: 2 additions & 2 deletions src/run_macros/infer_table_name.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require "lucky_inflector"
require "wordsmith"

print LuckyInflector::Inflector.pluralize(ARGV[0]).underscore
print Wordsmith::Inflector.pluralize(ARGV[0]).underscore

0 comments on commit 47c6a54

Please sign in to comment.