classic 0.1.1 → 0.1.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: 47ef7851e58eaa92f7c1175bb3acda23fd987a694c6583b883b3ac1d6cb9d863
4
- data.tar.gz: 561ae1ed4743c29967c7c30472e5609c36b527221920ffa4d2c24dfdce57fbec
3
+ metadata.gz: b9b6c89e9cb55030008ef80ce3847b23f0a16c7610f56d4cb01cadb8841ef1fc
4
+ data.tar.gz: 3b3fd02c414c5a926028c0719bc814623a2304899454055b46703a657c568afb
5
5
  SHA512:
6
- metadata.gz: 04aec15920dcdb77462ca5c9c55bfb55136bed223b994be19cc7770c9b1ff80e8654eacc13a1acd3d1f627a3bfa263baa6c8e1733ff98aef3df06827e535b92d
7
- data.tar.gz: 1d12381b0e627f796ed7d31f9421f4396096f9fe0df89a105203d8c7d46ec41ab01fd2962be172ced2a17444ac1174e8a47e674e944d802051dae8967f53ed92
6
+ metadata.gz: 8039ad1e8a75ad3e0774336f00c188ddc008d51cb252887c93a6e71e32f778804bee1f38a5dc3abb86a94dd56d17a5cbdbbf9a56015ae772dfde298002795567
7
+ data.tar.gz: fb00ffb5ff56d117b5658304a28022229c0f84fd43e46228eb70dc4e57eb99f39a1da77cd7629377a9f7c8ef82e00a78e31c382b4d0d5c07e7c0a56b27c9da29
data/README.md CHANGED
@@ -51,7 +51,6 @@ gem install classic
51
51
  ```
52
52
 
53
53
  ```ruby
54
-
55
54
  tw_class_merge = TailwindMerge::Merger.new
56
55
 
57
56
  Classic.configure do |config|
@@ -62,6 +61,16 @@ gem install classic
62
61
  end
63
62
  ```
64
63
 
64
+ * Rails: Generate config. Default style directory is "style"
65
+ ```
66
+ ./bin/rails g classic:install
67
+ ```
68
+
69
+ Specify style directory
70
+ ```
71
+ ./bin/rails g classic:install app_style
72
+ ```
73
+
65
74
  2. How to define style using yml.
66
75
 
67
76
  ```yml
@@ -5,9 +5,9 @@ module Classic
5
5
  attr_accessor :files, :file_prefix, :raise_error_on_not_found, :classes_merge_handler,
6
6
  :auto_reload_on_change
7
7
 
8
- def validate!
8
+ def validate
9
9
  if files.nil? || files.empty?
10
- raise Classic::Error, "'files' option value is required."
10
+ puts "[Classic configuration] style directory not present or 'files' in style directory not present."
11
11
  end
12
12
  end
13
13
  end
@@ -30,6 +30,9 @@ module Classic
30
30
  files.each do |file|
31
31
  extname = File.extname(file)
32
32
  file_data = (extname == "json") ? JSON.load_file(file) : YAML.load_file(file)
33
+
34
+ next unless file_data.is_a?(Hash)
35
+
33
36
  aliases = file_data.delete(ALIASES_KEY) if file_data.key?(ALIASES_KEY)
34
37
 
35
38
  if config.file_prefix
@@ -8,6 +8,8 @@ module Classic
8
8
  end
9
9
 
10
10
  def self.watch_style_files(app)
11
+ return unless Classic.object
12
+
11
13
  style_files = Classic.object.files.map { |f| Rails.root.join(f).to_s }
12
14
  reloader = app.config.file_watcher.new(style_files) {}
13
15
  app.reloaders << reloader
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Classic
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/classic.rb CHANGED
@@ -15,7 +15,7 @@ module Classic
15
15
  config = Configuration.new
16
16
  yield config
17
17
  config.classes_merge_handler ||= proc { |classes| classes.join(" ") }
18
- config.validate!
18
+ config.validate
19
19
 
20
20
  @classic = Classic::Manager.new(config: config)
21
21
  @classic.load
@@ -0,0 +1,2 @@
1
+ Description:
2
+ Generates a classic style manager config for your application.
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+
5
+ module Classic
6
+ module Generators
7
+ class InstallGenerator < ::Rails::Generators::Base
8
+ source_root File.expand_path("templates", __dir__)
9
+ argument :dir, type: :string, default: "style", banner: "style directory"
10
+
11
+ desc "This generator creates an initializer file at config/initializers and style dir with default file."
12
+ def create_classic_config_and_style_dir
13
+ @dir_name = dir
14
+ template "classic.rb", "config/initializers/classic.rb"
15
+ copy_file "app.yaml", "#{@dir_name}/app.yaml"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ btn:
2
+ base: inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-5
3
+ varient:
4
+ default: bg-primary text-primary-foreground shadow hover:bg-primary/90
5
+ destructive: bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90
6
+ outline: border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground
7
+ secondary: bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80
8
+ ghost: hover:bg-accent hover:text-accent-foreground
9
+ link: text-primary underline-offset-4 hover:underline
10
+ size:
11
+ default: h-9 px-4 py-2
12
+ sm: h-8 rounded-md px-3 text-xs
13
+ lg: h-10 rounded-md px-8
14
+ icon: h-9 w-9
15
+ default: "(varient.default,size.default)"
16
+
17
+ card:
18
+ <self: rounded-xl border bg-card text-card-foreground shadow
19
+ header: flex flex-col space-y-1.5 p-6
20
+ title: font-semibold leading-none tracking-tight
21
+ description: text-sm text-muted-foreground
22
+ content: p-6 pt-0
23
+ footer: flex items-center p-6 pt-0
24
+
25
+ "@aliases":
26
+ btn-primary: "btn(varient.outline,size.default)"
@@ -0,0 +1,8 @@
1
+ # tw_class_merge = TailwindMerge::Merger.new
2
+
3
+ Classic.configure do |config|
4
+ config.files = Dir["<%= @dir_name %>/**/*.yaml"]
5
+ config.raise_error_on_not_found = Rails.env.development?
6
+ config.auto_reload_on_change = Rails.env.development?
7
+ # config.classes_merge_handler = proc { |classes| tw_class_merge.merge(classes) }
8
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jiren Patel
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-16 00:00:00.000000000 Z
10
+ date: 2025-01-27 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: A comprehensive utility library designed to standardize and simplify
13
13
  the management of styles across web application and cache styles. This library facilitates
@@ -30,6 +30,10 @@ files:
30
30
  - lib/classic/railtie.rb
31
31
  - lib/classic/string_ext.rb
32
32
  - lib/classic/version.rb
33
+ - lib/generators/classic/install/USAGE
34
+ - lib/generators/classic/install/install_generator.rb
35
+ - lib/generators/classic/install/templates/app.yaml
36
+ - lib/generators/classic/install/templates/classic.rb.tt
33
37
  - sig/classic.rbs
34
38
  homepage: https://github.com/EloquentStudio/classic
35
39
  licenses: