windclutter 0.0.11 → 0.0.13

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: bafd6a2f35aa2fcbe2bf7cf192b6ecba0188170fd55e983ad89cce4253e77b02
4
- data.tar.gz: b7b22f11ec851d62e10f43f5866590bf40295ebad7135f60d90eeceebf9251bd
3
+ metadata.gz: dd8e4ea2e0a57f480acc24a90b019e7ad0b0733158ba96db81fd4cf3278197cb
4
+ data.tar.gz: 9b59f08b8f5d70b1133dd6a008f99dbbb167b0e2d354a0dc30759ec12a933f80
5
5
  SHA512:
6
- metadata.gz: 739c41e7c07d46e8f90a915c25bd766fff9bf184015cd17344afd4da17280d27d8f83e689349fb48b5273cf50c073600c6fba4be38eef26ea8dab5fdbc0c0559
7
- data.tar.gz: 661801af4b94c4dc19d142e93abd5d3d6274a328536be5f9f291309fff7fcce338aa61dadbc8846791c3e01f40ca132b1cc7019a5a58c0a281ddb1d44044aa53
6
+ metadata.gz: 77609004646a587a69ac0122eb5de24df872588cf25ef7809d1db56c4e1ed4b2ad816ff694c0f9e6e817b939278a5ecdb98300b3d3bf07c0d3cb3cc3318dc2fb
7
+ data.tar.gz: e8d3a3a8d97df76b0ce7c5815dcc0894aad76f14f20dc2f0ddc1444f9cddad1512bbb29743954bf40e61e385f4f85b00b2d7aa935f40a97723f7f69a794e370d
data/README.md CHANGED
@@ -51,33 +51,55 @@ humongous task of Tailwind CSS cleanup.
51
51
 
52
52
  <hr/>
53
53
 
54
- ## Installation
54
+ ## Quick Installation
55
55
 
56
56
  ```bash
57
57
  # requires ruby 2.7 and above
58
58
  $ gem install windclutter
59
59
 
60
- $ windclutter install
60
+ $ cd your_project
61
+ $ windclutter use
61
62
  ```
62
63
 
63
64
  ## In Action
64
65
 
66
+ ### 1. Single file analysis `-f`
67
+ ```
68
+ $ windclutter analysis -f src/index.html
65
69
  ```
66
- $ cd your_project
67
70
 
68
- $ windclutter project use <your_project_name>
69
- $ windclutter analysis file src/index.html
70
71
  ```
72
+ # output
71
73
 
72
- ```html
73
- <div class="my-class border rounded-md px-4 py-2 bg-primary-100">
74
- <!-- -->
75
- </div>
74
+ Analysing src/index.html...
75
+ Done!
76
+ {
77
+ "flex" => 3,
78
+ "flex-col" => 3,
79
+ }
80
+ ```
81
+
82
+ ### 2. Project traversal `-t` (NEW)
83
+
84
+ Provide an option with your file extension, and let it do its magic! 🎉
85
+
86
+ ```
87
+ $ windclutter analysis -t .html
76
88
  ```
77
89
 
78
90
  ```
79
91
  # output
