gem_activity_tracker 0.1.1 → 1.0.0

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: 1a4fc1894fed1dbe9dbb47ee25f486ddd4349ded7feb0a4a91384108735dcbec
4
- data.tar.gz: 5c56a548d26d058ea64fc09485ce615ca56468c1c8fa886ea47cb37833bf8c68
3
+ metadata.gz: 20ff8068ac6c6d5f25370bc05493b268788fd353deb03b44c5bc7fcc5055a2a3
4
+ data.tar.gz: 21c65e1c1b3645d8a807272459d55328ba608371446d7836434ab2c56106b9e1
5
5
  SHA512:
6
- metadata.gz: 9e32b18708d76bc93cb247c0ab2a3a536027e8c8ea7b182b3aa585f989b7a3c33fffbc46ebc9c4120c513a8887d60caef4f797e4999920dc32af36e64aeb46d3
7
- data.tar.gz: 1c7dd0bd08afba432bd0bdeb3c1d85fea8c4e47e07514f9a976363784c034717e85303f5505ed7f5494cd81f2fbd23406a5129a0067789fd3ad0eea27adf00b6
6
+ metadata.gz: 78196e0eb4f23179194535eafcb0acda1613c1c8c96e46b43c38982b52e5673627ac0e604b3bdcec5534f9715414bf13068a05174a1bc9d4d20e5af31e9e40b7
7
+ data.tar.gz: 2ca4a582fe411cd1cb0d850b562835f7f190832d3d0dd812b986be9842e9ee685633e021d48d6f4db86f380afbce5d775a29c423ffe37439347a69e355329582
data/README.md CHANGED
@@ -1,39 +1,25 @@
1
- # 🚀 GemActivityTracker
1
+ # 📊 Gem Activity Tracker
2
2
 
3
- **GemActivityTracker** is a Ruby gem that automatically tracks the structure and changes in your Ruby on Rails project. It collects details like models, controllers, jobs, mailers, services, migrations, schema, routes, and Git history. It also provides real-time file change tracking with a detailed activity log and supports exporting the report as JSON or CSV.
3
+ **`gem_activity_tracker`** is a Ruby gem that tracks the internal structure, changes, and metadata of your **Ruby** or **Rails** projects. It generates a complete project activity report in **YAML**, with support for **JSON/CSV export**, **auto-tracking with file watcher**, and **Git log visualization**.
4
4
 
5
5
  ---
6
6
 
7
- ## 🔍 What Does This Gem Do?
7
+ ## 🚀 Features
8
8
 
9
- When you include this gem in your Rails project, it will:
10
-
11
- - Scan and record project components:
12
- - Models, Controllers, Jobs, Mailers, Services
13
- - Migrations, Routes, Schema hash
14
- - Database type and Git history
15
- - 🔁 Automatically detect changes after initialization
16
- - 🕵️ Keep an activity log of every file change (created, modified, removed)
17
- - 📊 Export report in:
18
- - YAML (default)
19
- - JSON
20
- - CSV
21
- - 🔁 Real-time file watcher using the `listen` gem
22
-
23
- ---
24
-
25
- ## 🔧 Compatibility
26
-
27
- - ✅ **Ruby**: >= 2.6.5 and < 4.0
28
- - ✅ **Rails**: >= 5.2 and <= 7.1
29
-
30
- - ✅ Works with: **MySQL**, **PostgreSQL**, **SQLite**
9
+ - 🔍 Analyze project structure: models, controllers, jobs, services, mailers, routes, etc.
10
+ - 🧠 Advanced model analysis: attributes, associations, methods, validations, callbacks, and enums.
11
+ - 🏗️ Migration tracking and schema hashing.
12
+ - 🛠️ Detect database type from `database.yml`.
13
+ - 📦 Git history tracking (last 20 commits).
14
+ - 🔄 Auto-tracking using the `listen` gem on file changes.
15
+ - 📁 Export report to **YAML**, **JSON**, or **CSV**.
16
+ - Works with both **Rails** and **plain Ruby** projects.
31
17
 
32
18
  ---
33
19
 
34
20
  ## 📦 Installation
35
21
 
