dirfy 0.3.0 → 0.3.2

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: e8e6bf9d28ac3108a8de6bc541c8c0e2b63fdd101bcf973bcbad6369d87b6dc5
4
- data.tar.gz: 0e925d19a257eeb53d9ab97f826056cd0c063bd7ec44ef44242aea30dec3b24f
3
+ metadata.gz: eff3a8ed004db0f78ce8f4e0660648cf18f4983bb064a1e41e0d74fd3db8fdcb
4
+ data.tar.gz: a378b3fdfbdd8c34170920a769307938fe4495bc9222996140e39d5a68fddc6b
5
5
  SHA512:
6
- metadata.gz: 7d51b837da07c76434ff5d81ecc91e497cbd1360bcc3de28eff299c95489d43d8a6d1fd95331f4b7d892ddb5e3ba861b2c553373d38c08a9ee174fccdbb4bff7
7
- data.tar.gz: e6d08d7060cd432e3dd73b3b1c1a6a649406820c66b2149f50ac97d5c7bfe9e524e4e9f9aa256b95f7ff5ed034d9f9a1ac683510f4b3adc41bd3de3d57233200
6
+ metadata.gz: 24b201dbd606f722eab03643b190b5edc1cbf97960f5ee1dd1b476a4502a0a11934f381a7d0f80857ec1ece4e5f7d247bb4c7f0d2ad50d96bbe56190fe0b04f3
7
+ data.tar.gz: d34793f417f3310bbe515f1b0c3fe03c137f2c6263ea6cc017dec09fb1949e8c624699ad9d7658561b3c49c656b398d2ee47d274a685f058bb4e8b087c79540b
data/README.md CHANGED
@@ -6,7 +6,18 @@
6
6
  [![Ruby ≥2.7](https://img.shields.io/badge/ruby-%3E%3D2.7-blue.svg)](https://www.ruby-lang.org/)
7
7
  [![Issues](https://img.shields.io/github/issues/ahmedmelhady7/dirfy.svg)](https://github.com/ahmedmelhady7/dirfy/issues)
8
8
 
9
- > **Instantly scaffold directory & file structures from any ASCII/Unicode tree diagram** 🚀
9
+ > **Instantly scaffold directory & file structures from any ASCII/Unicode "tree" diagram** 🚀
10
+
11
+ ## 📚 Table of Contents
12
+
13
+ - [📋 Problem Statement](#-problem-statement)
14
+ - [✨ Features](#-features)
15
+ - [🚀 Installation](#-installation)
16
+ - [💡 Usage](#-usage)
17
+ - [🛠️ Examples](#️-examples)
18
+ - [🤝 Contributing](#-contributing)
19
+ - [🚀 Release Process](#-release-process)
20
+ - [📝 License](#-license)
10
21
 
11
22
  ---
12
23
 
@@ -108,6 +119,19 @@ DRY-RUN File: my_app/README.md
108
119
 
109
120
  Remove `-d` to actually scaffold.
110
121
 
122
+ ### 📁 Sample Files
123
+
124
+ To test Dirfy quickly without creating your own tree files, check out the [examples/](./examples/) directory. It contains several sample tree files you can use:
125
+
126
+ - `examples/simple.tree` — A basic Ruby project structure
127
+ - `examples/web_project.tree` — A front-end web project layout
128
+ - `examples/complex.tree` — Deeply nested directories with mixed file types
129
+ - `examples/unicode.tree` — Non-ASCII filenames and Unicode handling tests
130
+
131
+ ```bash
132
+ dirfy -d examples/web_project.tree
133
+ ```
134
+
111
135
  ---
112
136
 
113
137
  ## 🤝 Contributing
@@ -129,10 +153,94 @@ Happy scaffolding! 🚀
129
153
 
130
154
  ---
131
155
 
156
+ ## 🚀 Release Process
157
+
158
+ This project uses a **semi-automated release process** that balances automation with security. GitHub Actions handles building and testing, while gem publishing is done manually to support 2FA authentication.
159
+
160
+ ### Prerequisites
161
+
162
+ - Push access to the repository
163
+ - RubyGems account with push access to the `dirfy` gem
164
+ - 2FA enabled on RubyGems account (recommended for security)
165
+
166
+ ### Semi-Automated Release Process
167
+
168
+ **What's automated:**
169
+ - ✅ Gem building when you push tags
170
+ - ✅ Running tests before release
171
+ - ✅ GitHub release creation (optional)
172
+
173
+ **What requires manual action:**
174
+ - 🔐 Gem publishing to RubyGems (due to 2FA requirements)
175
+
176
+ ### Release Steps
177
+
178
+ 1. **Update version and run tests**
179
+ ```bash
180
+ # Edit lib/dirfy/version.rb to bump version
181
+ vim lib/dirfy/version.rb
182
+ bundle install # updates Gemfile.lock
183
+ bundle exec rake # run tests
184
+ ```
185
+
186
+ 2. **Commit and tag**
187
+ ```bash
188
+ git add lib/dirfy/version.rb Gemfile.lock
189
+ git commit -m "chore: bump version to vX.Y.Z"
190
+ git tag vX.Y.Z
191
+ git push origin main --follow-tags
192
+ ```
193
+
194
+ 3. **Manual gem publishing (with 2FA)**
195
+ ```bash
196
+ rake build
197
+ gem push pkg/dirfy-X.Y.Z.gem
198
+ # Complete 2FA authentication in browser
199
+ ```
200
+
201
+ 4. **Optional: Create GitHub release**
202
+ ```bash
203
+ gh release create vX.Y.Z pkg/dirfy-X.Y.Z.gem \
204
+ --title "vX.Y.Z" \
205
+ --notes "Release notes here"
206
+ ```
207
+
208
+ ### Using the Release Helper Script
209
+
210
+ For even easier releases, use the provided script:
211
+
212
+ ```bash
213
+ ./scripts/release.sh X.Y.Z
214
+ ```
215
+
216
+ This script will:
217
+ - Update the version in `lib/dirfy/version.rb`
218
+ - Run tests to ensure everything works
219
+ - Build the gem locally
220
+ - Commit changes and create/push the tag
221
+ - Prompt you to manually publish with `gem push` (for 2FA)
222
+
223
+ ### Why Semi-Automated?
224
+
225
+ - **Security**: Maintains 2FA protection on your RubyGems account
226
+ - **Reliability**: Manual gem push ensures you can handle 2FA interactively
227
+ - **Automation**: CI still handles building, testing, and GitHub releases
228
+ - **Simplicity**: No need to manage CI-specific RubyGems accounts or tokens
229
+
230
+ ### Troubleshooting
231
+
232
+ - **2FA Authentication**: Follow the WebAuthn flow in your browser or use `--otp` flag
233
+ - **Build failures**: CI will automatically build when you push tags - check Actions tab for issues
234
+ - **Permission denied**: Ensure you have push access to both the repository and RubyGems gem
235
+
236
+ ---
237
+
132
238
  ## 📝 License
133
239
 
134
240
  MIT © [Ahmed Elhady](https://github.com/ahmedmelhady7)
135
241
 
136
242
  ---
137
243
 
138
- > Built with ❤️ to make AI-generated project scaffolding a breeze.
244
+ > Built with ❤️ to make AI-generated project scaffolding a breeze.
245
+
246
+
data/lib/dirfy/cli.rb CHANGED
@@ -12,7 +12,8 @@ module Dirfy
12
12
  dry_run: false,
13
13
  verbose: false,
14
14
  indent: 4,
15
- prefix: ""
15
+ prefix: "",
16
+ validate: false
16
17
  }
17
18
 
18
19
  parser = OptionParser.new do |opts|
@@ -26,6 +27,10 @@ module Dirfy
26
27
  options[:verbose] = true
27
28
  end
28
29
 
30
+ opts.on("--validate", "Check tree syntax without creating files") do
31
+ options[:validate] = true
32
+ end
33
+
29
34
  opts.on("-iN", "--indent=N", Integer, "Spaces per level (default 4)") do |n|
30
35
  options[:indent] = n
31
36
  end
@@ -60,6 +65,12 @@ module Dirfy
60
65
  items = Parser.new(indent: options[:indent]).parse(lines)
61
66
  items.map! { |p| options[:prefix] + p }
62
67
 
68
+ # Validation mode: just check syntax and exit
69
+ if options[:validate]
70
+ puts "✅ Tree syntax is valid (#{items.size} items detected)"
71
+ exit(0)
72
+ end
73
+
63
74
  puts "🔍 Detected #{items.size} items to create."
64
75
  unless options[:dry_run]
65
76
  print "Proceed? (y/N) "
data/lib/dirfy/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Dirfy
3
- VERSION = "0.3.0"
4
- end
3
+ VERSION = "0.3.2"
4
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dirfy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Your Name