rails-contact 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f8cf546cda0f081e8da876f17377f8d71f384c41c868cfda1d19af009c6fd63
|
|
4
|
+
data.tar.gz: 307ce9285a133f372d09aa503235620ab669a6ef94a60cbdd132486dc3086cc5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 721d2f5d8a7b111d6139069bd9af461278e385dca6080fbed28521fc582ba9ad8a4ecee3f1d4b6f5f9bae241ce94f22a18f61757b16aa290ec9c1bd6e495dec1
|
|
7
|
+
data.tar.gz: 15b1587cd03cdc1b5d090b7f972c2c2d84e9313d7f7ae07e070d86bf14bbcd630ed4fb1e390d2a92cc164a5564663edbc59e4a296616195478053b53bb14047d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
- Fix mounted route shape to avoid `/contacts/contacts` duplication.
|
|
6
|
+
- Improve README quick-start and generator documentation.
|
|
7
|
+
- Add controller override generator (`rails generate rails:contact:controllers`).
|
|
8
|
+
- CI/test command hardening and Ruby 3.2 dependency compatibility fixes.
|
|
9
|
+
|
|
3
10
|
## 0.1.0
|
|
4
11
|
|
|
5
12
|
- Initial release of `rails-contact`.
|
data/README.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# rails-contact
|
|
2
2
|
|
|
3
|
-
`rails-contact` is a mountable Rails engine
|
|
3
|
+
`rails-contact` is a mountable Rails engine to manage contacts in your app, with optional Elasticsearch search and Google Contacts sync.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- Elasticsearch-powered search/filter (with DB fallback)
|
|
7
|
-
- CSV import pipeline
|
|
8
|
-
- capped rolling-window Google Contacts sync hooks
|
|
5
|
+
## What you get
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
- Contact CRUD screens and controller
|
|
8
|
+
- Local contact schema (emails, phones, addresses)
|
|
9
|
+
- CSV importer
|
|
10
|
+
- Elasticsearch search backend (with DB fallback)
|
|
11
|
+
- Google sync service scaffolding
|
|
12
|
+
- Install, migration, view, and controller generators
|
|
13
|
+
|
|
14
|
+
## 1) Install the gem
|
|
11
15
|
|
|
12
16
|
```ruby
|
|
13
17
|
gem "rails-contact"
|
|
@@ -15,46 +19,78 @@ gem "rails-contact"
|
|
|
15
19
|
|
|
16
20
|
```bash
|
|
17
21
|
bundle install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 2) Run generators
|
|
25
|
+
|
|
26
|
+
```bash
|
|
18
27
|
rails generate rails:contact:install
|
|
19
28
|
rails generate rails:contact:contact Contact
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Optional override generators (Devise-style customization):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
rails generate rails:contact:views
|
|
35
|
+
rails generate rails:contact:controllers
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then migrate:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
20
41
|
rails db:migrate
|
|
21
42
|
```
|
|
22
43
|
|
|
23
|
-
##
|
|
44
|
+
## 3) Mount routes (clean paths)
|
|
45
|
+
|
|
46
|
+
Use either:
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
mount Rails::Contact::Engine => "/contacts", as: "rails_contact"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
or:
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
rails_contact_for :contacts
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
With this setup, paths are:
|
|
59
|
+
- `/contacts` (index)
|
|
60
|
+
- `/contacts/new`
|
|
61
|
+
- `/contacts/:id`
|
|
24
62
|
|
|
25
|
-
|
|
63
|
+
No `/contacts/contacts` duplication.
|
|
64
|
+
|
|
65
|
+
## 4) Configure
|
|
66
|
+
|
|
67
|
+
Generated initializer: `config/initializers/rails_contact.rb`
|
|
26
68
|
|
|
27
69
|
```ruby
|
|
28
70
|
Rails::Contact.configure do |config|
|
|
29
71
|
config.search_backend = :elasticsearch
|
|
30
72
|
config.elasticsearch_url = ENV.fetch("ELASTICSEARCH_URL", "http://127.0.0.1:9200")
|
|
31
|
-
config.google_sync_enabled =
|
|
73
|
+
config.google_sync_enabled = false
|
|
32
74
|
config.google_max_contacts = 25_000
|
|
33
75
|
config.rolling_window_sort = :updated_at
|
|
34
76
|
end
|
|
35
77
|
```
|
|
36
78
|
|
|
37
|
-
##
|
|
79
|
+
## CSV import
|
|
38
80
|
|
|
39
|
-
```
|
|
40
|
-
|
|
81
|
+
```bash
|
|
82
|
+
rake rails_contact:import_csv CSV_PATH=/absolute/path/to/eq.csv
|
|
41
83
|
```
|
|
42
84
|
|
|
43
|
-
##
|
|
85
|
+
## Utility tasks
|
|
44
86
|
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
- CSV import mapping for fields like Enquirer First Name / Enquirer Email / country-code phones
|
|
48
|
-
- Google payload mapping and sync service scaffolding
|
|
49
|
-
- Reindex and sync tasks:
|
|
50
|
-
- `rake rails_contact:reindex`
|
|
51
|
-
- `rake rails_contact:sync_google`
|
|
52
|
-
- `rake rails_contact:import_csv CSV_PATH=/path/to/file.csv`
|
|
87
|
+
- `rake rails_contact:reindex`
|
|
88
|
+
- `rake rails_contact:sync_google`
|
|
53
89
|
|
|
54
90
|
## Test
|
|
55
91
|
|
|
56
92
|
```bash
|
|
57
|
-
bundle exec ruby -Itest test/**/*_test.rb
|
|
93
|
+
bundle exec ruby -Itest -e 'Dir["test/**/*_test.rb"].sort.each { |f| require File.expand_path(f) }'
|
|
58
94
|
```
|
|
59
95
|
|
|
60
96
|
## Release
|
|
@@ -64,8 +100,4 @@ bundle exec rake build
|
|
|
64
100
|
bundle exec rake release
|
|
65
101
|
```
|
|
66
102
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## License
|
|
70
|
-
|
|
71
|
-
MIT.
|
|
103
|
+
RubyGems MFA is required.
|
data/config/routes.rb
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
Rails::Contact::Engine.routes.draw do
|
|
2
|
-
|
|
2
|
+
get "/", to: "contacts#index", as: :contacts
|
|
3
|
+
get "/new", to: "contacts#new", as: :new_contact
|
|
4
|
+
post "/", to: "contacts#create"
|
|
5
|
+
get "/:id", to: "contacts#show", as: :contact
|
|
6
|
+
get "/:id/edit", to: "contacts#edit", as: :edit_contact
|
|
7
|
+
patch "/:id", to: "contacts#update"
|
|
8
|
+
put "/:id", to: "contacts#update"
|
|
9
|
+
delete "/:id", to: "contacts#destroy"
|
|
3
10
|
root to: "contacts#index"
|
|
4
11
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "rails/generators/base"
|
|
2
|
+
|
|
3
|
+
module Rails
|
|
4
|
+
module Contact
|
|
5
|
+
module Generators
|
|
6
|
+
class ControllersGenerator < ::Rails::Generators::Base
|
|
7
|
+
source_root File.expand_path("templates", __dir__)
|
|
8
|
+
|
|
9
|
+
def copy_controllers
|
|
10
|
+
template "contacts_controller.rb.tt", "app/controllers/rails/contact/contacts_controller.rb"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails-contact
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kshitiz Sinha
|
|
@@ -133,8 +133,10 @@ files:
|
|
|
133
133
|
- bin/rubocop
|
|
134
134
|
- config/routes.rb
|
|
135
135
|
- lib/generators/rails/contact/contact_generator.rb
|
|
136
|
+
- lib/generators/rails/contact/controllers_generator.rb
|
|
136
137
|
- lib/generators/rails/contact/install/install_generator.rb
|
|
137
138
|
- lib/generators/rails/contact/install/templates/rails_contact.rb.tt
|
|
139
|
+
- lib/generators/rails/contact/templates/contacts_controller.rb.tt
|
|
138
140
|
- lib/generators/rails/contact/templates/create_rails_contact_contact_addresses.rb.tt
|
|
139
141
|
- lib/generators/rails/contact/templates/create_rails_contact_contact_emails.rb.tt
|
|
140
142
|
- lib/generators/rails/contact/templates/create_rails_contact_contact_phones.rb.tt
|