danthes 1.0.4 → 1.0.5

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 27e0f4f55cd741d5f62a313e52db507f1bbf433b
4
+ data.tar.gz: 372ff2271b39062cfb5a317f18c6e6fdae987b4f
5
+ SHA512:
6
+ metadata.gz: f5a8fb58b6b150c9f203cdb3893e23d3acb07d4b47ae9fb5ba4e474eb850ee8281263573099272dfa75df03ea81b3aecaf1633911b7bc9ea3a5c73d0f99fecba
7
+ data.tar.gz: 6daad290b612e2d8b96e340db92583b4d6698ce08be4a11c2c1347073f7a7fe143bfc9ea79b6ffd13abc764a3c583a3a85eec8272f9908228371e09df07758d1
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  .bundle
6
6
  app/assets/javascripts/compiled
7
7
  spec/coffeescripts/compiled
8
+ coverage
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ danthes
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  rvm:
2
- - 1.9.2
3
2
  - 1.9.3
3
+ - 2.0.0
4
+ - 2.1.1
4
5
  bundler_args: --without development
5
6
  before_script:
6
7
  - "export DISPLAY=:99.0"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # d'Anthès
2
2
 
3
+ ## 1.0.5 (May 19 2014)
4
+
5
+ * Added ERB support in configuration files
6
+
3
7
  ## 1.0.4 (February 25 2013)
4
8
 
5
9
  * Added possibility to activate Faye's subscription later on subscribe call
data/Gemfile CHANGED
@@ -5,7 +5,8 @@ gem 'rake'
5
5
  gem 'faye-redis'
6
6
  gem 'guard'
7
7
  gem 'guard-coffeescript'
8
- gem 'jasmine', '1.3.0'
8
+ gem 'jasmine'
9
9
  gem 'rspec'
10
10
  gem 'rspec-mocks'
11
11
  gem 'webmock'
12
+ gem 'coveralls', require: false
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # d'Anthès [![Build Status](https://secure.travis-ci.org/phenomena/danthes.png?branch=master)](http://travis-ci.org/phenomena/danthes)
1
+ # d'Anthès [![Build Status](https://secure.travis-ci.org/dotpromo/danthes.png?branch=master)](http://travis-ci.org/dotpromo/danthes)[![Code Climate](https://codeclimate.com/github/dotpromo/danthes.png)](https://codeclimate.com/github/dotpromo/danthes)[![Coverage Status](https://coveralls.io/repos/dotpromo/danthes/badge.png?branch=master)](https://coveralls.io/r/dotpromo/danthes)
2
2
 
3
3
  d'Anthès is a Ruby gem for use with Rails to publish and subscribe to messages through [Faye](http://faye.jcoglan.com/). It allows you to easily provide real-time updates through an open socket without tying up a Rails process. All channels are private so users can only listen to events you subscribe them to. Based on PrivatePub gem.
4
4
 
5
5
  ## Docs
6
6
 