36
- Add this line to your Rails application's Gemfile:
22
+ Add this line to your application's Gemfile:
37
23
 
38
24
  ```ruby
39
25
  gem 'gem_activity_tracker'
@@ -45,7 +31,7 @@ Then run:
45
31
  bundle install
46
32
  ```
47
33
 
48
- Or install it manually:
34
+ Or install it directly:
49
35
 
50
36
  ```bash
51
37
  gem install gem_activity_tracker
@@ -53,138 +39,141 @@ gem install gem_activity_tracker
53
39
 
54
40
  ---
55
41
 
56
- ## 🚀 Basic Usage
57
-
58
- Once installed, you can use the CLI commands:
42
+ ## ⚙️ Usage
59
43
 
60
- ### 1. 📌 Generate Activity Report
44
+ ### 📌 Basic CLI Commands
61
45
 
62
46
  ```bash
63
- gem_activity_tracker --track=.
47
+ gem_activity_tracker --track=PATH # Track a Ruby/Rails project and generate report
48
+ gem_activity_tracker --report # Show last generated report
49
+ gem_activity_tracker --export=json # Export report to JSON
50
+ gem_activity_tracker --export=csv # Export report to CSV
51
+ gem_activity_tracker --watch # Start file watcher to auto-track changes
64
52
  ```
65
53
 
66
- It will generate a `report.yml` in the `activity_tracker/` folder.
54
+ ### 🛠️ Rails Auto-Tracking
67
55
 
68
- ---
56
+ In a Rails app, the gem automatically hooks into the app after initialization via a Railtie.
69
57
 
70
- ### 2. 👁 Start Watching for File Changes
58
+ Set this in your `.env` or shell:
71
59
 
72
60
  ```bash
73
- gem_activity_tracker --watch
61
+ export GEM_ACTIVITY_TRACKER_ENABLED=true
74
62
  ```
75
63
 
76
- This will keep watching the project. On any file change (model, controller, migration, etc.), it will:
77
-
78
- - Update the report
79
- - Add a new entry to `log.txt`
64
+ Then start your Rails app and the gem will:
80
65
 
81
- ---
82
-
83
- ### 3. 📄 View Last Generated Report
84
-
85
- ```bash
86
- gem_activity_tracker --report
87
- ```
66
+ - Detect and track changes
67
+ - Update `activity_tracker/report.yml`
68
+ - Start watching the file system
88
69
 
89
70
  ---
90
71
 
91
- ### 4. 📤 Export Report as JSON
92
-
93
- ```bash
94
- gem_activity_tracker --export=json
95
- ```
96
-
97
- ---
72
+ ## 📂 Output
98
73
 
99
- ### 5. 📤 Export Report as CSV
74
+ The gem creates an `activity_tracker/` folder at your project root:
100
75
 
101
76
  ```bash
102
- gem_activity_tracker --export=csv
77
+ activity_tracker/
78
+ ├── report.yml # Main YAML report
79
+ ├── report.json # (Optional) Exported JSON
80
+ ├── report.csv # (Optional) Exported CSV
81
+ └── log.txt # File change logs (when watch mode is on)
103
82
  ```
104
83
 
105
84
  ---
106
85
 
107
- ## 📁 Output Structure
108
-
109
- The following directory is automatically created:
110
-
111
- ```
112
- activity_tracker/
113
- ├── report.yml # Main YAML report
114
- ├── report.json # (Optional) JSON export
115
- ├── report.csv # (Optional) CSV export
116
- └── log.txt # Activity logs of file changes
117
- ```
86
+ ## 📊 What’s Tracked?
87
+
88
+ | Component | Details |
89
+ |------------|-------------------------------------------------------------------------|
90
+ | Models | Count, files, attributes, associations, methods, validations, enums |
91
+ | Controllers | List of files |
92
+ | Services | List of files |
93
+ | Mailers | List of files |
94
+ | Jobs | List of files |
95
+ | Migrations | Count and recent migration names |
96
+ | Routes | Full route listing via `rails routes` |
97
+ | Schema | Schema hash (`db/schema.rb`) |
98
+ | Git Log | Last 20 commits |
99
+ | Database | Type detected from `config/database.yml` |
118
100
 
119
101
  ---
120
102
 
121
- ## 🧪 Development
103
+ ## 🔁 Auto-Watcher
122
104
 
123
- For contributing or testing locally:
105
+ Auto-track changes in real-time using the `listen` gem:
124
106
 
125
107
  ```bash
