walkthrough_awanllm 0.1.18 → 0.1.20

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: 0446edc0b2acf9d1e05995bd32dbc4c41fd84e34cefcc6effb76b650f85027a1
4
- data.tar.gz: 7a8afe1355ff43f1047929b1badfb5fc2caedf439282daefac6d86191c0f863b
3
+ metadata.gz: ec195b8ba320b5775eca40fe298a17296c4d0d606d9d7033d39b264b6623d4f5
4
+ data.tar.gz: b6868fe445362fd7b32aebc703fe6cde3c114347949403c5346bb1a218721ab0
5
5
  SHA512:
6
- metadata.gz: '09567b3cf0edd6e7e902f0e6f7f566c51a6ceaff197b0dfaef72b7a87f3e86b495f12c4f8d9c3817df5ee38b1cd78f55a2f28088940d05056121b7720b7a2223'
7
- data.tar.gz: 23475f22d8c98560308d2080bbd0c8c274597bb8fd9873d1a477b3b83fe20480a8102db1b7dde363a74aa1211e1372c90241754afb5e75ddcb8ae1a527d42e10
6
+ metadata.gz: d77f4ac5afe4d1739275124108ef41e7a0c2ab8b643c7d5a3b05cbd47fb45c879a2a52f877e3cf1abb318528ef45632944e824b2dc5781f456bc1fe2e1dea976
7
+ data.tar.gz: 7e36f89303d7db1a751cf38705362ef8398135d7815eb6a9f81e6f9ade05885218dbf3abaffdd9ee20c16a9695cdd7f593a0800febdf2a090fad153fe3077cc3
data/README.md CHANGED
@@ -30,7 +30,7 @@ $ gem install walkthrough_awanllm
30
30
  After installing the gem, you need to configure it by running the setup script. This will prompt you for your AwanLLM API key and the model name you wish to use.
31
31
 
32
32
  ```sh
33
- $ ruby ./vendor/bundle/ruby/YOUR_VERSION/gems/walkthrough_awanllm-0.1.18/bin/setup_awanllm.rb
33
+ $ ruby ./vendor/bundle/ruby/YOUR_VERSION/gems/walkthrough_awanllm-0.1.20/bin/setup_awanllm.rb
34
34
  ```
35
35
 
36
36
  ## Usage
@@ -45,7 +45,10 @@ rails console
45
45
  > awanllm = WalkthroughAwanllm::AwanLLM.new
46
46
  > awanllm.generate_walkthrough
