docwright 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: '089438eeadde6877f7ec2590b98c79d6698631099d3443223d77ca8f4cdbe581'
4
- data.tar.gz: 2508d5a8a398a7c3df4650c2c32e9b09be1876a2bd23729b924c4914e6a34214
3
+ metadata.gz: c2c2b7fdb076fbaa9947c9845dd1c8caa70a5c6c94a0b88ac0552c70482dd9ba
4
+ data.tar.gz: 970f6bfdf94be116319634eb88fb32dcc3bbb550c3b7842eb4c648cd5e9a3ebc
5
5
  SHA512:
6
- metadata.gz: 5a4b6893d2308dc9cb0ba1d487413a5f9df48653f8dcf32aca1039e921701bee53fddbf16d0f78d2b48e67335fbeb52f07548d119e87189dac333c3acc032b81
7
- data.tar.gz: e316d0cfd343876518a2315d619177cbd9d05db76b121d756bb2099385f5879cb5594a1072695bf2f919c34722fc8b4b3ae73fc428acba1b5247a1d11fda1f0e
6
+ metadata.gz: 0c4c92513a2e33907e80158c9f14caac77ee38d485c1db48e6bcc03d69f39a2c377dcfc4df4459e6544fdca6410783250352c9bfc9895f0a6a3946c55bbdc460
7
+ data.tar.gz: 42bd0a87016cdc592cb2770156f843988f6d5a412d1dd1a7d300dd3a728ead363016cbd777a88fb68b0259f2f5901d2618a68987113ff63fc7553fa8ea7bf07d
data/CHANGELOG.md CHANGED
@@ -5,7 +5,7 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
- ## [0.1.0] - Unreleased
8
+ ## [0.1.0] - 2026-07-22
9
9
 
10
10
  ### Added
11
11
 
@@ -23,3 +23,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
23
23
  - Smart merge markers — human-written content preserved across regenerations
24
24
  - `docwright:check` — audit task for missing files, placeholder content, empty notes
25
25
  - `docwright:search` — search across all documentation files
26
+
27
+ ## [0.1.1] - 2026-07-24
28
+
29
+ ### Fixed
30
+
31
+ - `eager_load!` rescue in model, auth, concerns, and background_jobs extractors to handle missing railties gracefully
32
+ - `merger.rb` notes_placeholder now passed through to `merge_named` — fixes inconsistent notes headers
33
+ - `write_template` in wizard now correctly handles feature files using `FeatureGenerator`
34
+ - `FeatureGenerator` — added `generate_single` method for wizard template writing
35
+ - `README.md` — added link to examples/ folder
data/README.md CHANGED
@@ -138,10 +138,14 @@ bundle install
138
138
  bundle exec rspec