126
- git clone https://github.com/atul13055/gem_activity_tracker.git
127
- cd gem_activity_tracker
128
- bundle install
108
+ gem_activity_tracker --watch
129
109
  ```
130
110
 
131
- Run interactive Ruby console:
111
+ You'll see logs like:
132
112
 
133
- ```bash
134
- bin/console
113
+ ```
114
+ [2025-04-10 12:00:00] Modified: app/models/user.rb
115
+ [2025-04-10 12:00:01] Added: app/services/new_service.rb
135
116
  ```
136
117
 
137
- Build the gem locally:
118
+ Each change triggers regeneration of the report.
138
119
 
139
- ```bash
140
- bundle exec rake install
120
+ ---
121
+
122
+ ## 🧪 Example Output (YAML)
123
+
124
+ ```yaml
125
+ ruby_version: ruby 3.2.2
126
+ rails_version: 6.1.4
127
+ database: postgresql
128
+ models:
129
+ count: 5
130
+ files:
131
+ - app/models/user.rb
132
+ - app/models/post.rb
133
+ detailed:
134
+ User:
135
+ table_name: users
136
+ attributes: [id, name, email]
137
+ associations:
138
+ has_many: [posts]
139
+ validations: ["PresenceValidator"]
140
+ callbacks: [before_create, after_save]
141
+ controllers:
142
+ count: 3
143
+ files: [...]
144
+ git_log:
145
+ - "1a2b3c4 - Atul Yadav (2025-04-10): Add model tracker"
146
+ - ...
141
147
  ```
142
148
 
143
149
  ---
144
150
 
145
- ## 🚀 Releasing New Version
151
+ ## 💡 Configuration
146
152
 
147
- 1. Update version in `lib/gem_activity_tracker/version.rb`
148
- 2. Build and release:
153
+ You can toggle auto-tracking with an ENV variable:
149
154
 
150
155
  ```bash