47
47
  ```
48
-
48
+ Or by running :
49
+ ```ruby
50
+ rails awanllm:generate_walkthrough
51
+ ```
49
52
  This will read the activity log and generate a `walkthrough.md` file in the project's root directory.
50
53
 
51
54
  ## Development
@@ -0,0 +1,8 @@
1
+ # lib/tasks/generate_walkthrough.rake
2
+ namespace :awanllm do
3
+ desc 'Generate walkthrough using AwanLLM'
4
+ task :generate_walkthrough => :environment do
5
+ awanllm = WalkthroughAwanllm::AwanLLM.new
6
+ awanllm.generate_walkthrough
7
+ end
8
+ end
@@ -1,58 +1,65 @@
1
+ # lib/awanllm/railtie.rb
2
+
1
3
  require 'rails/railtie'
2
4
  require 'fileutils'
3
- require 'bundler'
4
- require 'git'
5
- require 'listen'
6
5
 
7
- module WalkthroughAwanllm
6
+ module AwanLLM
8
7
  class Railtie < Rails::Railtie
9
8
  initializer "awanllm.track_activity" do |app|
10
9
  app.config.middleware.use AwanLLM::Tracker
11
- Bundler::Plugin.add_hook('after-install-all') do |specs|
12
- log_gem_event('install', specs)
13
- end
14
- Bundler::Plugin.add_hook('before-uninstall-all') do |specs|
15
- log_gem_event('uninstall', specs)
16
- end
17
- Bundler::Plugin.add_hook('before-update-all') do |specs|
18
- log_gem_event('update', specs)
19
- end
20
- Bundler::Plugin.add_hook('after-exec-all') do |specs|
21
- log_gem_event('execute', specs)
22
- end
23
- Bundler::Plugin.add_hook('after-update-all') do |specs|
24
- log_gem_event('update', specs)
25
- end
26
- Bundler::Plugin.add_hook('after-clean-all') do |specs|
27
- log_gem_event('clean', specs)
28
- end
29
- Bundler::Plugin.add_hook('after-list-all') do |specs|
30
- log_gem_event('list', specs)
31
- end
32
10
 
33
- # Start Git repository monitoring
34
- git = Git.open('.')
35
- listener = Listen.to('.', only: /\.rb$/, ignore: /vendor|log/) do |modified, added, removed|
36
- log_file_changes(modified, added, removed, git)
37
- end
38
- listener.start
11
+ setup_git_hook
39
12
  end
40
13
 
41
14
  private
42
15
 
43
- def log_gem_event(action, specs)
44
- FileUtils.mkdir_p("log")
45
- File.open("log/awanllm_activity.log", "a") do |file|
46
- file.puts("[#{Time.now}] Gem #{action}: #{specs.map(&:name).join(', ')}")
47
- end
16
+ def setup_git_hook
17
+ git_hook_script_path = Rails.root.join('.git', 'hooks', 'post-commit')
18
+ git_hook_script_content = <<-SCRIPT
19
+ #!/bin/bash
20
+ RAILS_ROOT="#{Rails.root}"
21
+ cd $RAILS_ROOT
22
+ bundle exec rails runner "AwanLLM::Tracker.new.update_activity_log"
23
+ SCRIPT
24
+
25
+ # Write the Git hook script
26
+ File.open(git_hook_script_path, "w") { |f| f.write(git_hook_script_content) }
27
+ FileUtils.chmod(0755, git_hook_script_path)
28
+
29
+ # Inform the user about the setup
30
+ puts "Git hook for tracking activity log updates has been set up: #{git_hook_script_path}"
31
+ end
32
+ end
33
+ end
34
+
35
+ # Middleware to track activities
36
+ module AwanLLM
37
+ class Tracker
38
+ def initialize(app = nil)
39
+ @app = app
40
+ end
41
+
42
+ def call(env)
43
+ status, headers, response = @app.call(env)
44
+ [status, headers, response]
48
45
  end
49
46
 
50
- def log_file_changes(modified, added, removed, git)
51
- FileUtils.mkdir_p("log")
52
- File.open("log/awanllm_activity.log", "a") do |file|
53
- modified.each { |file| file.puts("[#{Time.now}] Modified: #{file} (#{git.diff.stats[:changed]} lines changed)") }
54
- added.each { |file| file.puts("[#{Time.now}] Added: #{file}") }
55
- removed.each { |file| file.puts("[#{Time.now}] Removed: #{file}") }
47
+ def update_activity_log
48
+ log_file_path = Rails.root.join('log', 'awanllm_activity.log')
49
+ FileUtils.mkdir_p(File.dirname(log_file_path))
50
+
51
+ # Get the latest commit details
52
+ commit_details = `git log -1 --pretty=format:"%H %an %ad %s" --date=iso`
53
+ file_changes = `git diff-tree --no-commit-id --name-status -r HEAD`
54
+
55
+ File.open(log_file_path, "a") do |file|
56
+ file.puts("### [#{Time.now}] Activity Log")
57
+ file.puts("#### Commit Details: #{commit_details.strip}")
58
+ file.puts("#### File Changes:")
59
+ file_changes.each_line do |line|
60
+ file.puts("- #{line.strip}")
61
+ end
62
+ file.puts("\n")
56
63
  end
57
64
  end
58
65
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WalkthroughAwanllm
4
- VERSION = "0.1.18"
4
+ VERSION = "0.1.20"
5
5
  end
@@ -67,7 +67,7 @@ module WalkthroughAwanllm
67
67
  puts 'Walkthrough_AwanLLM gem is already configured.'
68
68
  else
69
69
  ruby_version = RUBY_VERSION.split('.').first(3).join('.')
70
- path_to_script = "./vendor/bundle/ruby/#{ruby_version}/gems/walkthrough_awanllm-0.1.18/bin/setup_awanllm.rb"
70
+ path_to_script = "./vendor/bundle/ruby/#{ruby_version}/gems/walkthrough_awanllm-0.1.20/bin/setup_awanllm.rb"
71
71
  system("ruby #{path_to_script}")
72
72
  end
73
73
  end
@@ -3,30 +3,32 @@
3
3
  require_relative "lib/walkthrough_awanllm/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "walkthrough_awanllm"
7
- spec.version = WalkthroughAwanllm::VERSION
8
- spec.authors = ["Mrudul John"]
9
- spec.email = ["mrudulmathews@gmail.com"]
6
+ spec.name = "walkthrough_awanllm"
7
+ spec.version = WalkthroughAwanllm::VERSION
8
+ spec.authors = ["Mrudul John"]
9
+ spec.email = ["mrudulmathews@gmail.com"]
10
10
 
11
- spec.summary = "A Ruby gem to Generate Project Development Walkthrough with the AwanLLM API."
12
- spec.description = "{UNDER DEVELOPMENT NOT FOR USE YET}A Ruby gem to generate a walkthrough the project lifecycle with the AwanLLM API for generating and retrieving content."
13
- spec.homepage = "https://github.com/mruduljohn/Walkthrough_awanllm_gem"
14
- spec.license = "MIT"
11
+ spec.summary = "A Ruby gem to Generate Project Development Walkthrough with the AwanLLM API."
12
+ spec.description = "{UNDER DEVELOPMENT NOT FOR USE YET}A Ruby gem to generate a walkthrough the project lifecycle with the AwanLLM API for generating and retrieving content."
13
+ spec.homepage = "https://github.com/mruduljohn/Walkthrough_awanllm_gem"
14
+ spec.license = "MIT"
15
15
  spec.required_ruby_version = ">= 3.0.0"
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
22
- ls.readlines("\x0", chomp: true).reject do |f|
23
- f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
21
+ spec.files = Dir.chdir(__dir__) do
22
+ `git ls-files -z`.split("\x0").reject do |f|
23
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile]) ||
24
+ f.match(/walkthrough_awanllm-\d+\.\d+\.\d+\.gem/)
24
25
  end
25
26
  end + [
26
27
  "lib/walkthrough_awanllm.rb",
27
28
  "lib/walkthrough_awanllm/railtie.rb",
28
29
  "lib/walkthrough_awanllm/version.rb",
29
30
  "bin/setup_awanllm.rb", # Include setup_awanllm.rb file
31
+ "lib/tasks/generate_walkthrough.rake", # Include generate_walkthrough.rake file
30
32
  ]
31
33
 
32
34
  spec.bindir = "bin"
@@ -40,6 +42,6 @@ Gem::Specification.new do |spec|
40
42
  spec.post_install_message = <<-MESSAGE
41
43
  Thank you for installing the Walkthrough_AwanLLM gem!
42
44
  To complete the setup, please run the following command:
43
- ruby ./vendor/bundle/ruby/#{RUBY_VERSION.split('.').first(3).join('.')}/gems/walkthrough_awanllm-0.1.18/bin/setup_awanllm.rb
45
+ ruby ./vendor/bundle/ruby/#{RUBY_VERSION.split('.').first(3).join('.')}/gems/walkthrough_awanllm-#{spec.version}/bin/setup_awanllm.rb
44
46
  MESSAGE
45
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: walkthrough_awanllm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mrudul John
@@ -95,16 +95,12 @@ files:
95
95
  - README.md
96
96
  - Rakefile
97
97
  - bin/setup_awanllm.rb
98
+ - lib/tasks/generate_walkthrough.rake
98
99
  - lib/walkthrough_awanllm.rb
99
100
  - lib/walkthrough_awanllm/cli.rb
100
101
  - lib/walkthrough_awanllm/railtie.rb
101
102
  - lib/walkthrough_awanllm/version.rb
102
103
  - sig/walkthrough_awanllm.rbs
103
- - walkthrough_awanllm-0.1.11.gem
104
- - walkthrough_awanllm-0.1.13.gem
105
- - walkthrough_awanllm-0.1.14.gem
106
- - walkthrough_awanllm-0.1.15.gem
107
- - walkthrough_awanllm-0.1.16.gem
108
104
  - walkthrough_awanllm.gemspec
109
105
  homepage: https://github.com/mruduljohn/Walkthrough_awanllm_gem
110
106
  licenses:
@@ -114,7 +110,7 @@ metadata:
114
110
  post_install_message: |2
115
111
  Thank you for installing the Walkthrough_AwanLLM gem!
116
112
  To complete the setup, please run the following command:
117
- ruby ./vendor/bundle/ruby/3.3.0/gems/walkthrough_awanllm-0.1.18/bin/setup_awanllm.rb
113
+ ruby ./vendor/bundle/ruby/3.3.0/gems/walkthrough_awanllm-0.1.20/bin/setup_awanllm.rb
118
114
  rdoc_options: []
119
115
  require_paths:
120
116
  - lib
Binary file
Binary file
Binary file
Binary file
Binary file