k_builder 0.0.73 → 0.0.77

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71d70294c1dc49e1fc67dd77f71414019a3814f44057831273bc79d815146f05
4
- data.tar.gz: 5d18531c4d7f4ddb2c1cafb8297bf7d2e0c3f708526464d2d700ea7750eb048f
3
+ metadata.gz: ac1cdc23345b4070d9bb728958b15b688860f0b0aaa0517acfbc2e775003ee82
4
+ data.tar.gz: 4a8bc3c079064f427d3d64eeb2487ac57de05bcd5eec932045bef8e449809992
5
5
  SHA512:
6
- metadata.gz: 7f5059460b2ab02d3708de1019a7ca2a9b4974c13e7f6da9b0c1d0aa720cdbdaabd29e3d9cb1451ce3b3db11211bd3fc9fd76edf4d284f12e48d0287ee328289
7
- data.tar.gz: b02df37b1b11213b71e364d2c881de6df3e09ce355ada72807d30d6a37cca4a3fa263c8539e05cd582a64e3456c10b0ef74fed0a64de711c20bcf4c217fe546d
6
+ metadata.gz: 21d748c245757fd6b0f52117de0cf3c6551385a357899404ab75da30df41927b29e26242c8320d880941b85271421b8c29caf6d2c8692506440cff08f9eca898
7
+ data.tar.gz: 29096922d0f86f016f0fe42422544bc44bba0707d6988eb54abc7b82fb404da23a76d893f7813f2155dd7ff6b080eb8afff01bf75296235821de9278283a3152
data/.rubocop.yml CHANGED
@@ -39,7 +39,7 @@ Metrics/MethodLength:
39
39
  Layout/LineLength:
40
40
  Max: 200
41
41
  # Ignores annotate output
42
- IgnoredPatterns: ['\A# \*\*']
42
+ AllowedPatterns: ['\A# \*\*']
43
43
  IgnoreCopDirectives: true
44
44
 
45
45
  Lint/UnusedMethodArgument:
data/Gemfile CHANGED
@@ -2,24 +2,23 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Specify your gem's dependencies in handlebars_helpers.gemspec
6
5
  gemspec
7
6
 
8
- # group :development do
9
- # # Currently conflicts with GitHub actions and so I remove it on push
10
- # # pry on steroids
11
- # gem 'jazz_fingers'
12
- # gem 'pry-coolline', github: 'owst/pry-coolline', branch: 'support_new_pry_config_api'
13
- # end
14
-
15
7
  group :development, :test do
16
8
  gem 'guard-bundler'
17
9
  gem 'guard-rspec'
18
10
  gem 'guard-rubocop'
19
- gem 'rake', '~> 12.0'
11
+ gem 'rake' # , '~> 12.0'
20
12
  gem 'rake-compiler', require: false
21
13
  gem 'rspec', '~> 3.0'
22
14
  gem 'rubocop'
23
15
  gem 'rubocop-rake', require: false
24
16
  gem 'rubocop-rspec', require: false
25
17
  end
18
+
19
+ if ENV['KLUE_LOCAL_GEMS']&.to_s&.downcase == 'true'
20
+ group :development, :test do
21
+ puts 'Using Local GEMs'
22
+ gem 'handlebarsjs' , path: '../handlebarsjs'
23
+ end
24
+ end
data/README.md CHANGED
@@ -50,7 +50,7 @@ Check out usage.md for more details
50
50
  ```ruby
51
51
  usecases_folder = File.join(Dir.getwd, 'spec', 'usecases')
52
52
 
53
- KBuilder.configure do |config|
53
+ KConfig.configure do |config|
54
54
  config.template_folder = File.join(usecases_folder, '.app_template')
55
55
  config.global_template_folder = File.join(usecases_folder, '.global_template')
56
56
  config.target_folder = File.join(usecases_folder, '.output')
data/USAGE.md CHANGED
@@ -13,13 +13,13 @@ Print the configuration
13
13
  ```ruby
14
14
  usecases_folder = File.join(Dir.getwd, 'spec', 'usecases')
15
15
 
16
- KBuilder.configure do |config|
16
+ KConfig.configure do |config|
17
17
  config.template_folder = File.join(usecases_folder, '.app_template')
18
18
  config.global_template_folder = File.join(usecases_folder, '.global_template')
19
19
  config.target_folder = File.join(usecases_folder, '.output')
20
20
  end
21
21
 
22
- puts JSON.pretty_generate(KBuilder.configuration.to_hash)
22
+ puts JSON.pretty_generate(KConfig.configuration.to_hash)
23
23
  ```
24
24
 
25
25
  ```javascript
data/k_builder.gemspec CHANGED
@@ -22,9 +22,10 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  # spec.metadata['allowed_push_host'] = "Set to 'http://mygemserver.com'"
24
24
 
25
- spec.metadata['homepage_uri'] = spec.homepage
26
- spec.metadata['source_code_uri'] = 'https://github.com/klueless-io/k_builder'
27
- spec.metadata['changelog_uri'] = 'https://github.com/klueless-io/k_builder/commits/master'
25
+ spec.metadata['homepage_uri'] = spec.homepage
26
+ spec.metadata['source_code_uri'] = 'https://github.com/klueless-io/k_builder'
27
+ spec.metadata['changelog_uri'] = 'https://github.com/klueless-io/k_builder/commits/master'
28
+ spec.metadata['rubygems_mfa_required'] = 'true'
28
29
 
