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: da9e560dd16bfddaae191d2951cdb891d1c81a5c03e854fa608ce698bad0f4ed
4
- data.tar.gz: be80125cfbca594d514a43701f0468a083868d74cb77a5a7e9fdb9bfa1b92cb3
3
+ metadata.gz: 3f8cf546cda0f081e8da876f17377f8d71f384c41c868cfda1d19af009c6fd63
4
+ data.tar.gz: 307ce9285a133f372d09aa503235620ab669a6ef94a60cbdd132486dc3086cc5
5
5
  SHA512:
6
- metadata.gz: b2e6b507b3e9b1eb0bb4a06a9784ce5965937d3625a74b81749ea60785918f3afeb752f2ae8ca530ff47c4211907e49d9d91e0ea1cf281c8daefdabee92c0a55
7
- data.tar.gz: 7ef76b8f5e22865f80b36a05665c3dd25105ccba061fb5810b6d79c3a530bb2d68d6d9fe1d4464383f76d33989666e1622db2754063e868c6ec9fa715b4f9152
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 for Google-shaped contact management with:
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
- - local source-of-truth data model
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
- ## Install
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
- ## Configure
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
- Initializer: `config/initializers/rails_contact.rb`
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 = true
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
- ## Mount
79
+ ## CSV import
38
80
 
39
- ```ruby
40
- mount Rails::Contact::Engine => "/contacts", as: "rails_contact"
81
+ ```bash
82
+ rake rails_contact:import_csv CSV_PATH=/absolute/path/to/eq.csv
41
83
  ```
42
84
 
43
- ## Features
85
+ ## Utility tasks
44
86
 
45
- - Contact CRUD with nested emails/phones/addresses
46
- - Filter and full-text search by name, email, and phone
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
- Ensure RubyGems MFA is enabled for maintainers.
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
- resources :contacts
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
@@ -0,0 +1,9 @@
1
+ module Rails
2
+ module Contact
3
+ class ContactsController < Rails::Contact::ContactsController
4
+ layout "application"
5
+
6
+ # Override actions here when needed.
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Rails
2
2
  module Contact
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  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.0
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