charyf 0.2.7 → 0.2.8
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/Gemfile.lock +1 -1
- data/lib/charyf/utils/app_engine.rb +2 -1
- data/lib/charyf/utils/configuration.rb +12 -2
- data/lib/charyf/utils/generators.rb +5 -4
- data/lib/charyf/utils/generators/app/app_generator.rb +2 -0
- data/lib/charyf/utils/generators/app_base.rb +20 -0
- data/lib/charyf/utils/generators/installers/installers_generator.rb +44 -0
- data/lib/charyf/utils/generators/skill/hooks_generator.rb +37 -0
- data/lib/charyf/utils/generators/skill/skill_generator.rb +1 -1
- data/lib/charyf/version.rb +1 -1
- metadata +4 -3
- data/lib/charyf/utils/generators/intents/intents_generator.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cfa0cfb7f56db44ae90413b60cc7a4e52efbcb9
|
4
|
+
data.tar.gz: 66ab9d05c60b4b7fec8f7f0fd35fbf1f6ac6154e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7678c7af6c8606b78880d4bbc44407eb2a16264ceb083b3f3da58be733862b73a6246b6a9a34e581874c675c4617a8513eb89b3a9fede55fe21fc78ea749b0a9
|
7
|
+
data.tar.gz: 124617de56346b73fa8b3285e707fd12cc9dedc858052ee5bd73ebf7fdc9d9a7563567d48066b73b3a6d109a06b68f750e4aba507831a2cbc4fc13fec6ae834b
|
data/Gemfile.lock
CHANGED
@@ -14,7 +14,8 @@ module Charyf
|
|
14
14
|
|
15
15
|
require_relative 'generators/app/app_generator'
|
16
16
|
require_relative 'generators/skill/skill_generator'
|
17
|
-
require_relative 'generators/
|
17
|
+
require_relative 'generators/skill/hooks_generator'
|
18
|
+
require_relative 'generators/installers/installers_generator'
|
18
19
|
|
19
20
|
run_generators_blocks(app)
|
20
21
|
self
|
@@ -2,11 +2,21 @@ module Charyf
|
|
2
2
|
module Configuration
|
3
3
|
|
4
4
|
class Generators #:nodoc:
|
5
|
-
|
6
|
-
|
5
|
+
attr_reader :hidden_namespaces, :installers, :skill_hooks
|
6
|
+
|
7
|
+
def options
|
8
|
+
dup = @options.dup
|
9
|
+
dup[:charyf] ||= {}
|
10
|
+
dup[:installers] = @installers
|
11
|
+
dup[:skill_hooks] = @skill_hooks
|
12
|
+
|
13
|
+
dup
|
14
|
+
end
|
7
15
|
|
8
16
|
def initialize
|
9
17
|
@hidden_namespaces = []
|
18
|
+
@installers = []
|
19
|
+
@skill_hooks = []
|
10
20
|
@options = Hash.new { |h, k| h[k] = {} }
|
11
21
|
end
|
12
22
|
|
@@ -9,14 +9,15 @@ module Charyf
|
|
9
9
|
module Generators
|
10
10
|
include Charyf::Command::Behavior
|
11
11
|
|
12
|
-
REMOVED_GENERATORS = %w(app cli_app
|
12
|
+
REMOVED_GENERATORS = %w(app cli_app skill_hooks installers)
|
13
13
|
|
14
14
|
|
15
15
|
DEFAULT_ALIASES = {}
|
16
16
|
|
17
17
|
DEFAULT_OPTIONS = {
|
18
18
|
charyf: {
|
19
|
-
|
19
|
+
# Skill hooks: true => allows automatic call for all hooks when generating new skill
|
20
|
+
skill_hooks: true
|
20
21
|
}
|
21
22
|
}
|
22
23
|
|
@@ -95,6 +96,8 @@ module Charyf
|
|
95
96
|
namespaces = public_namespaces
|
96
97
|
namespaces.sort!
|
97
98
|
|
99
|
+
hidden_namespaces.each { |n| namespaces.delete(n.to_s) }
|
100
|
+
|
98
101
|
groups = Hash.new { |h, k| h[k] = [] }
|
99
102
|
namespaces.each do |namespace|
|
100
103
|
base = namespace.split(":").first
|
@@ -105,8 +108,6 @@ module Charyf
|
|
105
108
|
charyf.map! { |n| n.sub(/^charyf:/, "") }
|
106
109
|
REMOVED_GENERATORS.map { |name| charyf.delete(name) }
|
107
110
|
|
108
|
-
hidden_namespaces.each { |n| groups.delete(n.to_s) }
|
109
|
-
|
110
111
|
[[ "charyf", charyf ]] + groups.sort.to_a
|
111
112
|
end
|
112
113
|
|
@@ -255,6 +255,22 @@ module Charyf
|
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
|
+
def charyf_command(command)
|
259
|
+
say_status :run, "charyf #{command}"
|
260
|
+
|
261
|
+
_charyf_command = Gem.bin_path("charyf", "charyf")
|
262
|
+
|
263
|
+
require "bundler"
|
264
|
+
Bundler.with_clean_env do
|
265
|
+
full_command = %Q["#{Gem.ruby}" "#{_charyf_command}" #{command}]
|
266
|
+
if options[:quiet]
|
267
|
+
system(full_command, out: File::NULL)
|
268
|
+
else
|
269
|
+
system(full_command)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
258
274
|
def bundle_install?
|
259
275
|
!(options[:skip_gemfile] || options[:skip_bundle] || options[:pretend])
|
260
276
|
end
|
@@ -263,6 +279,10 @@ module Charyf
|
|
263
279
|
bundle_command("install") if bundle_install?
|
264
280
|
end
|
265
281
|
|
282
|
+
def run_installers
|
283
|
+
charyf_command("generate installers") if bundle_install?
|
284
|
+
end
|
285
|
+
|
266
286
|
def empty_directory_with_keep_file(destination, config = {})
|
267
287
|
empty_directory(destination, config)
|
268
288
|
keep_file(destination)
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../app_base'
|
4
|
+
require_relative '../named_base'
|
5
|
+
|
6
|
+
require_relative '../../generators'
|
7
|
+
|
8
|
+
require_relative '../../../support'
|
9
|
+
|
10
|
+
module Charyf
|
11
|
+
module Generators
|
12
|
+
class InstallersGenerator < Base # :nodoc:
|
13
|
+
|
14
|
+
def info_msg
|
15
|
+
say_status behavior, "Running all hooked installers", :green
|
16
|
+
puts ''
|
17
|
+
end
|
18
|
+
|
19
|
+
def try
|
20
|
+
hooked_generators.each do |generator_name|
|
21
|
+
names = generator_name.to_s.split(":")
|
22
|
+
klass = Charyf::Generators.find_by_namespace(names.pop, names.any? && names.join(":"))
|
23
|
+
|
24
|
+
if klass
|
25
|
+
say_status behavior, generator_name, :green
|
26
|
+
|
27
|
+
invoke generator_name, [], options.merge(autorun: true), behavior: behavior
|
28
|
+
else
|
29
|
+
say_status behavior, "#{generator_name} generator not found", :red
|
30
|
+
end
|
31
|
+
|
32
|
+
puts ''
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def hooked_generators
|
39
|
+
(Charyf::Generators.options[:installers] || []).compact.map(&:downcase)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../app_base'
|
4
|
+
require_relative '../named_base'
|
5
|
+
|
6
|
+
require_relative '../../generators'
|
7
|
+
|
8
|
+
require_relative '../../../support'
|
9
|
+
|
10
|
+
module Charyf
|
11
|
+
module Generators
|
12
|
+
class SkillHooksGenerator < NamedBase # :nodoc:
|
13
|
+
|
14
|
+
def try
|
15
|
+
hooked_generators.each do |generator_name|
|
16
|
+
names = generator_name.to_s.split(":")
|
17
|
+
klass = Charyf::Generators.find_by_namespace(names.pop, names.any? && names.join(":"))
|
18
|
+
|
19
|
+
if klass
|
20
|
+
say_status behavior, generator_name, :green
|
21
|
+
|
22
|
+
invoke generator_name, [name], options, behavior: behavior
|
23
|
+
else
|
24
|
+
say_status behavior, "#{generator_name} generator not found", :red
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def hooked_generators
|
32
|
+
(Charyf::Generators.options[:skill_hooks] || []).compact.map(&:downcase)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/charyf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: charyf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Ludvigh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: charyf_sig
|
@@ -231,8 +231,9 @@ files:
|
|
231
231
|
- lib/charyf/utils/generators/app/templates/gitignore
|
232
232
|
- lib/charyf/utils/generators/app_base.rb
|
233
233
|
- lib/charyf/utils/generators/defaults.rb
|
234
|
-
- lib/charyf/utils/generators/
|
234
|
+
- lib/charyf/utils/generators/installers/installers_generator.rb
|
235
235
|
- lib/charyf/utils/generators/named_base.rb
|
236
|
+
- lib/charyf/utils/generators/skill/hooks_generator.rb
|
236
237
|
- lib/charyf/utils/generators/skill/skill_generator.rb
|
237
238
|
- lib/charyf/utils/generators/skill/templates/controllers/skill_controller.rb.tt
|
238
239
|
- lib/charyf/utils/generators/skill/templates/module.rb.tt
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../app_base'
|
4
|
-
require_relative '../named_base'
|
5
|
-
|
6
|
-
require_relative '../../generators'
|
7
|
-
|
8
|
-
require_relative '../../../support'
|
9
|
-
|
10
|
-
module Charyf
|
11
|
-
module Generators
|
12
|
-
class IntentsGenerator < NamedBase # :nodoc:
|
13
|
-
|
14
|
-
def try
|
15
|
-
intent_generators.each do |generator_name|
|
16
|
-
names = generator_name(generator_name).to_s.split(":")
|
17
|
-
klass = Charyf::Generators.find_by_namespace(names.pop, names.any? && names.join(":"))
|
18
|
-
|
19
|
-
if klass
|
20
|
-
say_status behavior, generator_name(generator_name), :green
|
21
|
-
|
22
|
-
invoke generator_name(generator_name), [name], options, behavior: behavior
|
23
|
-
else
|
24
|
-
say_status behavior, "#{generator_name(generator_name)} generator not found", :red
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def intent_generators
|
32
|
-
(Charyf::Generators.options[:intents] || {}).keys.map(&:downcase)
|
33
|
-
end
|
34
|
-
|
35
|
-
def generator_name(intent_processor_name)
|
36
|
-
"#{intent_processor_name}:intent"
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|