charyf 0.2.9 → 0.2.10

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
  SHA1:
3
- metadata.gz: 7c18514711153530b6ec38086d043116a9fe43f4
4
- data.tar.gz: bd3695d976533447bf9a1c822ccc9289c4ba4f07
3
+ metadata.gz: 9b99229b9888f43029d9e51373d9df530df31265
4
+ data.tar.gz: 5abf44d14306c35517f165fa367e07205f6d1366
5
5
  SHA512:
6
- metadata.gz: 1e0e95b6362d59a34a67bf2eef0ed2d4de4de2042892ff6b7e9a8d599a42ba123028f7b1b4cd10b20b2e9fac19308530122e24060c01e1b2690bc050d1efd37c
7
- data.tar.gz: 6704b0af876f06ba75609ef1e6c477f3377d47435f002769e0bb30cf6618c50c747299cfd814d5344333c204c4c7fe11030e379b7b891a17f0ff7ef1652876ab
6
+ metadata.gz: 11388a95f19750048153a6e31804ad7fcf3603ff6c3fb58d1ca4817acfbb88b97b376661ee17980e7282b355ba8740ffdc81447fcbcf10f822d2baeb1cd79baf
7
+ data.tar.gz: 4752b08207fee648489bb475da0786956e4ee3e337b05ad9b1a178ee875b612cc80aa4ef5ace4c72ccfa697939781eb317d6cb4de6aa6d00ab73f6b57eec8337
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- charyf (0.2.9)
5
- charyf_sig (~> 1.1.2)
4
+ charyf (0.2.10)
6
5
  colorize (~> 0.8)
7
6
  i18n (~> 0.9)
8
7
  thor (>= 0.18.1, < 2.0)
@@ -10,7 +9,6 @@ PATH
10
9
  GEM
11
10
  remote: https://rubygems.org/
12
11
  specs:
13
- charyf_sig (1.1.2)
14
12
  coderay (1.1.2)
15
13
  colorize (0.8.1)
16
14
  concurrent-ruby (1.0.5)
@@ -33,7 +33,6 @@ Gem::Specification.new do |spec|
33
33
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
34
 
35
35
  # Internal dependencies
36
- spec.add_runtime_dependency 'charyf_sig', '~> 1.1.2'
37
36
 
38
37
  # External dependencies
39
38
  spec.add_runtime_dependency 'i18n', '~> 0.9'
@@ -1,9 +1,2 @@
1
- # Signature checking
2
- if %w(development test).include?((ENV['CHARYF_ENV'] || 'development').downcase) || ENV['ENABLE_SIG']
3
- require 'charyf_sig'
4
- else
5
- require 'charyf_sig/none'
6
- end
7
-
8
1
  # I18n
9
2
  require 'i18n'
@@ -28,7 +28,6 @@ module Charyf
28
28
 
29
29
  protected
30
30
 