7
- [Ruby](http://rubydoc.info/github/phenomena/danthes/frames)
7
+ [Ruby](http://rubydoc.info/github/dotpromo/danthes/frames)
8
8
 
9
- [CoffeeScript](https://github.com/phenomena/danthes/wiki/CoffeeScript-documentation)
9
+ [CoffeeScript](https://github.com/dotpromo/danthes/wiki/CoffeeScript-documentation)
10
10
 
11
11
  ## Setup
12
12
 
@@ -146,7 +146,7 @@ The `publish_to` method will send a post request to the Faye server (using `Net:
146
146
 
147
147
  ## Development & Feedback
148
148
 
149
- Questions or comments? Please use the [issue tracker](https://github.com/phenomena/danthes/issues). Tests can be run with `bundle` and `rake` commands.
149
+ Questions or comments? Please use the [issue tracker](https://github.com/dotpromo/danthes/issues). Tests can be run with `bundle` and `rake` commands.
150
150
 
151
151
  ## TODO
152
152
 
data/Rakefile CHANGED
@@ -4,6 +4,7 @@ require 'rspec/core/rake_task'
4
4
  require 'yaml'
5
5
  require 'jasmine'
6
6
  require 'coffee-script'
7
+ require 'bundler/gem_tasks'
7
8
  load 'jasmine/tasks/jasmine.rake'
8
9
 
9
10
  desc "Run RSpec"
@@ -11,7 +12,7 @@ RSpec::Core::RakeTask.new do |t|
11
12
  t.verbose = false
12
13
  end
13
14
 
14
- task :default => [:compile_js, :spec, "jasmine:ci"]
15
+ task :default => [:spec, :compile_js, "jasmine:ci"]
15
16
 
16
17
  def compile_coffee_script(file, path)
17
18
  source = File.read File.expand_path("#{path}/#{file}.coffee", __FILE__)
@@ -26,5 +27,5 @@ end
26
27
  desc "Compile coffeescript"
27
28
  task :compile_js do
28
29
  compile_coffee_script('danthes.js', '../app/assets/javascripts')
29
- compile_coffee_script('danthes_spec.js', '../spec/coffeescripts')
30
+ compile_coffee_script('danthesSpec.js', '../spec/coffeescripts')
30
31
  end
data/danthes.gemspec CHANGED
@@ -13,5 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.files = `git ls-files`.split($\)
14
14
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
15
15
  s.require_paths = ["lib"]
16
- s.add_dependency 'faye', '>= 0.8.0'
16
+ s.add_dependency 'faye', '>= 1.0.1'
17
+ s.add_dependency 'yajl-ruby', '~> 1.2.0'
17
18
  end
data/lib/danthes.rb CHANGED
@@ -35,7 +35,7 @@ module Danthes
35
35
 
36
36
  # Loads the configuration from a given YAML file
37
37
  def load_config(filename)
38
- yaml = ::YAML.load_file(filename)[env]
38
+ yaml = ::YAML.load(ERB.new(File.read(filename)).result)[env]
39
39
  raise ArgumentError, "The #{environment} environment does not exist in #{filename}" if yaml.nil?
40
40
  (yaml.keys - ACCEPTED_KEYS).each {|k| yaml.delete(k)}
41
41
  yaml.each {|k, v| config[k.to_sym] = v}
@@ -1,3 +1,3 @@
1
1
  module Danthes
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
@@ -4,8 +4,8 @@ describe "Danthes", ->
4
4
 
5
5
  signToChannel = (channel, addOptions = {}) ->
6
6
  sub = {callback: jasmine.createSpy(), errback: jasmine.createSpy()}
7
- faye = {subscribe: jasmine.createSpy().andReturn(sub)}
8
- spyOn(pub, 'faye').andCallFake (callback) ->
7
+ faye = {subscribe: jasmine.createSpy().and.returnValue(sub)}
8
+ spyOn(pub, 'faye').and.callFake (callback) ->
9
9
  callback(faye)
10
10
  options = {server: "server", channel: "#{channel}", timestamp: 1234567890, signature: '1234567890'}
11
11
  options['connect'] = addOptions['connect'] if addOptions['connect']?
@@ -158,7 +158,7 @@ describe "Danthes", ->
158
158
 
159
159
  it "adds subscription faye object into channel object", ->
160
160
  sub = {callback: jasmine.createSpy(), errback: jasmine.createSpy()}
161
- pub.fayeClient = {subscribe: jasmine.createSpy().andReturn(sub)}
161
+ pub.fayeClient = {subscribe: jasmine.createSpy().and.returnValue(sub)}
162
162
  options = {server: "server", channel: 'somechannel'}
163
163
  pub.sign(options)
164
164
  pub.subscribe("somechannel", jasmine.createSpy())
@@ -171,7 +171,7 @@ describe "Danthes", ->
171
171
  callback: (f) ->
172
172
  f()
173
173
  errback: jasmine.createSpy()
174
- pub.fayeClient = {subscribe: jasmine.createSpy().andReturn(sub)}
174
+ pub.fayeClient = {subscribe: jasmine.createSpy().and.returnValue(sub)}
175
175
  options = {server: "server", channel: 'somechannel'}
176
176
  pub.sign(options)
177
177
  connectSpy = jasmine.createSpy()
@@ -183,7 +183,7 @@ describe "Danthes", ->
183
183
  callback: jasmine.createSpy()
184
184
  errback: (f) ->
185
185
  f('error')
186
- pub.fayeClient = {subscribe: jasmine.createSpy().andReturn(sub)}
186
+ pub.fayeClient = {subscribe: jasmine.createSpy().and.returnValue(sub)}
187
187
  erroSpy = jasmine.createSpy()
188
188
  options = {server: "server", channel: 'somechannel'}
189
189
  pub.sign(options)
@@ -192,7 +192,7 @@ describe "Danthes", ->
192
192
 
193
193
  it "removes subscription to the channel", ->
194
194
  sub = {callback: jasmine.createSpy(), errback: jasmine.createSpy(), cancel: jasmine.createSpy()}
195
- pub.fayeClient = {subscribe: jasmine.createSpy().andReturn(sub)}
195
+ pub.fayeClient = {subscribe: jasmine.createSpy().and.returnValue(sub)}
196
196
  options = {server: "server", channel: 'somechannel'}
197
197
  pub.sign(options)
198
198
  pub.subscribe('somechannel', jasmine.createSpy())
@@ -202,7 +202,7 @@ describe "Danthes", ->
202
202
 
203
203
  it "removes all subscription to the channels", ->
204
204
  sub = {callback: jasmine.createSpy(), errback: jasmine.createSpy(), cancel: jasmine.createSpy()}
205
- pub.fayeClient = {subscribe: jasmine.createSpy().andReturn(sub)}
205
+ pub.fayeClient = {subscribe: jasmine.createSpy().and.returnValue(sub)}
206
206
  options = {server: "server", channel: 'somechannel'}
207
207
  pub.sign(options)
208
208
  pub.subscribe "somechannel", jasmine.createSpy()
data/spec/danthes_spec.rb CHANGED
@@ -17,7 +17,7 @@ describe Danthes do
17
17
 
18
18
  it "defaults subscription timestamp to current time in milliseconds" do
19
19
  time = Time.now
20
- Time.stub!(:now).and_return(time)
20
+ Time.stub(:now).and_return(time)
21
21
  Danthes.subscription[:timestamp].should eq((time.to_f * 1000).round)
22
22
  end
23
23
 
@@ -30,6 +30,13 @@ describe Danthes do
30
30
  config[:adapter].should eq('thin')
31
31
  end
32
32
 
33
+ it "loads configuration file with erb via load_config" do
34
+ ENV['DANTHES_SERVER'] = "http://example.com"
35
+ Danthes.env = 'production'
36
+ Danthes.load_config("spec/fixtures/danthes_with_erb.yml")
37
+ config[:server].should eq("http://example.com")
38
+ end
39
+
33
40
  context "when redis config exists" do
34
41
  before do
35
42
  Danthes.env = 'test'
@@ -130,7 +137,7 @@ describe Danthes do
130
137
  it "it should use HTTPS if the server URL says so" do
131
138
  Danthes.config[:server] = "https://localhost"
132
139
  Danthes.config[:mount] = '/faye/path'
133
- http = mock(:http).as_null_object
140
+ http = double(:http).as_null_object
134
141
 
135
142
  Net::HTTP.should_receive(:new).and_return(http)
136
143
  http.should_receive(:use_ssl=).with(true)
@@ -140,7 +147,7 @@ describe Danthes do
140
147
 
141
148
  it "it should not use HTTPS if the server URL says not to" do
142
149
  Danthes.config[:server] = "http://localhost"
143
- http = mock(:http).as_null_object
150
+ http = double(:http).as_null_object
144
151
 
145
152
  Net::HTTP.should_receive(:new).and_return(http)
146
153
  http.should_receive(:use_ssl=).with(false)
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: thin
3
+ server: http://dev.local:9292/faye
4
+ secret_token: DEVELOPMENT_SECRET_TOKEN
5
+ signature_expiration: 600
6
+ production:
7
+ adapter: thin
8
+ server: <%= ENV['DANTHES_SERVER'] %>
9
+ secret_token: PRODUCTION_SECRET_TOKEN
10
+ signature_expiration: 600
@@ -3,4 +3,7 @@ src_dir: app/assets/javascripts/compiled
3
3
  src_files:
4
4
  - danthes.js
5
5
 
6
- spec_dir: spec/coffeescripts/compiled
6
+ spec_dir: spec/coffeescripts/compiled
7
+
8
+ spec_files:
9
+ - danthesSpec.js
@@ -0,0 +1,12 @@
1
+ #Use this file to set/override Jasmine configuration options
2
+ #You can remove it if you don't need it.
3
+ #This file is loaded *after* jasmine.yml is interpreted.
4
+ #
5
+ #Example: using a different boot file.
6
+ Jasmine.configure do |config|
7
+ config.ci_port = 8888
8
+ # config.boot_dir = '/absolute/path/to/boot_dir'
9
+ # config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
10
+ end
11
+ #
12
+
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,8 @@ require 'bundler/setup'
3
3
  require 'faye'
4
4
  require 'faye/redis'
5
5
  Bundler.require(:default)
6
+ require 'coveralls'
7
+ Coveralls.wear!
6
8
  require 'webmock/rspec'
7
9
  RSpec.configure do |config|
8
10
  end
metadata CHANGED
@@ -1,32 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danthes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
5
- prerelease:
4
+ version: 1.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alexander Simonov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-25 00:00:00.000000000 Z
11
+ date: 2014-05-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: faye
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: 0.8.0
19
+ version: 1.0.1
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
- version: 0.8.0
26
+ version: 1.0.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: yajl-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.0
30
41
  description: Private pub/sub messaging in Rails through Faye. More Faye features supported.
31
42
  Based on PrivatePub.
32
43
  email:
@@ -37,7 +48,8 @@ extra_rdoc_files: []
37
48
  files:
38
49
  - .gitignore
39
50
  - .rspec
40
- - .rvmrc
51
+ - .ruby-gemset
52
+ - .ruby-version
41
53
  - .travis.yml
42
54
  - CHANGELOG.md
43
55
  - Gemfile
@@ -58,46 +70,45 @@ files:
58
70
  - lib/generators/templates/danthes.ru
59
71
  - lib/generators/templates/danthes.yml
60
72
  - lib/generators/templates/danthes_redis.yml
61
- - spec/coffeescripts/danthes_spec.js.coffee
73
+ - spec/coffeescripts/danthesSpec.js.coffee
62
74
  - spec/danthes/faye_extension_spec.rb
63
75
  - spec/danthes_spec.rb
64
76
  - spec/fixtures/danthes.yml
65
77
  - spec/fixtures/danthes_redis.yml
78
+ - spec/fixtures/danthes_with_erb.yml
66
79
  - spec/javascripts/support/jasmine.yml
67
- - spec/javascripts/support/jasmine_config.rb
68
- - spec/javascripts/support/jasmine_runner.rb
80
+ - spec/javascripts/support/jasmine_helper.rb
69
81
  - spec/spec_helper.rb
70
82
  homepage: http://github.com/phenomena/danthes
71
83
  licenses: []
84
+ metadata: {}
72
85
  post_install_message:
73
86
  rdoc_options: []
74
87
  require_paths:
75
88
  - lib
76
89
  required_ruby_version: !ruby/object:Gem::Requirement
77
- none: false
78
90
  requirements:
79
- - - ! '>='
91
+ - - '>='
80
92
  - !ruby/object:Gem::Version
81
93
  version: '0'
82
94
  required_rubygems_version: !ruby/object:Gem::Requirement
83
- none: false
84
95
  requirements:
85
- - - ! '>='
96
+ - - '>='
86
97
  - !ruby/object:Gem::Version
87
98
  version: '0'
88
99
  requirements: []
89
100
  rubyforge_project:
90
- rubygems_version: 1.8.24
101
+ rubygems_version: 2.2.2
91
102
  signing_key:
92
- specification_version: 3
103
+ specification_version: 4
93
104
  summary: Private pub/sub messaging through Faye.
94
105
  test_files:
95
- - spec/coffeescripts/danthes_spec.js.coffee
106
+ - spec/coffeescripts/danthesSpec.js.coffee
96
107
  - spec/danthes/faye_extension_spec.rb
97
108
  - spec/danthes_spec.rb
98
109
  - spec/fixtures/danthes.yml
99
110
  - spec/fixtures/danthes_redis.yml
111
+ - spec/fixtures/danthes_with_erb.yml
100
112
  - spec/javascripts/support/jasmine.yml
101
- - spec/javascripts/support/jasmine_config.rb
102
- - spec/javascripts/support/jasmine_runner.rb
113
+ - spec/javascripts/support/jasmine_helper.rb
103
114
  - spec/spec_helper.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.3@danthes --create
@@ -1,24 +0,0 @@
1
- module Jasmine
2
- require 'yaml'
3
- class Config
4
-
5
- # Add your overrides or custom config code here
6
-
7
- end
8
- end
9
-
10
-
11
- # Note - this is necessary for rspec2, which has removed the backtrace
12
- module Jasmine
13
- class SpecBuilder
14
- def declare_spec(parent, spec)
15
- me = self
16
- example_name = spec["name"]
17
- @spec_ids << spec["id"]
18
- backtrace = @example_locations[parent.description + " " + example_name]
19
- parent.it example_name, {} do
20
- me.report_spec(spec["id"])
21
- end
22
- end
23
- end
24
- end
@@ -1,33 +0,0 @@
1
- $:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
2
-
3
- require 'rubygems'
4
- require 'yaml'
5
- require 'jasmine'
6
- jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
7
- require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
8
- if Jasmine::Dependencies.rspec2?
9
- require 'rspec'
10
- else
11
- require 'spec'
12
- end
13
-
14
- jasmine_config = Jasmine::Config.new
15
- spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
16
-
17
- should_stop = false
18
-
19
- if Jasmine::Dependencies.rspec2?
20
- RSpec.configuration.after(:suite) do
21
- spec_builder.stop if should_stop
22
- end
23
- else
24
- Spec::Runner.configure do |config|
25
- config.after(:suite) do
26
- spec_builder.stop if should_stop
27
- end
28
- end
29
- end
30
-
31
- spec_builder.start
32
- should_stop = true
33
- spec_builder.declare_suites