139
139
  ```
140
140
 
141
+ ## Examples
142
+
143
+ See the [examples/](examples/) folder for sample generated output.
144
+
141
145
  ## Contributing
142
146
 
143
147
  Bug reports and pull requests are welcome on
144
- [GitHub](https://github.com/GraceHtet/docwright).
148
+ [GitHub](https://github.com/GraceHtet/docwright/issues).
145
149
 
146
150
  ## License
147
151
 
@@ -5,7 +5,11 @@ module Docwright
5
5
  class AuthExtractor # rubocop:disable Style/Documentation
6
6
  CALLBACK_KINDS = %i[before around after].freeze
7
7
  def generate
8
- Rails.application.eager_load!
8
+ begin
9
+ Rails.application.eager_load!
10
+ rescue NameError => e
11
+ puts "DocWright: warning — could not eager load all files: #{e.message}"
12
+ end
9
13
 
10
14
  controllers = find_controllers
11
15
  filter_map = build_filter_map(controllers)
@@ -6,7 +6,17 @@ module Docwright
6
6
  INTERNAL_JOBS = %w[ApplicationJob].freeze
7
7
 
8
8
  def generate
9
- Rails.application.eager_load!
9
+ unless defined?(ActiveJob)
10
+ puts "DocWright: skipped background_jobs.md — ActiveJob is not loaded."
11
+ puts " To enable: uncomment 'require \"active_job/railtie\"' in config/application.rb"
12
+ return
13
+ end
14
+
15
+ begin
16
+ Rails.application.eager_load!
17
+ rescue NameError => e
18
+ puts "DocWright: warning — could not eager load all files: #{e.message}"
19
+ end
10
20
 
11
21
  jobs = find_jobs
12
22
  if jobs.empty?
@@ -4,7 +4,16 @@ module Docwright
4
4
  module Extractors
5
5
  class ConcernsExtractor
6
6
  def generate
7
- Rails.application.eager_load!
7
+ unless defined?(ActiveRecord) && defined?(ActionController)
8
+ puts "DocWright: skipped concerns.md — ActiveRecord or ActionController is not loaded."
9
+ return
10
+ end
11
+
12
+ begin
13
+ Rails.application.eager_load!
14
+ rescue NameError => e
15
+ puts "DocWright: warning — could not eager load all files: #{e.message}"
16
+ end
8
17
 
9
18
  concerns = find_model_concerns + find_controller_concerns
10
19
 
@@ -4,6 +4,17 @@ module Docwright
4
4
  module Extractors
5
5
  class ModelExtractor
6
6
  def generate
7
+ unless defined?(ActiveRecord)
8
+ puts "DocWright: skipped models.md — ActiveRecord is not loaded."
9
+ return
10
+ end
11
+
12
+ begin
13
+ Rails.application.eager_load!
14
+ rescue NameError => e
15
+ puts "DocWright: warning — could not eager load all files: #{e.message}"
16
+ end
17
+
7
18
  models = find_models
8
19
  FileUtils.mkdir_p("docs")
9
20
 
@@ -42,7 +53,6 @@ module Docwright
42
53
  private
43
54
 
44
55
  def find_models
45
- Rails.application.eager_load!
46
56
  ActiveRecord::Base.descendants.reject { |m| m.abstract_class? }.sort_by(&:name)
47
57
  end
48
58
  end
@@ -30,6 +30,16 @@ module Docwright
30
30
  end
31
31
  end
32
32
 
33
+ def generate_single(path, filename)
34
+ return if File.exist?(path)
35
+
36
+ name = filename.gsub(".md", "")
37
+
38
+ description = "<!-- Describe the feature -->"
39
+ FileUtils.mkdir_p(File.dirname(path))
40
+ File.write(path, template(name, description))
41
+ end
42
+
33
43
  private
34
44
 
35
45
  def template(name, description)
@@ -15,7 +15,7 @@ module Docwright
15
15
 
16
16
  def self.write_named(path, name, auto_content, notes_placeholder)
17
17
  if File.exist?(path)
18
- merge_named(path, name, auto_content)
18
+ merge_named(path, name, auto_content, notes_placeholder)
19
19
  else
20
20
  fresh_named(path, name, auto_content, notes_placeholder)
21
21
  end
@@ -42,7 +42,7 @@ module Docwright
42
42
  File.write(path, updated)
43
43
  end
44
44
 
45
- def self.merge_named(path, name, auto_content)
45
+ def self.merge_named(path, name, auto_content, notes_placeholder)
46
46
  existing = File.read(path)
47
47
  start_marker = "<!-- DOCWRIGHT:AUTO:#{name} -->"
48
48
  end_marker = "<!-- DOCWRIGHT:END:#{name} -->"
@@ -51,7 +51,7 @@ module Docwright
51
51
  updated = if existing.include?(start_marker)
52
52
  existing.gsub(/#{Regexp.escape(start_marker)}.*?#{Regexp.escape(end_marker)}/m, replacement)
53
53
  else
54
- existing + "\n#{replacement}\n### Notes for #{name}\n<!-- Add your notes about #{name} here -->\n"
54
+ existing + "\n#{replacement}\n#{notes_placeholder}\n"
55
55
  end
56
56
  File.write(path, updated)
57
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Docwright
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -159,6 +159,9 @@ module Docwright
159
159
  Docwright::Extractors::BackgroundJobsExtractor.new.generate if optional["background_jobs"]
160
160
  Docwright::Extractors::ServicesExtractor.new.generate if optional["services"]
161
161
  Docwright::Extractors::ConcernsExtractor.new.generate if optional["concerns"]
162
+ rescue NameError => e
163
+ puts "DocWright: skipped some optional docs — #{e.message}"
164
+ puts " Check your config/application.rb and ensure required railties are loaded."
162
165
  end
163
166
 
164
167
  def process_manual_files(files)
@@ -237,7 +240,11 @@ module Docwright
237
240
 
238
241
  def write_template(path, filename)
239
242
  FileUtils.mkdir_p(File.dirname(path))
240
- Docwright::Generators::ManualGenerator.new.generate_single(path, filename)
243
+ if path.include?("features/")
244
+ Docwright::Generators::FeatureGenerator.new.generate_single(path, filename)
245
+ else
246
+ Docwright::Generators::ManualGenerator.new.generate_single(path, filename)
247
+ end
241
248
  end
242
249
  end
243
250
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docwright
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
  - Grace