tail_draft 0.0.0 → 0.0.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 +4 -4
- data/README.md +13 -26
- data/bin/tail_draft +2 -1
- data/lib/tail_draft/cli.rb +42 -9
- data/lib/tail_draft/processor.rb +18 -0
- data/lib/tail_draft/util/generator.rb +13 -0
- data/lib/tail_draft.rb +1 -0
- data/test/tail_draft/test_cli.rb +10 -0
- data/test/tail_draft/test_processor.rb +13 -0
- data/test/tail_draft/util/test_generator.rb +11 -0
- data/test/test_tail_draft.rb +5 -0
- metadata +13 -8
- data/test/test_tailwind_buddy.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dcb001cdf76199a8f78b5dabd74a8c721cd5e3a10caaf00a78bff47e3f9b929
|
4
|
+
data.tar.gz: d0c950bb0969574307a6495cd5f01966f80642575580c5333aec58e66eb2de28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ee96987bb79cfb0287be03b06bccc57e882e5d3f09be803798360b6beb9116ba9a6643332621e3d8961143319905ac7f34bb02abf28975fbe20b8968c41392c
|
7
|
+
data.tar.gz: 97e6da33d34d9cc78110041767f7d9c7d8f9406c00ce0d7d0e19f1a910c9572a95356fce1d5af4e31486fd4201ccf4142ca0b9eea87608341cb630b1024df304
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+