151
- bundle exec rake release
156
+ export GEM_ACTIVITY_TRACKER_ENABLED=false # disables auto-tracking
152
157
  ```
153
158
 
154
- This will:
155
-
156
- - Create a `.gem` file
157
- - Push to RubyGems
158
- - Tag and push to GitHub
159
-
160
159
  ---
161
160
 
162
- ## 🤝 Contributing
161
+ ## 🧑 Author
163
162
 
164
- 1. Fork this repo
165
- 2. Create a new branch: `git checkout -b my-feature`
166
- 3. Make your changes
167
- 4. Commit: `git commit -m "Add my feature"`
168
- 5. Push: `git push origin my-feature`
169
- 6. Open a Pull Request
163
+ **Atul Yadav**
164
+ 📧 atuIyadav9039@gmail.com
165
+ 📍 Indore, India
166
+ 🔗 [LinkedIn](https://www.linkedin.com/in/atul-yadav-9445ab1a4)
167
+ 📦 RubyGems: [gem_activity_tracker](https://rubygems.org/gems/gem_activity_tracker)
170
168
 
171
169
  ---
172
170
 
173
171
  ## 📄 License
174
172
 
175
- This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
176
-
177
- ---
178
-
179
- ## 🌍 Links
180
-
181
- - 📦 [RubyGems Page](https://rubygems.org/gems/gem_activity_tracker)
182
- - 🧠 [GitHub Repo](https://github.com/atul13055/gem_activity_tracker)
173
+ This project is licensed under the MIT License. See `LICENSE.txt` for details.
183
174
 
184
175
  ---
185
176
 
186
- ## 🙌 Author
177
+ ## 💬 Contributing
187
178
 
188
- Built with ❤️ by **Atul Yadav**
189
- 📧 [atuIyadav9039@gmail.com](mailto:atuIyadav9039@gmail.com)
190
- 🌐 [LinkedIn](https://www.linkedin.com/in/atul-yadav-9445ab1a4)
179
+ Pull requests are welcome! For major changes, please open an issue first to discuss what you'd like to change.
@@ -8,21 +8,10 @@ options = {}
8
8
  OptionParser.new do |opts|
9
9
  opts.banner = "Usage: gem_activity_tracker [options]"
10
10
 
11
- opts.on("-tPATH", "--track=PATH", "Track a Rails/Ruby project") do |path|
12
- options[:track] = path
13
- end
14
-
15
- opts.on("-r", "--report", "Show last generated report") do
16
- options[:report] = true
17
- end
18
-
19
- opts.on("-eFORMAT", "--export=FORMAT", "Export as json or csv") do |format|
20
- options[:export] = format.to_sym
21
- end
22
-
23
- opts.on("-w", "--watch", "Start the file watcher") do
24
- options[:watch] = true
25
- end
11
+ opts.on("-tPATH", "--track=PATH", "Track a Rails/Ruby project") { |v| options[:track] = v }
12
+ opts.on("-r", "--report", "Show last generated report") { options[:report] = true }
13
+ opts.on("-eFORMAT", "--export=FORMAT", "Export as json or csv") { |v| options[:export] = v.to_sym }
14
+ opts.on("-w", "--watch", "Start the file watcher") { options[:watch] = true }
26
15
  end.parse!
27
16
 
28
17
  if options[:track]
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ require_relative "lib/gem_activity_tracker/version"
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "gem_activity_tracker"
6
+ spec.version = GemActivityTracker::VERSION
7
+ spec.authors = ["Atul Yadav"]
8
+ spec.email = ["atulyadav9039@gmail.com"]
9
+
10
+ spec.summary = "Track gem and project activity in Ruby/Rails projects"
11
+ spec.description = "A CLI gem to analyze Ruby/Rails projects and track activity: models, migrations, routes, Git, schema, and more."
12
+ spec.homepage = "https://github.com/atul13055/gem_activity_tracker"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = Dir["lib/**/*.rb", "exe/*", "README.md", "LICENSE.txt", "*.gemspec"]
16
+ spec.bindir = "exe"
17
+ spec.executables = ["gem_activity_tracker"]
18
+ spec.require_paths = ["lib"]
19
+ spec.required_ruby_version = ">= 3.1.0"
20
+
21
+ spec.add_dependency "listen", "~> 3.0"
22
+ end
@@ -3,27 +3,38 @@ require 'rails/railtie'
3
3
  module GemActivityTracker
4
4
  class Railtie < Rails::Railtie
5
5
  initializer "gem_activity_tracker.auto_track" do
6
- ActiveSupport.on_load(:after_initialize) do
6
+ Rails.application.config.after_initialize do
7
+ # Delay the execution slightly to avoid blocking boot
7
8
  Thread.new do
9
+ sleep(2) # Give Rails a moment to fully start
10
+
8
11
  begin
9
12
  path = Rails.root.to_s
10
13
  report_path = File.join(path, "activity_tracker", "report.yml")
14
+ tracking_enabled = ENV.fetch('GEM_ACTIVITY_TRACKER_ENABLED', 'true') == 'true'
15
+
16
+ if tracking_enabled
17
+ Rails.logger.info "[GemActivityTracker] 🔍 Checking for project changes..."
18
+
19
+ last_data = File.exist?(report_path) ? YAML.load_file(report_path) : {}
20
+
21
+ current_data = GemActivityTracker::Tracker.collect_data(path)
11
22
 
12
- last_data = File.exist?(report_path) ? YAML.load_file(report_path) : {}
13
- current_data = GemActivityTracker::Tracker.collect_data(path)
23
+ if last_data != current_data
24
+ Rails.logger.info "[GemActivityTracker] 🔄 Project activity changed. Updating report..."
25
+ GemActivityTracker::Tracker.track(path)
26
+ else
27
+ Rails.logger.info "[GemActivityTracker] ✅ No project changes detected."
28
+ end
14
29
 
15
- if last_data != current_data
16
- puts "🔄 Project activity changed. Updating report..."
17
- GemActivityTracker::Tracker.track(path)
30
+ Rails.logger.info "[GemActivityTracker] 👀 Starting auto-watcher for #{path}..."
31
+ GemActivityTracker::Watcher.start(path)
18
32
  else
19
- puts " No project changes detected."
33
+ Rails.logger.info "[GemActivityTracker] ⚙️ Auto-tracking disabled via ENV."
20
34
  end
21
-
22
- # ✅ Start auto watching
23
- puts "👀 Starting auto-watcher for #{path} from Railtie..."
24
- GemActivityTracker::Watcher.start(path)
25
35
  rescue => e
26
- puts "⚠️ GemActivityTracker error: #{e.message}"
36
+ Rails.logger.error "[GemActivityTracker] ⚠️ Error: #{e.message}"
37
+ Rails.logger.error e.backtrace.join("\n")
27
38
  end
28
39
  end
29
40
  end
@@ -1,28 +1,39 @@
1
1
  require 'yaml'
2
2
  require 'json'
3
3
  require 'fileutils'
4
- require 'psych'
5
4
  require 'csv'
6
5
  require 'digest'
6
+ require 'active_support/all'
7
+ require 'active_record'
8
+ require 'active_support/dependencies'
7
9
 
8
10
  module GemActivityTracker
9
11
  class Tracker
10
12
  def self.track(path)
11
13
  puts "🔍 Tracking project at: #{path}"
12
- data = collect_data(path)
13
14
 
15
+ if !defined?(Rails) || Rails.root.to_s != path
16
+ # Only require environment if we're not already inside a Rails app
17
+ $LOAD_PATH.unshift(path)
18
+ ENV['RAILS_ENV'] ||= 'development'
19
+ require File.join(path, 'config', 'environment')
20
+ end
21
+
22
+ data = collect_data(path)
14
23
  FileUtils.mkdir_p("#{path}/activity_tracker")
15
24
  File.write("#{path}/activity_tracker/report.yml", data.to_yaml)
16
25
 
17
26
  puts "✅ Report generated at: #{path}/activity_tracker/report.yml"
18
27
  end
19
-
28
+
20
29
  def self.collect_data(path)
21
30
  {
31
+ project_name: File.basename(path),
22
32
  ruby_version: `ruby -v`.strip,
23
- rails_version: get_rails_version(path),
33
+ # rails_version: get_rails_version(path),
34
+ rails_version: Rails.version,
24
35
  database: detect_database(path),
25
- models: list_and_count_files(path, "app/models"),
36
+ models: analyze_models(path),
26
37
  controllers: list_and_count_files(path, "app/controllers"),
27
38
  jobs: list_and_count_files(path, "app/jobs"),
28
39
  mailers: list_and_count_files(path, "app/mailers"),
@@ -36,27 +47,18 @@ module GemActivityTracker
36
47
 
37
48
  def self.report
38
49
  file = "activity_tracker/report.yml"
39
- if File.exist?(file)
40
- puts YAML.load_file(file).to_yaml
41
- else
42
- puts "❌ No report found. Please run tracking first."
43
- end
50
+ puts File.exist?(file) ? YAML.load_file(file).to_yaml : "❌ No report found."
44
51
  end
45
52
 
46
53
  def self.list_and_count_files(base, dir)
47
54
  path = File.join(base, dir)
48
55
  files = Dir.glob("#{path}/**/*.rb").map { |f| f.gsub(base + '/', '') }
49
- {
50
- count: files.count,
51
- files: files
52
- }
56
+ { count: files.count, files: files }
53
57
  end
54
58
 
55
59
  def self.get_rails_version(path)
56
60
  gemfile = File.join(path, 'Gemfile.lock')
57
- return 'Not a Rails project' unless File.exist?(gemfile)
58
-
59
- File.read(gemfile)[/rails \((.*?)\)/, 1]
61
+ File.exist?(gemfile) ? File.read(gemfile)[/rails \((.*?)\)/, 1] : 'Not a Rails project'
60
62
  end
61
63
 
62
64
  def self.detect_database(path)
@@ -83,8 +85,7 @@ module GemActivityTracker
83
85
 
84
86
  def self.schema_hash(path)
85
87
  file = File.join(path, "db/schema.rb")
86
- return nil unless File.exist?(file)
87
- Digest::MD5.hexdigest(File.read(file))
88
+ File.exist?(file) ? Digest::MD5.hexdigest(File.read(file)) : nil
88
89
  end
89
90
 
90
91
  def self.get_git_log(path)
@@ -94,6 +95,84 @@ module GemActivityTracker
94
95
  end
95
96
  end
96
97
 
98
+ def self.analyze_models(path)
99
+ result = { count: 0, files: [], detailed: {} }
100
+
101
+ ActiveSupport::Dependencies.autoload_paths += Dir["#{path}/app/models/**/"]
102
+
103
+ Dir.glob("#{path}/app/models/**/*.rb").each do |file|
104
+ relative_path = file.gsub("#{path}/", '')
105
+ model_name = relative_path.sub('app/models/', '').sub('.rb', '').camelize
106
+
107
+ begin
108
+ require_dependency file
109
+ model_class = model_name.constantize
110
+ next unless model_class < ActiveRecord::Base
111
+
112
+ result[:count] += 1
113
+ result[:files] << relative_path
114
+
115
+ # Validations
116
+ validations = Hash.new { |hash, key| hash[key] = [] }
117
+ model_class.validators.each do |validator|
118
+ validator.attributes.each do |attr|
119
+ validations[attr] << validator.class.name.demodulize.underscore
120
+ end
121
+ end
122
+
123
+ # Callbacks
124
+ callbacks = {}
125
+ ActiveRecord::Callbacks::CALLBACKS.each do |cb|
126
+ if model_class.respond_to?("_#{cb}_callbacks")
127
+ methods = model_class.send("_#{cb}_callbacks").map(&:filter).uniq
128
+ callbacks[cb] = methods.map(&:to_s) if methods.any?
129
+ end
130
+ end
131
+
132
+ # Enums
133
+ # debugger
134
+ enums = model_class.defined_enums.transform_values { |v| v.keys }
135
+
136
+ # Associations
137
+ associations = model_class.reflect_on_all_associations.group_by(&:macro).transform_values { |a| a.map(&:name) }
138
+
139
+ # Scopes
140
+ scopes = model_class.methods(false).select do |method|
141
+ model_class.method(method).source_location&.first&.include?('/models/')
142
+ end.select { |m| model_class.respond_to?(m) && model_class.send(m).is_a?(ActiveRecord::Relation) rescue false }
143
+
144
+ # Class methods
145
+ class_methods = (model_class.methods(false) - ActiveRecord::Base.methods)
146
+ instance_methods = (model_class.instance_methods(false) - ActiveRecord::Base.instance_methods).map(&:to_s)
147
+
148
+ # # Comments
149
+ # comment = File.foreach(file).first if File.read(file).lines.first.strip.start_with?('#')
150
+
151
+ result[:detailed][model_class.name] = {
152
+ table_name: model_class.table_name,
153
+ file: relative_path,
154
+ # comment: comment&.strip,
155
+ attributes: model_class.columns.map(&:name),
156
+ associations: associations,
157
+ validations: validations,
158
+ enums: enums,
159
+ callbacks: callbacks,
160
+ scopes: scopes.map(&:to_s),
161
+ class_methods: class_methods.map(&:to_s),
162
+ instance_methods: instance_methods,
163
+ methods_count: model_class.instance_methods(false).count
164
+ }
165
+
166
+ rescue => e
167
+ result[:detailed][model_name] = { error: "Failed to load: #{e.message}" }
168
+ end
169
+ end
170
+
171
+ result
172
+ end
173
+
174
+
175
+
97
176
  def self.export(path, format = :json)
98
177
  file = "#{path}/activity_tracker/report.yml"
99
178
  return puts "❌ Report not found." unless File.exist?(file)
@@ -110,7 +189,7 @@ module GemActivityTracker
110
189
  data.each do |key, value|
111
190
  if value.is_a?(Hash)
112
191
  csv << [key.to_s, ""]
113
- value.each { |k, v| csv << [" #{k}", v] }
192
+ value.each { |k, v| csv << [" #{k}", v.to_json] }
114
193
  elsif value.is_a?(Array)
115
194
  csv << [key.to_s, "#{value.count} items"]
116
195
  value.each { |item| csv << ["", item] }
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module GemActivityTracker
4
- VERSION = "0.1.1"
2
+ VERSION = "1.0.0"
5
3
  end
@@ -12,10 +12,7 @@ module GemActivityTracker
12
12
  FileUtils.mkdir_p(File.dirname(log_file))
13
13
 
14
14
  any_change = false
15
-
16
15
  changes.each do |type, files|
17
- next if files.empty?
18
-
19
16
  files.each do |file|
20
17
  timestamp = Time.now.strftime("%Y-%m-%d %H:%M:%S")
21
18
  relative_path = file.sub("#{path}/", '')
@@ -26,10 +23,7 @@ module GemActivityTracker
26
23
  end
27
24
  end
28
25
 
29
- if any_change
30
- puts "🔄 Updating activity report..."
31
- GemActivityTracker::Tracker.track(path)
32
- end
26
+ GemActivityTracker::Tracker.track(path) if any_change
33
27
  end
34
28
 
35
29
  listener.start
@@ -2,10 +2,9 @@
2
2
 
3
3
  require_relative "gem_activity_tracker/version"
4
4
  require_relative "gem_activity_tracker/tracker"
5
- require_relative "gem_activity_tracker/railtie" if defined?(Rails)
6
5
  require_relative "gem_activity_tracker/watcher"
6
+ require_relative "gem_activity_tracker/railtie" if defined?(Rails)
7
7
 
8
8
  module GemActivityTracker
9
9
  class Error < StandardError; end
10
- # Additional code (if needed) goes here
11
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_activity_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Atul Yadav
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-09 00:00:00.000000000 Z
11
+ date: 2025-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: listen
@@ -24,8 +24,8 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
- description: gem_activity_tracker is a CLI tool to track and analyze gems used in
28
- any Ruby project using its Gemfile.lock
27
+ description: 'A CLI gem to analyze Ruby/Rails projects and track activity: models,
28
+ migrations, routes, Git, schema, and more.'
29
29
  email:
30
30
  - atulyadav9039@gmail.com
31
31
  executables:
@@ -33,25 +33,18 @@ executables:
33
33
  extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
- - ".gem_activity_tracker.gemspec.swp"
37
- - CHANGELOG.md
38
36
  - README.md
39
- - Rakefile
40
37
  - exe/gem_activity_tracker
41
- - gem_activity_tracker-0.1.0.gem
38
+ - gem_activity_tracker.gemspec
42
39
  - lib/gem_activity_tracker.rb
43
40
  - lib/gem_activity_tracker/railtie.rb
44
41
  - lib/gem_activity_tracker/tracker.rb
45
42
  - lib/gem_activity_tracker/version.rb
46
43
  - lib/gem_activity_tracker/watcher.rb
47
- - sig/gem_activity_tracker.rbs
48
- homepage: https://example.com/gem_activity_tracker
49
- licenses: []
50
- metadata:
51
- allowed_push_host: https://rubygems.org
52
- homepage_uri: https://example.com/gem_activity_tracker
53
- source_code_uri: https://example.com/gem_activity_tracker
54
- changelog_uri: https://example.com/gem_activity_tracker/CHANGELOG.md
44
+ homepage: https://github.com/atul13055/gem_activity_tracker
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
55
48
  post_install_message:
56
49
  rdoc_options: []
57
50
  require_paths:
@@ -70,5 +63,5 @@ requirements: []
70
63
  rubygems_version: 3.4.10
71
64
  signing_key:
72
65
  specification_version: 4
73
- summary: Track gem dependencies of any Ruby project
66
+ summary: Track gem and project activity in Ruby/Rails projects
74
67
  test_files: []
Binary file
data/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2025-04-09
4
-
5
- - Initial release
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- task default: %i[]
Binary file
@@ -1,4 +0,0 @@
1
- module GemActivityTracker
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end