pernalonga 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 2971eb305cf694d9ec9bf172ef12d7aff02ce78c
4
- data.tar.gz: 745bf77cbccf1f85168adc5e36225d6fc6c4a769
3
+ metadata.gz: c29d1ca4fdc34ace351150461dc1269db89bb85a
4
+ data.tar.gz: cf358ae823946b36db4013b55deeb14a5c3fd0eb
5
5
  SHA512:
6
- metadata.gz: 8f6e6757f2c373023f3d7b3b95765aaaeca39911ab2a9677368008b09c4d5c956dc3830b3ebbd2d05d23b0aea36d28739f11634163c29a49eabf7bb7f0f0d3d4
7
- data.tar.gz: f99f254eadd8b606096f45e12dcd30cb10078fe8e89ab0b84538e77f806051248384621bfd04d865f1cea6abcd3cf7451945b921265494807a0e124868b6f697
6
+ metadata.gz: aeaeff18675f630e4e9aca1e513b3d9ea626c1e94639bcb90f2b79c4caa8c3e7455f468291b808c6d45ce9ae25871f53d91e2ead9346a4fb8aa18ab3699352fb
7
+ data.tar.gz: 9f86db90cfda347e1f910bca496d8801cde7546e016861a1805413a9129a3eedf16068630cdd4f50cdc3ce81eaad9c3a6585fd15f4b5420261fb1d5e65a21e2d
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .env
data/README.md CHANGED
@@ -1,8 +1,32 @@
1
- # Pernalonga
1
+ # Pernalonga [![Code Climate](https://codeclimate.com/github/fellipebrito/pernalonga/badges/gpa.svg)](https://codeclimate.com/github/fellipebrito/pernalonga) [![Test Coverage](https://codeclimate.com/github/fellipebrito/pernalonga/badges/coverage.svg)](https://codeclimate.com/github/fellipebrito/pernalonga/coverage)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pernalonga`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Pernalonga is a simple wrapper for the Ruby gem Bunny. While Bunny has all classes and methods for utilizing an AMQP queuing system, the code for doing so can take up a lot of space and tends to be repeated across many projects.
4
+
5
+ ## Usage
6
+ Pernalonga sets up the logic of publishing and subscribing to queues and processing messages.
7
+
8
+ ### Connection Configuration
9
+ Your connection configurations must be environment variables.
10
+
11
+ Pernalonga uses [dotenv](https://github.com/bkeepers/dotenv) to autoload any information you have in a .env file.
12
+
13
+ A sample .env file would contain the following required variables.
14
+ ```
15
+ BUNNY_USER=abc
16
+ BUNNY_VHOST=abc
17
+ BUNNY_PASSWORD=abc
18
+ BUNNY_HOST=abc
19
+ ```
20
+
21
+ ### Consuming
22
+ You don’t have to setup all the Bunny objects for Connections, Channels and Queues and arrange your message processing logic within them.
23
+
24
+ Instead, the only required thing is to simply implement a `process_message` method in your class. This way, once you call `Pernalonga.consume self, "queue_name"` to process messages from a queue, Pernalonga will call back your `process_message` method passing the message as the unique parameter.
25
+
26
+ ### Enqueuing
27
+ To enqueue messages
28
+ just use `Pernalonga.enqueue "queue_name" message`.
4
29
 
5
- TODO: Delete this and the text above, and describe your gem
6
30
 
7
31
  ## Installation
8
32
 
@@ -20,10 +44,6 @@ Or install it yourself as:
20
44
 
21
45
  $ gem install pernalonga
22
46
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
47
  ## Development
28
48
 
29
49
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -32,7 +52,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
52
 
33
53
  ## Contributing
34
54
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pernalonga.
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/fellipebrito/pernalonga.
36
56
 
37
57
 
38
58
  ## License
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new
5
5
 
6
- task :default => :spec
7
- task :test => :spec
6
+ task default: :spec
7
+ task test: :spec
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "pernalonga"
3
+ require 'bundler/setup'
4
+ require 'pernalonga'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "pernalonga"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
@@ -13,7 +13,7 @@ module Pernalonga
13
13
  .subscribe(consumer_tag: 'pernalonga',
14
14
  block: true,
15
15
  manual_ack: true) do |delivery_info, _metadata, msg = q.pop|
16
- process_message msg
16
+ klass.process_message msg
17
17
  ch.acknowledge(delivery_info.delivery_tag, false)
18
18
  end
19
19
  end
@@ -36,9 +36,5 @@ module Pernalonga
36
36
  def connect_channel
37
37
  Bunny.new(connection_parameters).start.create_channel
38
38
  end
39
-
40
- def process_message(message)
41
- fail 'You must implement a custom process_message method' unless @klass.process_message(message)
42
- end
43
39
  end
44
40
  end
@@ -1,3 +1,3 @@
1
1
  module Pernalonga
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'.freeze
3
3
  end
@@ -4,24 +4,26 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'pernalonga/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "pernalonga"
7
+ spec.name = 'pernalonga'
8
8
  spec.version = Pernalonga::VERSION
9
- spec.authors = ["Fellipe Brito"]
10
- spec.email = ["fellipe@devlandia.net"]
9
+ spec.authors = ['Fellipe Brito']
10
+ spec.email = ['fellipe@devlandia.net']
11
11
 
12
- spec.summary = %q{Provide a wrapper to Rabbit+Bunny enqueuement system.}
13
- spec.description = %q{Provide a wrapper to Rabbit+Bunny enqueuement system.}
12
+ spec.summary = 'Provide a wrapper to Rabbit+Bunny enqueuement system.'
13
+ spec.description = 'Provide a wrapper to Rabbit+Bunny enqueuement system.'
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
- spec.bindir = "exe"
16
+ spec.bindir = 'exe'
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
- spec.require_paths = ["lib"]
18
+ spec.require_paths = ['lib']
19
19
 
20
- spec.add_development_dependency "bundler", "~> 1.11"
21
- spec.add_development_dependency "rake", "~> 10.0"
22
- spec.add_development_dependency "rspec", "~> 3.0"
23
- spec.add_development_dependency "rubocop"
20
+ spec.add_development_dependency 'bundler', '~> 1.11'
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'rspec', '~> 3.0'
23
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4.8'
24
+ spec.add_development_dependency 'rubocop', '~> 0.36.0'
25
+ spec.add_development_dependency 'simplecov', '~> 0.11.1'
24
26
 
25
- spec.add_runtime_dependency 'dotenv'
26
- spec.add_runtime_dependency 'bunny'
27
+ spec.add_runtime_dependency 'dotenv', '2.1.0'
28
+ spec.add_runtime_dependency 'bunny', '2.2.2'
27
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pernalonga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fellipe Brito
@@ -52,48 +52,76 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.4.8
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.4.8
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rubocop
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.36.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.36.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
60
88
  - !ruby/object:Gem::Version
61
- version: '0'
89
+ version: 0.11.1
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - ">="
94
+ - - "~>"
67
95
  - !ruby/object:Gem::Version
68
- version: '0'
96
+ version: 0.11.1
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: dotenv
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - ">="
101
+ - - '='
74
102
  - !ruby/object:Gem::Version
75
- version: '0'
103
+ version: 2.1.0
76
104
  type: :runtime
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - ">="
108
+ - - '='
81
109
  - !ruby/object:Gem::Version
82
- version: '0'
110
+ version: 2.1.0
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: bunny
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - ">="
115
+ - - '='
88
116
  - !ruby/object:Gem::Version
89
- version: '0'
117
+ version: 2.2.2
90
118
  type: :runtime
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - ">="
122
+ - - '='
95
123
  - !ruby/object:Gem::Version
96
- version: '0'
124
+ version: 2.2.2
97
125
  description: Provide a wrapper to Rabbit+Bunny enqueuement system.
98
126
  email:
99
127
  - fellipe@devlandia.net