chosen-dartsass 2.0.0 → 2.1.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: 74453e7428c8c31a49dcb64c982a04ced84e92d3904b868fee992a5d278d99ea
4
- data.tar.gz: f4fa18c0b7fd9367480a5d92095b3b90ad41ca5e6e36670d7df3a849d1c708f5
3
+ metadata.gz: 021c2a20279e7208f669f5683fdd42a2d4eccec85cd98b2444a93928c2468011
4
+ data.tar.gz: '0318a4ab5a788c5981c786b33fbb6f6e6cc641d75db714ed4c0725bfbb75860e'
5
5
  SHA512:
6
- metadata.gz: 966a85bbfbe340d99dec26b5f5118d29cfb482d7a7e1a79089e22019c72c86ade46dc2060a230fdce7cb1c047da2a1cb0e95a806965372efe845fad0dfe6f1e6
7
- data.tar.gz: 134a585898329e97cf8ced3e237e0643131586cbbc451d09ad33e532fca03bd177084606ac1b26ce95621d4d573042a6d79e5dc1c4c9c673e18996c6729a879b
6
+ metadata.gz: 9204bca5a85eccf27f28a9965e57245746eb4895ed997f83f348602afd7694f5584cc56bad93d1cf6a81c6407d7b70adcf6ac01f95ddd35941c5985f29a3d0db
7
+ data.tar.gz: 10c4a1eef1e29383614951c0accec5c82843b51eb0971dd2590723c5ccef9d78da25a3a2e3662116a46e349a097a96fcb2328484be84c442d0435836f6575539
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Chosen for rails asset pipeline
2
2
 