80
- {"my-class"=>1, "border"=>1, "rounded-md"=>1, "px-4"=>1, "py-2"=>1, "bg-primary-100"=>1}
92
+
93
+ Analysing .html...
94
+ Traversed 22 .html file(s)... 🎉
95
+ {
96
+ "flex" => 44,
97
+ "flex-col" => 31,
98
+ "items-center" => 30,
99
+ "text-center" => 21,
100
+ "gap-2" => 14
101
+ }
102
+ ...and 120 more
81
103
  ```
82
104
 
83
105
  ## Bleeding Edge!
@@ -8,20 +8,6 @@ module WindClutter
8
8
  module CLI
9
9
  module Commands
10
10
  module Project
11
- # Initiate setup for specified project
12
- class Init < Dry::CLI::Command
13
- include WindClutter::Util
14
-
15
- desc 'Setup windclutter for your project'
16
-
17
- argument :name, required: true, desc: 'Name of your project.'
18
-
19
- def call(name:, **)
20
- FileHandler.create_project(name)
21
- puts 'Successfully created!'.green
22
- end
23
- end
24
-
25
11
  # List all of created project for windclutter
26
12
  class List < Dry::CLI::Command
27
13
  include WindClutter::Util
@@ -39,19 +25,20 @@ module WindClutter
39
25
 
40
26
  desc 'Use the project, automatically create one if not exists yet.'
41
27
 
42
- argument :name, required: true, desc: 'Name of your project.'
28
+ argument :name, desc: 'Name of your project.'
43
29
 
44
- def call(name:, **)
45
- return Config.read('active_project') if name.nil?
30
+ def call(name: nil, **)
31
+ project_name = name || File.basename(Dir.pwd)
46
32
 
47
- unless FileHandler.list_projects.include? name
48
- FileHandler.create_project(name)
49
- puts 'No project, we created one instead'.green
33
+ FileHandler.init_config unless Config.exists?
34
+ unless FileHandler.list_projects.include? project_name
35
+ FileHandler.create_project(project_name)
36
+ puts 'No project, we created one instead'.yellow
50
37
  end
51
38
 
52
- Config.update('active_project', name)
53
- Config.setup_project(name)
54
- puts "Using project \"#{name}\"".green
39
+ Config.update('active_project', project_name)
40
+ Config.setup_project(project_name)
41
+ puts "Using project \"#{project_name}\"".green
55
42
  end
56
43
  end
57
44
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'awesome_print'
3
4
  require 'dry/cli'
4
5
  require 'windclutter/version'
5
6
  require 'windclutter/util/file_handler'
@@ -22,17 +23,6 @@ module WindClutter
22
23
  end
23
24
  end
24
25
 
25
- # Perform initial setup for windclutter
26
- class Install < Dry::CLI::Command
27
- include WindClutter::Util
28
-
29
- desc 'Initiate first setup for windclutter'
30
-
31
- def call(*)
32
- FileHandler.init_config
33
- end
34
- end
35
-
36
26
  # Uninstallation handler
37
27
  class Uninstall < Dry::CLI::Command
38
28
  include WindClutter::Util
@@ -51,26 +41,24 @@ module WindClutter
51
41
  desc 'Debug the configuration of windclutter'
52
42
 
53
43
  def call(*)
54
- puts Config.wtf?
44
+ ap Config.wtf?
55
45
  end
56
46
  end
57
47
 
58
48
  register 'version', ShowVersion, aliases: %w[v -v --version]
59
- register 'install', Install, aliases: %w[i -i --install]
49
+ register 'use', Commands::Project::Use, aliases: %w[u -u --use]
60
50
  register 'uninstall', Uninstall, aliases: %w[u -u --uninstall]
61
51
  register 'debug', Debug, aliases: %w[d -d --debug]
62
52
 
63
53
  register 'project', aliases: ['p'] do |prefix|
64
- prefix.register 'init', Commands::Project::Init
65
54
  prefix.register 'list', Commands::Project::List
66
- prefix.register 'use', Commands::Project::Use
67
55
  prefix.register 'current', Commands::Project::Current
68
56
  prefix.register 'dump-path', Commands::Project::DumpPath, aliases: ['-d']
69
57
  prefix.register 'config', Commands::Project::ConfigUpdate, aliases: ['-c']
70
58
  end
71
59
 
72
- register 'analysis', aliases: %w[a -a] do |prefix|
73
- prefix.register 'file', Commands::Analysis::FilePath, aliases: ['-p']
60
+ register 'analysis', aliases: %w[a] do |prefix|
61
+ prefix.register 'file', Commands::Analysis::FilePath, aliases: ['-f']
74
62
  prefix.register 'traverse', Commands::Analysis::Traverse, aliases: ['-t']
75
63
  end
76
64
 
@@ -69,13 +69,7 @@ module WindClutter
69
69
  end
70
70
 
71
71
  def self.exists?
72
- unless File.file?('/tmp/windclutter/config.yml')
73
- puts 'You have not install windclutter yet'.yellow
74
- puts 'To install, run:'
75
- puts "\twindclutter install".green
76
- return false
77
- end
78
- true
72
+ File.file?('/tmp/windclutter/config.yml')
79
73
  end
80
74
  end
81
75
  end
@@ -15,6 +15,7 @@ module WindClutter
15
15
 
16
16
  template = File.expand_path('../../template', File.dirname(__FILE__))
17
17
 
18
+ puts 'First setup of windclutter...'.green
18
19
  puts 'Created the following files:'
19
20
  Dir["#{template}/*.yml"].each do |file|
20
21
  FileUtils.cp(file, '/tmp/windclutter')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WindClutter
4
- VERSION = '0.0.11'
4
+ VERSION = '0.0.13'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: windclutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zafranudin Zafrin