symphony 0.12.5 → 0.13.0.pre.20200309182558

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: 3b574d82a0376c4f397afddcd8eef820cd089d22e4c2cc09e6374cf0e9227ff5
4
- data.tar.gz: 291e18181eaf8bf4484e8dc438123a28bd5bd07af506adff81235f3a98224861
3
+ metadata.gz: 692186739c647bd3b2e8432fa790a7a7de05fd23457ecb1377b0ab659477ff48
4
+ data.tar.gz: d42b13e3b7c1b49c3c25c5b238c81d3f8e8f585b700180971dd75733440dab88
5
5
  SHA512:
6
- metadata.gz: 20f2a6bf4785239e01b82b05b2ea7c252aeaf8553656a170c738bc32965f9a62c65a8a374969420cb00a3c58ecefa90b0214b828dcdfe95c827f73ba4a3749be
7
- data.tar.gz: 5c162e6316d2f10ce7e5c416c60a2c88275ac38f6186fe90c3e48536f1dc86d8b806699dafa74873be39335a6ccb706d5b2a597a7e252aa1c2560816c12f6e85
6
+ metadata.gz: 37c090c9ac2067ad330122835f29c5c99cb9f5766090f8e402afb9fc19db02458c14bd0e60e4969abf1b6f1b154407e475714b750704b2618b026aebdb86b7be
7
+ data.tar.gz: 32125c9739cf2aa3fce83b128b22b1af19eeac054d20df45edf593756c488b82d144634e8dba533585559583d6d5a1d7cfcbbfa9a21a2c28fb16dc347d52689c
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,19 @@
1
+ = Release History for symphony
2
+
3
+ ---
4
+
5
+ == v0.13.0 [2020-03-09] Michael Granger <ged@faeriemud.org>
6
+
7
+ Improvements:
8
+
9
+ - Remove Yajl dependency in favor of stdlib json.
10
+ - Update for Ruby 2.7
11
+
12
+ Changes:
13
+
14
+ - Requires Ruby 2.6+
15
+
16
+
1
17
  == v0.12.5 [2019-07-16] Michael Granger <ged@FaerieMUD.org>
2
18
 
3
19
  Improvements:
data/Manifest.txt CHANGED
@@ -1,8 +1,7 @@
1
1
  .simplecov
2
- ChangeLog
3
2
  History.rdoc
4
3
  Manifest.txt
5
- README.rdoc
4
+ README.md
6
5
  Rakefile
7
6
  UPGRADING.md
8
7
  USAGE.rdoc
@@ -1,10 +1,16 @@
1
- = symphony
1
+ # symphony
2
2
 
3
- wiki:: http://bitbucket.org/ged/symphony
4
- docs:: http://deveiate.org/code/symphony
3
+ home
4
+ : https://hg.sr.ht/~ged/symphony
5
5
 
6
+ docs
7
+ : https://deveiate.org/code/symphony
6
8
 
7
- == Description
9
+ github
10
+ : https://github.com/ged/symphony
11
+
12
+
13
+ ## Description
8
14
 
9
15
  Symphony is a subscription-based asynchronous job system. It
10
16
  allows you to define jobs that watch for lightweight events from a
@@ -21,7 +27,7 @@ symphony-task::
21
27
  require the process management that the symphony daemon provides.
22
28
 
23
29
 
24
- == Synopsis
30
+ ## Synopsis
25
31
 
26
32
  class WorkerTask < Symphony::Task
27
33
  # Process all events
@@ -37,28 +43,33 @@ symphony-task::
37
43
  For a more detailed description of usage, please refer to the USAGE document.
38
44
 
39
45
 
40
- == Installation
46
+ ## Installation
41
47
 
42
48
  gem install symphony
43
49
 
44
50
 
45
- == Contributing
51
+ ## Contributing
46
52
 
47
53
  You can check out the current development source with Mercurial via its