29
30
  # Specify which files should be added to the gem when it is released.
30
31
  # The `git ls-files -z` loads the RubyGem files that have been added into git.
@@ -37,12 +38,11 @@ Gem::Specification.new do |spec|
37
38
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
39
  spec.require_paths = ['lib']
39
40
  # spec.extensions = ['ext/k_builder/extconf.rb']
40
- spec.add_dependency 'handlebars-helpers', '~> 0'
41
+ # spec.add_dependency 'handlebars-helpers', '~> 0'
42
+ spec.add_dependency 'handlebarsjs', '~> 0.6'
41
43
  spec.add_dependency 'k_config', '~> 0'
42
44
  spec.add_dependency 'k_log', '~> 0'
43
45
  spec.add_dependency 'k_type', '~> 0'
44
46
  spec.add_dependency 'k_util', '~> 0'
45
47
  spec.add_dependency 'rubocop', '~> 1.8'
46
-
47
- spec.metadata['rubygems_mfa_required'] = 'true'
48
48
  end
@@ -175,9 +175,11 @@ module KBuilder
175
175
  def run_action(action)
176
176
  case action[:action]
177
177
  when :add_file
178
- add_file(action[:file], action[:opts])
178
+ add_file(action[:file], **action[:opts])
179
179
  when :delete_file
180
180
  delete_file(action[:file], action[:opts])
181
+ when :add_clipboard
182
+ add_clipboard(action[:opts])
181
183
  when :vscode
182
184
  vscode(action[:file_parts], action[:opts])
183
185
  when :browse
@@ -208,7 +210,7 @@ module KBuilder
208
210
  def delete_file(file, **opts)
209
211
  full_file = target_file(file, **opts) # = opts.key?(:folder_key) ? target_file(file, folder: opts[:folder_key]) : target_file(file)
210
212
 
211
- File.delete(full_file) if File.exist?(full_file)
213
+ FileUtils.rm_rf(full_file)
212
214
 
213
215
  self
214
216
  end
@@ -267,6 +269,14 @@ module KBuilder
267
269
  end
268
270
  alias clipboard_copy add_clipboard
269
271
 
272
+ def add_clipboard_action(**opts)
273
+ {
274
+ action: :add_clipboard,
275
+ played: false,
276
+ opts: opts
277
+ }
278
+ end
279
+
270
280
  def vscode_action(*file_parts, folder_key: current_folder_key, file: nil)
271
281
  {
272
282
  action: :vscode,
@@ -507,9 +517,17 @@ module KBuilder
507
517
 
508
518
  template_content = use_template(**opts)
509
519
 
510
- Handlebars::Helpers::Template.render(template_content, opts) unless template_content.nil?
520
+ Handlebarsjs.render(template_content, opts) unless template_content.nil?
521
+ # Handlebars::Helpers::Template.render(template_content, opts) unless template_content.nil?
511
522
  end
512
523
 
524
+ # Usage
525
+ #
526
+ # @example
527
+ #
528
+ # Dir.chdir(k_builder.target_folders.get(:app)) do
529
+ # k_builder.run_cop('**/*.rb', fix_unsafe: true)
530
+ # end
513
531
  def run_cop(file, **opts)
514
532
  command = Commands::RuboCopCommand.new(file, builder: self, **opts)
515
533
  command.execute
@@ -32,7 +32,7 @@ module KBuilder
32
32
  ''
33
33
  end
34
34
 
35
- # Custom initialize_copy method for k_builder. This is called during clone
35
+ # Custom initialize_copy method for k_builder, this is called during clone
36
36
  def k_builder_initialize_copy(orig)
37
37
  @target_folders = orig.target_folders.clone
38
38
  @template_folders = orig.template_folders.clone
@@ -40,5 +40,4 @@ module KBuilder
40
40
  end
41
41
  end
42
42
 
43
- puts 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
44
43
  KConfig::Configuration.register(:k_builder, KBuilder::ConfigurationExtension)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KBuilder
4
- VERSION = '0.0.73'
4
+ VERSION = '0.0.77'
5
5
  end
data/lib/k_builder.rb CHANGED
@@ -17,14 +17,15 @@ require 'k_builder/commands/base_command'
17
17
  require 'k_builder/commands/rubo_cop_command'
18
18
  require 'k_builder/commands/code_syntax_highlighter_command'
19
19
 
20
- require 'handlebars/helpers/template'
20
+ require 'handlebarsjs'
21
+ # require 'handlebars/helpers/template'
21
22
 
22
23
  module KBuilder
23
24
  # raise KBuilder::Error, 'Sample message'
24
25
  class Error < StandardError; end
25
26
  end
26
27
 
27
- if ENV['KLUE_DEBUG']&.to_s&.downcase == 'true'
28
+ if ENV.fetch('KLUE_DEBUG', 'false').downcase == 'true'
28
29
  namespace = 'KBuilder::Version'
29
30
  file_path = $LOADED_FEATURES.find { |f| f.include?('k_builder/version') }
30
31
  version = KBuilder::VERSION.ljust(9)
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.73
4
+ version: 0.0.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-05 00:00:00.000000000 Z
11
+ date: 2022-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: handlebars-helpers
14
+ name: handlebarsjs
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: k_config
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
- rubygems_version: 3.2.33
167
+ rubygems_version: 3.1.6
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: K Builder provides various fluent builders for initializing applications