rails_rules 0.2.0 → 0.3.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: a9be68c0ccba503fc0e42a71a14673463a20af8ffd94a914fb6102b5eb13262e
4
- data.tar.gz: ea19c7d51efcca0cdeae7cb271eba93eb9a2be96c3d990d2202ba63855f1160c
3
+ metadata.gz: 189eaae24c2cb3bed4870749614cc557904504c7b37ca5665b0a729dc7d07dff
4
+ data.tar.gz: 74327970f054d075465fba4abb5321ff0d1cceecb5cfa6464c63f80e7ddb7c1f
5
5
  SHA512:
6
- metadata.gz: 526d14c32a134a30ba92f58277549b3f624892a96928b4b1e9249fcfef7b703e3d05b752c62d1b123e5e578a4b25fbfb194c3c08b0de124902abc27ce48597ac
7
- data.tar.gz: 230209de40658d6ec600028ed9b3ef14382b2439edd0ff86df0f9f140bd1980e0785b6c85738de7ee8dcae5048a9c27f88180b793e3e316576e93eb7fd285974
6
+ metadata.gz: 5ad6b06b9cc3f508f05fc09f567b32214bc1ace6e4d22531c3144c2b9f1e6b00522bdbca2d4e00ee387f730bda8044404ba31db29f887e53283090f4e8ad9566
7
+ data.tar.gz: 24228d4b9191e6238cdd04529c3c222b0d6561649906646e0fa6734005aecb248bb5405140d35de4c9cf7eef3fc68b286031b46dd981fcd7a7fb6b7ea78915e2
data/README.md CHANGED
@@ -1,23 +1,26 @@
1
1
  # RailsRules
2
2
 
3
- This gem provides a set of [rules](https://docs.cursor.com/context/rules) files for working with AI tooling.
3
+ This gem provides a set of [rules](https://docs.cursor.com/context/rules) files for use when building Rails apps with AI editor tools.
4
4
 
5
- At this early stage, the functionality is limited to creating `.cursor/rules` files for [Cursor](https://www.cursor.com).
5
+ The rules are intended to be a starting point, corresponding to the Rails defaults for a new application. You should modify the rules as necessary for your application.
6
+
7
+ Editors have different naming conventions and structure for rules files. Some support multiple files, but others require everything to be in a single file.
8
+
9
+ Two editors are currently supported: Cursor and Zed
6
10
 
7
11
  The rules files were originally created by [Kieran Klaassen](https://github.com/kieranklaassen) and contributed to [Jumpstart Pro Rails](jumpstartrails.com), and are reproduced with permission.
8
12
 
9
13
  ## Installation
10
14
 
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- ```bash
14
- bundle add rails_rules
15
- ```
15
+ Add the gem to the `development` group in your Gemfile.
16
16
 
17
17
  ## Usage
18
18
 
19
+ Run the generator corresponding to your editor:
20
+
19
21
  ```bash
20
- bin/rails generate rails_rules:default
22
+ bin/rails generate rails_rules:cursor # generates a collection of rules in .cursor/rules
23
+ bin/rails generate rails_rules:zed # generates a single .rules file
21
24
  ```
22
25
 
23
26
  ## Development
@@ -1,5 +1,5 @@
1
1
  module RailsRules
2
- class DefaultGenerator < Rails::Generators::Base
2
+ class CursorGenerator < Rails::Generators::Base
3
3
  TARGET_PATH = ".cursor/rules"
4
4
  source_root File.expand_path("templates", __dir__)
5
5
  def create_rules_cursor_directory
@@ -7,7 +7,7 @@ module RailsRules
7
7
  end
8
8
 
9
9
  def copy_files
10
- directory_path = "lib/generators/default/templates"
10
+ directory_path = "lib/generators/cursor/templates"
11
11
  files = [
12
12
  "000-cursor-rules.mdc",
13
13
  "1000-rails-general.mdc",
@@ -0,0 +1,31 @@
1
+ require "front_matter_parser"
2
+
3
+ module RailsRules
4
+ class ZedGenerator < Rails::Generators::Base
5
+ TARGET_PATH = ".rules"
6
+ source_root File.expand_path("templates", __dir__)
7
+
8
+ def copy_files
9
+ result = ""
10
+ directory_path = "lib/generators/default/templates"
11
+ # NOTE: We skip "000-cursor-rules.mdc" for Zed
12
+ files = [
13
+ "1000-rails-general.mdc",
14
+ "1001-rails-controllers.mdc",
15
+ "1002-rails-models.mdc",
16
+ "1003-rails-views.mdc",
17
+ "1004-javascript-stimulus.mdc",
18
+ "1005-service-objects.mdc",
19
+ "1006-testing.mdc",
20
+ "1007-tailwindcss.mdc"
21
+ ]
22
+ files.each do |file|
23
+ templates_path = File.expand_path("templates", __dir__)
24
+ string = File.read(File.join(templates_path, file))
25
+ parser = FrontMatterParser::Parser.new(:md).call(string)
26
+ result += parser.content
27
+ end
28
+ create_file TARGET_PATH, result
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsRules
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Waite
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '7'
26
+ - !ruby/object:Gem::Dependency
27
+ name: front_matter_parser
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
26
40
  email:
27
41
  - andyw8@users.noreply.github.com
28
42
  executables: []
@@ -32,8 +46,8 @@ files:
32
46
  - MIT-LICENSE
33
47
  - README.md
34
48
  - Rakefile
35
- - lib/generators/default/USAGE
36
- - lib/generators/rails_rules/default_generator.rb
49
+ - lib/generators/cursor/USAGE
50
+ - lib/generators/rails_rules/cursor_generator.rb
37
51
  - lib/generators/rails_rules/templates/000-cursor-rules.mdc
38
52
  - lib/generators/rails_rules/templates/1000-rails-general.mdc
39
53
  - lib/generators/rails_rules/templates/1001-rails-controllers.mdc
@@ -43,6 +57,7 @@ files:
43
57
  - lib/generators/rails_rules/templates/1005-service-objects.mdc
44
58
  - lib/generators/rails_rules/templates/1006-testing.mdc
45
59
  - lib/generators/rails_rules/templates/1007-tailwindcss.mdc
60
+ - lib/generators/rails_rules/zed_generator.rb
46
61
  - lib/rails_rules.rb
47
62
  - lib/rails_rules/railtie.rb
48
63
  - lib/rails_rules/version.rb
@@ -68,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
83
  - !ruby/object:Gem::Version
69
84
  version: '0'
70
85
  requirements: []
71
- rubygems_version: 3.6.2
86
+ rubygems_version: 3.6.7
72
87
  specification_version: 4
73
88
  summary: Create and manage rules files for AI tooling
74
89
  test_files: []
File without changes