48
- {project page}[http://bitbucket.org/ged/symphony]. Or if you prefer Git, via
49
- {its Github mirror}[https://github.com/ged/symphony].
54
+ [project page](https://hg.sr.ht/~ged/symphony). Or if you prefer Git, via
55
+ [its Github mirror](https://github.com/ged/symphony).
50
56
 
51
57
  After checking out the source, run:
52
58
 
53
- $ rake newb
59
+ $ rake setup
60
+
61
+ This task will install dependencies, and do any other necessary developer setup.
62
+
63
+
64
+ ## Authors
54
65
 
55
- This task will install any missing dependencies, run the tests/specs,
56
- and generate the API documentation.
66
+ - Michael Granger <ged@faeriemud.org>
67
+ - Mahlon E. Smith <mahlon@martini.nu>
57
68
 
58
69
 
59
- == License
70
+ ## License
60
71
 
61
- Copyright (c) 2011-2015, Michael Granger and Mahlon E. Smith
72
+ Copyright (c) 2011-2020, Michael Granger and Mahlon E. Smith
62
73
  All rights reserved.
63
74
 
64
75
  Redistribution and use in source and binary forms, with or without
data/Rakefile CHANGED
@@ -1,79 +1,10 @@
1
- #!/usr/bin/env rake
1
+ #!/usr/bin/env ruby -S rake
2
2
 
3
- begin
4
- require 'hoe'
5
- rescue LoadError
6
- abort "This Rakefile requires hoe (gem install hoe)"
7
- end
8
-
9
- GEMSPEC = 'symphony.gemspec'
10
-
11
-
12
- Hoe.plugin :mercurial
13
- Hoe.plugin :signing
14
- Hoe.plugin :deveiate
15
-
16
- Hoe.plugins.delete :rubyforge
17
-
18
- hoespec = Hoe.spec 'symphony' do |spec|
19
- spec.readme_file = 'README.rdoc'
20
- spec.history_file = 'History.rdoc'
21
- spec.extra_rdoc_files = FileList[ '*.rdoc' ]
22
- spec.spec_extras[:rdoc_options] = ['-f', 'fivefish', '-t', 'Symphony']
23
- spec.spec_extras[:required_rubygems_version] = '>= 2.0.3'
24
- spec.license 'BSD'
25
-
26
- spec.developer 'Michael Granger', 'ged@FaerieMUD.org'
27
- spec.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
28
-
29
- spec.dependency 'configurability', '~> 3.1'
30
- spec.dependency 'loggability', '~> 0.11'
31
- spec.dependency 'pluggability', '~> 0.4'
32
- spec.dependency 'bunny', '~> 2.0'
33
- spec.dependency 'sysexits', '~> 1.1'
34
- spec.dependency 'yajl-ruby', '~> 1.3'
35
- spec.dependency 'msgpack', '~> 1.0'
36
- spec.dependency 'metriks', '~> 0.9'
37
- spec.dependency 'rusage', '~> 0.2'
38
-
39
- spec.dependency 'rspec', '~> 3.0', :developer
40
- spec.dependency 'simplecov', '~> 0.8', :developer
41
- spec.dependency 'timecop', '~> 0.8', :developer
42
-
43
- spec.require_ruby_version( '>=2.0.0' )
44
- spec.hg_sign_tags = true if spec.respond_to?( :hg_sign_tags= )
3
+ require 'rake/deveiate'
45
4
 
46
- self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
5
+ Rake::DevEiate.setup( 'symphony' ) do |project|
6
+ project.publish_to = 'deveiate:/usr/local/www/public/code'
7
+ project.required_ruby_version = '~> 2.6'
47
8
  end
48
9
 
49
- # Fix some Hoe retardedness
50
- hoespec.spec.files.delete( '.gemtest' )
51
- ENV['VERSION'] ||= hoespec.spec.version.to_s
52
-
53
- # Run the tests before checking in
54
- task 'hg:precheckin' => [ :check_history, :check_manifest, :gemspec, :spec ]
55
-
56
- # Rebuild the ChangeLog immediately before release
57
- task :prerelease => 'ChangeLog'
58
- CLOBBER.include( 'ChangeLog' )
59
-
60
- desc "Build a coverage report"
61
- task :coverage do
62
- ENV["COVERAGE"] = 'yes'
63
- Rake::Task[:spec].invoke
64
- end
65
-
66
-
67
- task :gemspec => GEMSPEC
68
- file GEMSPEC => hoespec.spec.files do |task|
69
- spec = $hoespec.spec
70
- spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
71
- File.open( task.name, 'w' ) do |fh|
72
- fh.write( spec.to_ruby )
73
- end
74
- end
75
-
76
- task :default => :gemspec
77
-
78
- CLOBBER.include( GEMSPEC.to_s )
79
10
 
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'configurability'
5
5
  require 'loggability'
@@ -248,7 +248,7 @@ class Symphony::Daemon
248
248
  self.log.info "Restarting task group for %p" % [ task_class ]
249
249
  group.max_workers = max
250
250
  group.restart_workers
251
- end
251
+ end
252
252
 
253
253
 
254
254
  ### Shut down the workers for the specified task group.
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'rusage'
5
5
  require 'metriks'
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
 
5
5
  module Symphony
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'loggability'
5
5
 
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'symphony'
5
5
 
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'loggability'
5
5
  require 'symphony' unless defined?( Symphony )
data/lib/symphony/task.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'set'
5
5
  require 'sysexits'
@@ -7,7 +7,7 @@ require 'pluggability'
7
7
  require 'loggability'
8
8
 
9
9
  require 'msgpack'
10
- require 'yajl'
10
+ require 'json'
11
11
  require 'yaml'
12
12
 
13
13
  require 'symphony' unless defined?( Symphony )
@@ -47,6 +47,14 @@ class Symphony::Task
47
47
  plugin_prefixes 'symphony/tasks'
48
48
 
49
49
 
50
+ @queue = nil
51
+ @acknowledge = true
52
+ @routing_keys = Set.new
53
+ @prefetch = 10
54
+ @persistent = false
55
+ @always_rebind = false
56
+
57
+
50
58
  ### Create a new Task object and listen for work. Exits with the code returned
51
59
  ### by #start when it's done.
52
60
  def self::run( exit_on_idle=false )
@@ -79,11 +87,14 @@ class Symphony::Task
79
87
  def self::inherited( subclass )
80
88
  super
81
89
 
90
+ subclass.instance_variable_set( :@queue, nil )
91
+ subclass.instance_variable_set( :@always_rebind, false )
82
92
  subclass.instance_variable_set( :@routing_keys, Set.new )
83
93
  subclass.instance_variable_set( :@acknowledge, true )
84
94
  subclass.instance_variable_set( :@work_model, :longlived )
85
95
  subclass.instance_variable_set( :@prefetch, 10 )
86
96
  subclass.instance_variable_set( :@timeout_action, :reject )
97
+ subclass.instance_variable_set( :@timeout, nil )
87
98
  subclass.instance_variable_set( :@persistent, false )
88
99
  subclass.instance_variable_set( :@idle_timeout, DEFAULT_IDLE_TIMEOUT )
89
100
  end
@@ -438,7 +449,7 @@ class Symphony::Task
438
449
  when 'application/x-msgpack'
439
450
  MessagePack.unpack( payload )
440
451
  when 'application/json', 'text/javascript'
441
- Yajl::Parser.parse( payload )
452
+ JSON.parse( payload )
442
453
  when 'application/x-yaml', 'text/x-yaml'
443
454
  YAML.load( payload )
444
455
  else
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'set'
5
5
  require 'symphony/task_group' unless defined?( Symphony::TaskGroup )
@@ -96,7 +96,7 @@ class Symphony::TaskGroup::LongLived < Symphony::TaskGroup
96
96
  end
97
97
 
98
98
  return @queue
99
- rescue Bunny::NotFound, Bunny::ChannelAlreadyClosed => err
99
+ rescue Bunny::NotFound, Bunny::ChannelAlreadyClosed
100
100
  self.log.info "Child hasn't created the queue yet; deferring"
101
101
  Symphony::Queue.reset
102
102
 
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'symphony/task_group' unless defined?( Symphony::TaskGroup )
5
5
 
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'set'
5
5
  require 'pluggability'
data/lib/symphony.rb CHANGED
@@ -12,7 +12,7 @@ module Symphony
12
12
  Configurability
13
13
 
14
14
  # Library version constant
15
- VERSION = '0.12.5'
15
+ VERSION = '0.13.0'
16
16
 
17
17
  # Version-control revision constant
18
18
  REVISION = %q$Revision$
data/spec/helpers.rb CHANGED
@@ -48,6 +48,10 @@ module Symphony::SpecHelpers
48
48
  def initialize
49
49
  @queue = nil
50
50
  @exchange = nil
51
+ @open = true
52
+ end
53
+ def open?
54
+ return @open
51
55
  end
52
56
  def queue( name, opts={} )
53
57
  return @queue ||= DummySession::Queue.new( self )
@@ -60,7 +64,9 @@ module Symphony::SpecHelpers
60
64
  def number
61
65
  return 1
62
66
  end
63
- def close; end
67
+ def close
68
+ @open = false
69
+ end
64
70
  end
65
71
 
66
72
  class Exchange
@@ -86,14 +92,24 @@ end
86
92
 
87
93
  ### Mock with RSpec
88
94
  RSpec.configure do |config|
89
- config.run_all_when_everything_filtered = true
90
- config.filter_run :focus
91
- config.order = 'random'
92
- config.expect_with( :rspec )
93
- config.mock_with( :rspec ) do |mock|
94
- mock.syntax = :expect
95
+ config.expect_with :rspec do |expectations|
96
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
97
+ expectations.syntax = :expect
98
+ end
99
+
100
+ config.mock_with :rspec do |mocks|
101
+ mocks.verify_partial_doubles = true
95
102
  end
96
103
 
104
+ config.run_all_when_everything_filtered = true
105
+ config.filter_run_when_matching :focus
106
+ config.order = :random
107
+ config.example_status_persistence_file_path = 'spec/.state'
108
+ config.disable_monkey_patching!
109
+ config.warnings = true
110
+ config.profile_examples = 5
111
+
112
+
97
113
  config.include( Loggability::SpecHelpers )
98
114
  config.include( Symphony::SpecHelpers )
99
115
  end
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  # vim: set noet nosta sw=4 ts=4 :
4
4
 
5
5
 
@@ -19,7 +19,7 @@ class Test3Task < Symphony::Task
19
19
  end
20
20
 
21
21
 
22
- describe Symphony::Daemon do
22
+ RSpec.describe Symphony::Daemon do
23
23
 
24
24
  before( :all ) do
25
25
  @pids = ( 200..65534 ).cycle
@@ -5,12 +5,16 @@ require_relative '../helpers'
5
5
  require 'symphony/mixins'
6
6
 
7
7
 
8
- describe Symphony, 'mixins' do
8
+ RSpec.describe Symphony, 'mixins' do
9
9
 
10
10
  describe Symphony::MethodUtilities, 'used to extend a class' do
11
11
 
12
12
  let!( :extended_class ) do
13
- klass = Class.new
13
+ klass = Class.new do
14
+ def initialize
15
+ @foo = nil
16
+ end
17
+ end
14
18
  klass.extend( Symphony::MethodUtilities )
15
19
  klass
16
20
  end
@@ -4,7 +4,7 @@ require_relative '../helpers'
4
4
 
5
5
  require 'symphony/queue'
6
6
 
7
- describe Symphony::Queue do
7
+ RSpec.describe Symphony::Queue do
8
8
 
9
9
 
10
10
  before( :each ) do
@@ -7,7 +7,7 @@ require 'symphony'
7
7
  require 'symphony/routing'
8
8
 
9
9
 
10
- describe Symphony::Routing do
10
+ RSpec.describe Symphony::Routing do
11
11
 
12
12
  let( :task_class ) do
13
13
  Class.new( Symphony::Task ) do
@@ -5,7 +5,7 @@ require_relative '../helpers'
5
5
  require 'symphony/statistics'
6
6
 
7
7
 
8
- describe Symphony::Statistics do
8
+ RSpec.describe Symphony::Statistics do
9
9
 
10
10
 
11
11
  let( :including_class ) do
@@ -4,7 +4,7 @@ require_relative '../../helpers'
4
4
 
5
5
  require 'symphony/task_group/longlived'
6
6
 
7
- describe Symphony::TaskGroup::LongLived do
7
+ RSpec.describe Symphony::TaskGroup::LongLived do
8
8
 
9
9
  FIRST_PID = 414
10
10
 
@@ -5,7 +5,7 @@ require_relative '../../helpers'
5
5
  require 'symphony/task_group/oneshot'
6
6
 
7
7
 
8
- describe Symphony::TaskGroup::Oneshot do
8
+ RSpec.describe Symphony::TaskGroup::Oneshot do
9
9
 
10
10
  let( :task ) do
11
11
  Class.new( Symphony::Task ) do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative '../helpers'
4
4
 
5
- describe Symphony::TaskGroup do
5
+ RSpec.describe Symphony::TaskGroup do
6
6
 
7
7
  let( :task ) do
8
8
  Class.new( Symphony::Task ) do
@@ -4,7 +4,7 @@ require_relative '../helpers'
4
4
 
5
5
  require 'symphony/task'
6
6
 
7
- describe Symphony::Task do
7
+ RSpec.describe Symphony::Task do
8
8
 
9
9
  before( :all ) do
10
10
  Symphony::Queue.configure
@@ -70,7 +70,7 @@ describe Symphony::Task do
70
70
  end
71
71
  end
72
72
  let( :payload ) {{ "the" => "payload" }}
73
- let( :serialized_payload ) { Yajl.dump(payload) }
73
+ let( :serialized_payload ) { JSON.generate(payload) }
74
74
  let( :metadata ) {{ :content_type => 'application/json' }}
75
75
  let( :queue ) do
76
76
  obj = Symphony::Queue.for_task( task_class )
@@ -6,7 +6,7 @@ require 'rspec'
6
6
  require 'symphony'
7
7
 
8
8
 
9
- describe Symphony do
9
+ RSpec.describe Symphony do
10
10
 
11
11
  before( :each ) do
12
12
  ENV.delete( 'SYMPHONY_CONFIG' )
data.tar.gz.sig CHANGED
Binary file