3
- [Chosen](https://github.com/harvesthq/chosen) is a library for making long, unwieldy select boxes more user friendly.
3
+ [Chosen](https://github.com/JJJ/chosen) is a library for making long, unwieldy select boxes more user friendly. This gem packages the actively maintained `chosen-jjj` fork.
4
4
 
5
5
  The `chosen-dartsass` gem integrates the `Chosen` into Rails asset pipeline with the [propshaft](https://github.com/rails/propshaft), using [dartsass-rails](https://github.com/rails/dartsass-rails).
6
6
 
@@ -27,7 +27,7 @@ Please consider [jquery-turbolinks](https://github.com/kossnocorp/jquery.turboli
27
27
 
28
28
  Add to your `app/assets/javascripts/application.js` if use with jQuery
29
29
 
30
- ```coffee
30
+ ```javascript
31
31
  //= require jquery
32
32
  //= require chosen-jquery
33
33
  ```
@@ -65,7 +65,7 @@ Notice: `width` option is required since `Chosen 0.9.15`.
65
65
 
66
66
  And this file must be included in `application.js`
67
67
 
68
- ```coffee
68
+ ```javascript
69
69
  //= require chosen-jquery
70
70
  //= require scaffold
71
71
  ```
@@ -143,7 +143,7 @@ chosen_unselect('Leo Tolstoy', from: '#authors')
143
143
 
144
144
  Maintain `chosen-dartsass` gem with `Rake` commands.
145
145
 
146
- Update origin chosen source files.
146
+ Update the chosen-jjj source files.
147
147
 
148
148
  ```bash
149
149
  rake update-chosen
data/Rakefile CHANGED
@@ -2,13 +2,11 @@
2
2
  require 'bundler/gem_tasks'
3
3
  require File.expand_path('../lib/chosen-dartsass/source_file', __FILE__)
4
4
 
5
- desc "Update with Harvest's Chosen Library"
5
+ desc "Update with the chosen-jjj library"
6
6
  task 'update-chosen', 'repository_url', 'branch' do |task, args|
7
- remote = args['repository_url'] || 'https://github.com/harvesthq/chosen'
8
- branch = args['branch'] || 'main'
7
+ remote = args['repository_url'] || 'https://github.com/JJJ/chosen'
8
+ branch = args['branch'] || 'master'
9
9
  files = SourceFile.new
10
- #files.fetch remote, branch
11
- #files.eject_javascript_class_from_closure
12
- files.generate_js
10
+ files.fetch remote, branch
13
11
  files.cleanup
14
12
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.homepage = 'https://github.com/activescaffold/chosen-dartsass'
10
10
 
11
11
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
- gem.files = `git ls-files`.split("\n")
12
+ gem.files = `git ls-files`.split("\n").select { |file| File.file?(file) }
13
13
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
14
  gem.name = 'chosen-dartsass'
15
15
  gem.require_paths = ['lib']
@@ -22,5 +22,4 @@ Gem::Specification.new do |gem|
22
22
  gem.add_development_dependency 'bundler', '>= 1.0'
23
23
  gem.add_development_dependency 'rails', '>= 7.0'
24
24
  gem.add_development_dependency 'thor', '>= 0.14'
25
- gem.add_development_dependency 'coffee-rails', '>= 3.2'
26
25
  end
@@ -1,10 +1,6 @@
1
1
  module Chosen
2
2
  module Dartsass
3
3
  class Engine < ::Rails::Engine
4
- config.assets.precompile += %w(
5
- chosen-sprite*.png
6
- )
7
-
8
4
  rake_tasks do
9
5
  load 'chosen-dartsass/tasks.rake'
10
6
  end
@@ -1,6 +1,5 @@
1
1
  require 'thor'
2
2
  require 'json'
3
- require 'coffee-script'
4
3
 
5
4
  class SourceFile < Thor
6
5
  include Thor::Actions
@@ -8,86 +7,27 @@ class SourceFile < Thor
8
7
  desc 'fetch source files', 'fetch source files from GitHub'
9
8
  def fetch remote, branch
10
9
  say "get from #{remote}/raw/#{branch}"
11
- get "#{remote}/raw/#{branch}/public/chosen-sprite.png", 'vendor/assets/images/chosen-sprite.png'
12
- get "#{remote}/raw/#{branch}/public/chosen-sprite@2x.png", 'vendor/assets/images/chosen-sprite@2x.png'
13
- get "#{remote}/raw/#{branch}/sass/chosen.scss", 'vendor/assets/stylesheets/chosen.scss'
14
- get "#{remote}/raw/#{branch}/coffee/lib/abstract-chosen.coffee", 'lib/assets/javascripts/lib/abstract-chosen.coffee'
15
- get "#{remote}/raw/#{branch}/coffee/lib/select-parser.coffee", 'lib/assets/javascripts/lib/select-parser.coffee'
16
- get "#{remote}/raw/#{branch}/coffee/chosen.jquery.coffee", 'lib/assets/javascripts/chosen.jquery.coffee'
17
- get "#{remote}/raw/#{branch}/coffee/chosen.proto.coffee", 'lib/assets/javascripts/chosen.proto.coffee'
18
- get "#{remote}/raw/#{branch}/package.json", 'lib/assets/javascripts/package.json'
10
+ get "#{remote}/raw/#{branch}/sass/chosen.scss", 'vendor/assets/stylesheets/chosen.scss', force: true
11
+ get "#{remote}/raw/#{branch}/dist/js/chosen.jquery.js", 'vendor/assets/javascripts/chosen-jquery.js', force: true
12
+ get "#{remote}/raw/#{branch}/dist/js/chosen.proto.js", 'vendor/assets/javascripts/chosen-prototype.js', force: true
13
+ get "#{remote}/raw/#{branch}/package.json", 'lib/assets/javascripts/package.json', force: true
19
14
  bump_version
20
15
  end
21
16
 
22
- desc 'eject class from closure', 'eject javascript library class from closure'
23
- def eject_javascript_class_from_closure
24
- self.destination_root = 'lib/assets/javascripts'
25
- inside destination_root do
26
- append_to_file 'lib/abstract-chosen.coffee' do
27
- "\nwindow.AbstractChosen = AbstractChosen\n"
28
- end
29
- append_to_file 'lib/select-parser.coffee' do
30
- "\n\nwindow.SelectParser = SelectParser\n"
31
- end
32
- end
33
- end
34
-
35
- desc 'generate JS files', 'generate JS files from coffee script source'
36
- def generate_js
37
- gem_root = File.expand_path('../..', __dir__)
38
- coffee_dir = File.join(gem_root, 'lib', 'assets', 'javascripts')
39
- output_dir = File.join(gem_root, 'vendor', 'assets', 'javascripts')
40
-
41
- # Create output directory
42
- FileUtils.mkdir_p(output_dir)
43
-
44
- # Collect all CoffeeScript files to combine
45
- coffee_files = []
46
-
47
- # 1. First include your lib coffee scripts
48
- lib_files = [
49
- File.join(coffee_dir, 'lib/abstract-chosen.coffee'),
50
- File.join(coffee_dir, 'lib/select-parser.coffee'),
51
- ]
52
- coffee_files.concat(lib_files)
53
-
54
- {'chosen.jquery.coffee' => 'chosen-jquery.js', 'chosen.proto.coffee' => 'chosen-prototype.js'}.each do |coffee, js|
55
- say "Generating JS #{js} from #{coffee}"
56
- combined_coffee = [*coffee_files, File.join(coffee_dir, coffee)].map do |file|
57
- File.read(file)
58
- end.join("\n\n")
59
- output_file = File.join(output_dir, js)
60
- coffee2js(combined_coffee, output_file)
61
- end
62
- end
63
-
64
17
  desc 'clean up useless files', 'clean up useless files'
65
18
  def cleanup
66
19
  self.destination_root = 'lib/assets/javascripts'
67
20
  remove_file 'package.json'
68
21
  end
69
22
 
70
- protected
71
-
72
- def coffee2js(coffee, output_file)
73
- js_code = CoffeeScript.compile(coffee)
74
- File.write(output_file, js_code)
75
-
76
- say "✅ Successfully generated #{output_file}"
77
- say " Size: #{File.size(output_file)} bytes"
78
-
79
- rescue => e
80
- say "❌ Failed to compile: #{e.message}"
81
- say e.backtrace.first(5).join("\n")
82
- exit 1
83
- end
84
-
85
- def bump_version
86
- inside destination_root do
87
- package_json = JSON.load(File.open('lib/assets/javascripts/package.json'))
88
- version = package_json['version']
89
- gsub_file 'lib/chosen-dartsass/version.rb', /CHOSEN_VERSION\s=\s'(\d|\.)+'$/ do |match|
90
- %Q{CHOSEN_VERSION = '#{version}'}
23
+ no_commands do
24
+ def bump_version
25
+ inside destination_root do
26
+ package_json = JSON.load(File.open('lib/assets/javascripts/package.json'))
27
+ version = package_json['version']
28
+ gsub_file 'lib/chosen-dartsass/version.rb', /CHOSEN_VERSION\s=\s'(\d|\.)+'$/ do
29
+ %Q{CHOSEN_VERSION = '#{version}'}
30
+ end
91
31
  end
92
32
  end
93
33
  end
@@ -1,6 +1,6 @@
1
1
  module Chosen
2
2
  module Dartsass
3
- VERSION = '2.0.0'
4
- CHOSEN_VERSION = '1.8.7'
3
+ VERSION = '2.1.0'
4
+ CHOSEN_VERSION = '4.0.0'
5
5
  end
6
6
  end