31
- sig [{text: ['String','NilClass'], render: ['Symbol', 'String', 'NilClass']}], nil,
32
31
  def reply(
33
32
  text: nil,
34
33
  html: nil,
@@ -30,7 +30,6 @@ module Charyf
30
30
 
31
31
  end # End of ClassMethods
32
32
 
33
- # TODO sig
34
33
  def response_folder
35
34
  return nil if skill.nil?
36
35
 
@@ -48,12 +47,10 @@ module Charyf
48
47
  end
49
48
  end
50
49
 
51
- # TODO sig
52
50
  def responses_for(action)
53
51
  Dir[response_folder.join("#{action}**")]
54
52
  end
55
53
 
56
- # TODO sig
57
54
  def render_text_response(action)
58
55
  file_path = response_folder.join("#{action}.txt.erb")
59
56
 
@@ -62,7 +59,6 @@ module Charyf
62
59
  _render_sample_response file_path
63
60
  end
64
61
 
65
- # TODO sig
66
62
  def render_html_response(action)
67
63
  file_path = response_folder.join("#{action}.html.erb")
68
64
 
@@ -84,12 +80,10 @@ module Charyf
84
80
  end
85
81
 
86
82
 
87
- # TODO sig
88
83
  def controller_path
89
84
  controller_name.underscore
90
85
  end
91
86
 
92
- # TODO sig
93
87
  def exists?(path)
94
88
  File.exists?(path)
95
89
  end
@@ -63,7 +63,6 @@ module Charyf
63
63
  self.class.routes
64
64
  end
65
65
 
66
- sig ['Charyf::Engine::Context'], nil,
67
66
  def spawn_controller(context)
68
67
 
69
68
  Charyf.logger.flow_request("[FLOW] Dispatching request [#{context.request.inspect}]" +
@@ -25,7 +25,6 @@ module Charyf
25
25
  # NOP
26
26
  end
27
27
 
28
- sig_self ['String', 'Charyf::Engine::Response'], nil,
29
28
  def self.reply(conversation_id, message_id, response)
30
29
  interface = _interfaces[conversation_id]
31
30
  raise InvalidConversationError.new("No program interface found for conversation #{conversation_id}") unless interface
@@ -33,7 +32,6 @@ module Charyf
33
32
  interface.reply(response)
34
33
  end
35
34
 
36
- sig_self ['String', 'Proc'], 'Charyf::Interface::Program',
37
35
  def self.create(conversation_id, handler)
38
36
  interface = self.new(conversation_id, handler)
39
37
 
@@ -46,24 +44,20 @@ module Charyf
46
44
  @_interfaces ||= Hash.new
47
45
  end
48
46
 
49
- sig [nil, 'Proc'],
50
47
  def initialize(conversation_id, handler)
51
48
 
52
49
  @handler = handler
53
50
  @conversation_id = conversation_id.to_s
54
51
  end
55
52
 
56
- sig ['Charyf::Engine::Request'],
57
53
  def process(request)
58
54
  self.class.dispatcher.dispatch(request)
59
55
  end
60
56
 
61
- sig ['Charyf::Engine::Response'],
62
57
  def reply(response)
63
58
  handler.call(response)
64
59
  end
65
60
 
66
- sig [], 'Charyf::Engine::Request',
67
61
  def request
68
62
  Charyf::Engine::Request.new(self.class, conversation_id, SecureRandom.hex)
69
63
  end
@@ -8,7 +8,6 @@ module Charyf
8
8
 
9
9
 
10
10
  # Module -> anything of type Charyf::Interface::Base
11
- # sig ['Module', 'String'], nil,
12
11
  def initialize(referer, conversation_id, message_id)
13
12
  @referer = referer
14
13
  @conversation_id = conversation_id
@@ -11,12 +11,10 @@ module Charyf
11
11
 
12
12
  include Charyf::Strategy::BaseClass
13
13
 
14
- sig ['Charyf::Engine::Request'], ['Charyf::Engine::Session', 'NilClass'],
15
14
  def process(request)
16
15
  raise Charyf::Utils::NotImplemented.new
17
16
  end
18
17
 
19
- sig_self [], ['Charyf::Engine::Session::Processor::Base'],
20
18
  def self.get
21
19
  raise Charyf::Utils::NotImplemented.new
22
20
  end
@@ -7,7 +7,6 @@ module Charyf
7
7
  attr_reader :uuid, :skill, :controller, :action, :timestamp
8
8
 
9
9
  # TODO - mention it could return nil
10
- # TODO sig
11
10
  def self.get(uuid)
12
11
  yaml = _storage.get(uuid)
13
12
  yaml ? YAML.load(yaml) : nil
@@ -45,7 +44,6 @@ module Charyf
45
44
  self.class._storage.store(@uuid, YAML.dump(self))
46
45
  end
47
46
 
48
- sig [], ['Symbol', 'String', 'NilClass'],
49
47
  def full_controller_name
50
48
  @controller.blank? ? nil : @skill.camelize + '::' + @controller.camelize
51
49
  end
@@ -8,7 +8,6 @@ module Charyf
8
8
 
9
9
  module ClassMethods
10
10
 
11
- sig ['String', 'Symbol', 'NilClass'], ['Symbol'],
12
11
  def skill_name(name = nil)
13
12
  if name
14
13
  @_name = name.to_sym
@@ -64,7 +64,6 @@ module Charyf
64
64
  instance_eval(&block)
65
65
  end
66
66
 
67
- # TODO sig, nullable
68
67
  def session_processor
69
68
  # TODO resolve dependency on engine - maybe move the base classes to utils?
70
69
  klass = Charyf::Engine::Session::Processor.list[config.session_processor]
@@ -105,7 +104,6 @@ module Charyf
105
104
  klass
106
105
  end
107
106
 
108
- # TODO sig, nullable
109
107
  def storage_provider
110
108
  klass = Charyf::Utils::StorageProvider.list[config.storage_provider]
111
109
  raise Charyf::Utils::InvalidConfiguration.new("No storage provider with name '#{config.storage_provider}' found") unless klass
@@ -9,7 +9,6 @@ module Charyf
9
9
 
10
10
  class << self
11
11
 
12
- # Sig does not handle blocks
13
12
  def state(name, default: false, final: false, action: nil, &block)
14
13
  if default
15
14
  raise DefaultExists.new if @_default_state
@@ -11,22 +11,18 @@ module Charyf
11
11
 
12
12
  include Charyf::Strategy::BaseClass
13
13
 
14
- sig_self [['Module', 'String']], ['Charyf::Utils::StorageProvider::Base'],
15
14
  def self.get_for(klass)
16
15
  raise Charyf::Utils::NotImplemented.new
17
16
  end
18
17
 
19
- sig [nil], [nil],
20
18
  def get(key)
21
19
  raise Charyf::Utils::NotImplemented.new
22
20
  end
23
21
 
24
- sig [nil, nil], [nil],
25
22
  def store(key, value)
26
23
  raise Charyf::Utils::NotImplemented.new
27
24
  end
28
25
 
29
- sig [nil], [nil],
30
26
  def remove(key)
31
27
  raise Charyf::Utils::NotImplemented.new
32
28
  end
@@ -54,7 +54,6 @@ module Charyf
54
54
  }
55
55
  end
56
56
 
57
- sig_self ['Symbol', 'Hash'], ['TrueClass', 'FalseClass'],
58
57
  def self.match_action_filters?(name, filters = {only: [], except: []} )
59
58
  (filters[:only] == :all && !filters[:except].include?(name)) ||
60
59
  ((filters[:only] != :all) && (filters[:only] || []).include?(name))
@@ -11,7 +11,7 @@ module Charyf
11
11
  module VERSION
12
12
  MAJOR = 0
13
13
  MINOR = 2
14
- TINY = 9
14
+ TINY = 10
15
15
  PRE = nil
16
16
 
17
17
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
data/todo.md CHANGED
@@ -1,5 +1,4 @@
1
1
  * remove all imports, everything should import what is needed
2
- * remove sig -> too many problems
3
2
  * dispatcher - sync vs async
4
3
  * only one reply, however allow sends to the same interface
5
4
  * this should add a message id to request
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charyf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Ludvigh
@@ -10,20 +10,6 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2018-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: charyf_sig
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 1.1.2
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 1.1.2
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: i18n
29
15
  requirement: !ruby/object:Gem::Requirement