|
2
|
+
|
3
|
+
## Tail Draft
|
2
4
|
|
3
5
|
Spam this buddy with your bulky TailwindCSS class, and sort it out later.
|
4
6
|
|
@@ -11,21 +13,12 @@ Helping you stay focused and develop faster with your project.
|
|
11
13
|
### 1 - Basic Cleanup
|
12
14
|
```bash
|
13
15
|
# standard button
|
14
|
-
$
|
15
|
-
|
16
|
-
# standard card
|
17
|
-
$ tailwind_buddy -n border rounded-md bg-white
|
16
|
+
$ tail_draft draft border rounded-md px-4 py-2
|
18
17
|
|
19
|
-
$
|
20
|
-
[1/
|
18
|
+
$ tail_draft --organize
|
19
|
+
[1/1] What do you want to do with this class?
|
21
20
|
'border rounded-md px-4 py-2'
|
22
21
|
name: .btn
|
23
|
-
Continue? [y/N]
|
24
|
-
|
25
|
-
[1/2] What do you want to do with this class?
|
26
|
-
'border rounded-md bg-white'
|
27
|
-
name: .card
|
28
|
-
Continue? [y/N]
|
29
22
|
|
30
23
|
Done!
|
31
24
|
Exported to compiled.css
|
@@ -38,30 +31,24 @@ Generated Output
|
|
38
31
|
.btn {
|
39
32
|
@apply border rounded-md px-4 py-2;
|
40
33
|
}
|
41
|
-
|
42
|
-
.card {
|
43
|
-
@apply border rounded-md bg-white;
|
44
|
-
}
|
45
34
|
```
|
46
35
|
|
47
36
|
### 2 - Guided cleanup
|
48
37
|
|
49
38
|
```bash
|
50
|
-
$
|
39
|
+
$ tail_draft guided
|
51
40
|
|
52
|
-
[1/
|
41
|
+
[1/1] Cleanup progress
|
53
42
|
1. Global find this in your project:
|
54
43
|
class="border rounded-md px-4 py-2"
|
55
44
|
|
56
45
|
2. Replace with:
|
57
46
|
class="btn"
|
58
47
|
|
59
|
-
|
60
|
-
|
61
|
-
class="border rounded-md bg-white"
|
48
|
+
Done!
|
49
|
+
```
|
62
50
|
|
63
|
-
|
64
|
-
class="card"
|
51
|
+
## Contributing
|
65
52
|
|
66
|
-
|
67
|
-
|
53
|
+
Take a look into:
|
54
|
+
https://github.com/Xavier-IV/tail_draft/wiki/Developer
|
data/bin/tail_draft
CHANGED
data/lib/tail_draft/cli.rb
CHANGED
@@ -1,14 +1,47 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
require 'thor'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'tail_draft/processor'
|
6
|
+
require 'tail_draft/util/generator'
|
7
|
+
|
8
|
+
module TailDraft
|
9
|
+
# CLI implementation for tail_draft
|
6
10
|
class CLI < Thor
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
11
|
+
attr_reader :config_folder
|
12
|
+
|
13
|
+
option :name
|
14
|
+
|
15
|
+
def initialize(args = nil, options = nil, config = nil)
|
16
|
+
@config_folder = '/tmp/tail_draft'
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
# Init your project with tail_draft
|
21
|
+
#
|
22
|
+
# TailDraft::CLI.init(<project_name>)
|
23
|
+
desc 'init PROJECT_NAME', 'The name of your project'
|
24
|
+
def init(name)
|
25
|
+
create_project(name)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Draft the list of classes
|
29
|
+
#
|
30
|
+
# TailDraft::CLI.draft(<tailwind class_names>)
|
31
|
+
desc 'draft CLASS_NAMES', 'Provide a list of class'
|
32
|
+
def draft(*class_names)
|
33
|
+
name = options[:name]
|
34
|
+
name = TailDraft::Util::Generator.random_class if name.to_s.empty?
|
35
|
+
|
36
|
+
classes = TailDraft::Processor.sort(class_names)
|
37
|
+
TailDraft::Processor.build_single(name, classes)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def create_project(_value)
|
43
|
+
FileUtils.mkdir_p(@config_folder)
|
44
|
+
nil
|
12
45
|
end
|
13
46
|
end
|
14
47
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TailDraft
|
4
|
+
# Processor for tail_draft
|
5
|
+
class Processor
|
6
|
+
def self.build_single(name, classes)
|
7
|
+
<<~OUTPUT
|
8
|
+
#{name} {
|
9
|
+
@apply #{classes.join(' ')};
|
10
|
+
}
|
11
|
+
OUTPUT
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.sort(classes)
|
15
|
+
classes.sort
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/tail_draft.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'tail_draft/processor'
|
5
|
+
|
6
|
+
class TailDraftProcessorTest < Minitest::Test
|
7
|
+
def test_able_to_generate_block
|
8
|
+
result = TailDraft::Processor.build_single('.class', %w[container mx-auto])
|
9
|
+
|
10
|
+
assert_equal ".class {\n @apply container mx-auto;\n}\n",
|
11
|
+
result
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'tail_draft/util/generator'
|
5
|
+
|
6
|
+
class TailDraftUtilGeneratorTest < Minitest::Test
|
7
|
+
def test_able_to_randomize_class_name
|
8
|
+
assert_match(/.[a-z]+/,
|
9
|
+
TailDraft::Util::Generator.random_class)
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tail_draft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zafranudin Zafrin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Your buddy to skyrocket your development with TailwindCSS.
|
14
14
|
email: coffee@zafranudin.dev
|
@@ -21,12 +21,17 @@ files:
|
|
21
21
|
- bin/tail_draft
|
22
22
|
- lib/tail_draft.rb
|
23
23
|
- lib/tail_draft/cli.rb
|
24
|
-
-
|
24
|
+
- lib/tail_draft/processor.rb
|
25
|
+
- lib/tail_draft/util/generator.rb
|
26
|
+
- test/tail_draft/test_cli.rb
|
27
|
+
- test/tail_draft/test_processor.rb
|
28
|
+
- test/tail_draft/util/test_generator.rb
|
29
|
+
- test/test_tail_draft.rb
|
25
30
|
homepage: https://rubygems.org/gems/tailwind_buddy
|
26
31
|
licenses:
|
27
32
|
- MIT
|
28
33
|
metadata: {}
|
29
|
-
post_install_message:
|
34
|
+
post_install_message:
|
30
35
|
rdoc_options: []
|
31
36
|
require_paths:
|
32
37
|
- lib
|
@@ -34,15 +39,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
34
39
|
requirements:
|
35
40
|
- - ">="
|
36
41
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
42
|
+
version: 2.7.0
|
38
43
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
44
|
requirements:
|
40
45
|
- - ">="
|
41
46
|
- !ruby/object:Gem::Version
|
42
47
|
version: '0'
|
43
48
|
requirements: []
|
44
|
-
rubygems_version: 3.
|
45
|
-
signing_key:
|
49
|
+
rubygems_version: 3.1.6
|
50
|
+
signing_key:
|
46
51
|
specification_version: 4
|
47
52
|
summary: Quickly develop with TailwindCSS without worries.
|
48
53
|
test_files: []
|
data/test/test_tailwind_buddy.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'tail_draft'
|
5
|
-
|
6
|
-
class TailwindBuddyTest < Minitest::Test
|
7
|
-
def test_english_hello
|
8
|
-
assert_equal 'hello world',
|
9
|
-
TailDraft::CLI.hello('english')
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_any_hello
|
13
|
-
assert_equal 'hello world',
|
14
|
-
TailDraft::CLI.hello('ruby')
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_spanish_hello
|
18
|
-
assert_equal 'hola mundo',
|
19
|
-
TailDraft::CLI.hello('spanish')
|
20
|
-
end
|
21
|
-
end
|