flowdock 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ MIT-LICENSE
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.3
4
+ - jruby
data/Gemfile CHANGED
@@ -1,6 +1,14 @@
1
1
  source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
2
3
 
3
- # Specify your gem's dependencies in flowdock.gemspec
4
- gemspec
4
+ gem "httparty", "~>0.7.8"
5
5
 
6
- gem "rake"
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rdoc", ">= 2.4.2"
10
+ gem "rspec", "~> 2.6.0"
11
+ gem "webmock"
12
+ gem "bundler", "~> 1.0.0"
13
+ gem "jeweler", "~> 1.6.4"
14
+ end
data/Rakefile CHANGED
@@ -1,5 +1,43 @@
1
- require 'bundler/gem_tasks'
1
+ # encoding: utf-8
2
2
 
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "flowdock"
18
+ gem.homepage = "http://github.com/flowdock/flowdock-api"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Ruby Gem for using Flowdock's API}
21
+ gem.email = "team@flowdock.com"
22
+ gem.authors = ["Antti Pitkänen"]
23
+ # dependencies defined in Gemfile
24
+ end
25
+ Jeweler::RubygemsDotOrgTasks.new
26
+
27
+ require 'rspec/core'
3
28
  require 'rspec/core/rake_task'
29
+ RSpec::Core::RakeTask.new(:spec) do |spec|
30
+ spec.pattern = FileList['spec/**/*_spec.rb']
31
+ end
32
+
33
+ task :default => :spec
34
+
35
+ require 'rdoc/task'
36
+ RDoc::Task.new do |rdoc|
37
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
4
38
 
5
- RSpec::Core::RakeTask.new('spec')
39
+ rdoc.rdoc_dir = 'rdoc'
40
+ rdoc.title = "flowdock #{version}"
41
+ rdoc.rdoc_files.include('README*')
42
+ rdoc.rdoc_files.include('lib/**/*.rb')
43
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.5
@@ -1,23 +1,65 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
1
4
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "flowdock/version"
4
5
 
5
6
  Gem::Specification.new do |s|
6
- s.name = "flowdock"
7
- s.authors = ["anttipitkanen"]
8
- s.version = Flowdock::GEM_VERSION
9
- s.email = ["team@flowdock.com"]
10
- s.homepage = "https://www.flowdock.com/api"
11
- s.summary = %q{Ruby Gem for using Flowdock's API.}
7
+ s.name = "flowdock"
8
+ s.version = "0.1.5"
12
9
 
13
- s.rubyforge_project = "flowdock"
14
-
15
- s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Antti Pitk\303\244nen"]
12
+ s.date = "2011-11-08"
13
+ s.email = "team@flowdock.com"
14
+ s.extra_rdoc_files = [
15
+ "README"
16
+ ]
17
+ s.files = [
18
+ ".document",
19
+ ".rspec",
20
+ ".travis.yml",
21
+ "Gemfile",
22
+ "MIT-LICENSE",
23
+ "README",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "flowdock.gemspec",
27
+ "lib/flowdock.rb",
28
+ "lib/flowdock/capistrano.rb",
29
+ "spec/flowdock_spec.rb",
30
+ "spec/spec_helper.rb"
31
+ ]
32
+ s.homepage = "http://github.com/flowdock/flowdock-api"
33
+ s.licenses = ["MIT"]
18
34
  s.require_paths = ["lib"]
19
-
20
- s.add_dependency("httparty", "~>0.7.8")
21
- s.add_development_dependency("rspec")
22
- s.add_development_dependency("webmock", "~>1.6.0")
35
+ s.rubygems_version = "1.8.10"
36
+ s.summary = "Ruby Gem for using Flowdock's API"
37
+
38
+ if s.respond_to? :specification_version then
39
+ s.specification_version = 3
40
+
41
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
+ s.add_runtime_dependency(%q<httparty>, ["~> 0.7.8"])
43
+ s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
44
+ s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
45
+ s.add_development_dependency(%q<webmock>, [">= 0"])
46
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
48
+ else
49
+ s.add_dependency(%q<httparty>, ["~> 0.7.8"])
50
+ s.add_dependency(%q<rdoc>, [">= 2.4.2"])
51
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
52
+ s.add_dependency(%q<webmock>, [">= 0"])
53
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
54
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<httparty>, ["~> 0.7.8"])
58
+ s.add_dependency(%q<rdoc>, [">= 2.4.2"])
59
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
60
+ s.add_dependency(%q<webmock>, [">= 0"])
61
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
62
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
63
+ end
23
64
  end
65
+
@@ -27,7 +27,7 @@ module Flowdock
27
27
  raise InvalidParameterError, "Message must have both :subject and :content" if params[:subject].blank? || params[:content].blank?
28
28
 
29
29
  from = (params[:from].kind_of?(Hash)) ? params[:from] : @from
30
- raise InvalidParameterError, "Flow's :from attribute must have both :name and :address" if from[:name].blank? || from[:address].blank?
30
+ raise InvalidParameterError, "Flow's :from attribute must have :address attribute" if from[:address].blank?
31
31
 
32
32
  tags = (params[:tags].kind_of?(Array)) ? params[:tags] : []
33
33
  tags.reject! { |tag| !tag.kind_of?(String) || tag.blank? }
@@ -10,13 +10,13 @@ Capistrano::Configuration.instance(:must_exist).load do
10
10
  current_branch = capture("cat #{current_path}/BRANCH").chomp rescue "master"
11
11
  set :current_branch, current_branch
12
12
  end
13
-
13
+
14
14
  task :save_deployed_branch do
15
15
  run "echo '#{source.head}' > #{current_path}/BRANCH"
16
16
  end
17
-
17
+
18
18
  task :set_flowdock_api do
19
- set :rails_env, (!stage.nil?) ? stage : ENV['RAILS_ENV']
19
+ set :rails_env, variables.include?(:stage) ? stage : ENV['RAILS_ENV']
20
20
  set :repo, Grit::Repo.new(".")
21
21
  config = Grit::Config.new(repo)
22
22
  set :flowdock_api, Flowdock::Flow.new(:api_token => flowdock_api_token,
@@ -7,46 +7,53 @@ describe Flowdock do
7
7
  @flow = Flowdock::Flow.new(:api_token => "test", :source => "myapp")
8
8
  }.should_not raise_error
9
9
  end
10
-
10
+
11
11
  it "should succeed with correct token, source and sender information" do
12
12
  lambda {
13
13
  @flow = Flowdock::Flow.new(:api_token => "test", :source => "myapp",
14
14
  :from => {:name => "test", :address => "invalid@nodeta.fi"})
15
15
  }.should_not raise_error
16
16
  end
17
-
17
+
18
18
  it "should succeed with correct token, sender information, source and project" do
19
19
  lambda {
20
20
  @flow = Flowdock::Flow.new(:api_token => "test", :source => "myapp", :project => "myproject",
21
21
  :from => {:name => "test", :address => "invalid@nodeta.fi"})
22
22
  }.should_not raise_error
23
23
  end
24
-
24
+
25
+ it "should succeed without the optional from-name parameter" do
26
+ lambda {
27
+ @flow = Flowdock::Flow.new(:api_token => "test", :source => "myapp",
28
+ :from => {:address => "invalid@nodeta.fi"})
29
+ }.should_not raise_error
30
+ end
31
+
25
32
  it "should fail without token" do
26
33
  lambda {
27
34
  @flow = Flowdock::Flow.new(:api_token => "", :source => "myapp")
28
35
  }.should raise_error(Flowdock::Flow::InvalidParameterError)
29
36
  end
30
-
37
+
31
38
  it "should fail without source" do
32
39
  lambda {
33
40
  @flow = Flowdock::Flow.new(:api_token => "test", :source => "")
34
41
  }.should raise_error(Flowdock::Flow::InvalidParameterError)
35
42
  end
36
-
43
+
37
44
  it "should fail when source is not alphanumeric" do
38
45
  lambda {
39
46
  @flow = Flowdock::Flow.new(:api_token => "test", :source => "$foobar")
40
47
  }.should raise_error(Flowdock::Flow::InvalidParameterError)
41
48
  end
42
-
49
+
43
50
  it "should fail when project is not alphanumeric" do
44
51
  lambda {
45
52
  @flow = Flowdock::Flow.new(:api_token => "test", :source => "myapp", :project => "$foobar")
46
53
  }.should raise_error(Flowdock::Flow::InvalidParameterError)
47
54
  end
48
55
  end
49
-
56
+
50
57
  describe "with sending messages" do
51
58
  before(:each) do
52
59
  @token = "test"
@@ -54,26 +61,26 @@ describe Flowdock do
54
61
  :from => {:name => "Eric Example", :address => "eric@example.com"})
55
62
  @example_content = "<h1>Hello</h1>\n<p>Let's rock and roll!</p>"
56
63
  end
57
-
64
+
58
65
  it "should not send without subject" do
59
66
  lambda {
60
67
  @flow.send_message(:subject => "", :content => "Test")
61
68
  }.should raise_error(Flowdock::Flow::InvalidParameterError)
62
69
  end
63
-
70
+
64
71
  it "should not send without content" do
65
72
  lambda {
66
73
  @flow.send_message(:subject => "Test", :content => "")
67
74
  }.should raise_error(Flowdock::Flow::InvalidParameterError)
68
75
  end
69
-
76
+
70
77
  it "should not send without sender information" do
71
78
  @flow = Flowdock::Flow.new(:api_token => @token, :source => "myapp")
72
79
  lambda {
73
80
  @flow.send_message(:subject => "Test", :content => @example_content)
74
81
  }.should raise_error(Flowdock::Flow::InvalidParameterError)
75
82
  end
76
-
83
+
77
84
  it "should send with valid parameters and return true" do
78
85
  lambda {
79
86
  stub_request(:post, "#{Flowdock::FLOWDOCK_API_URL}/#{@token}").
@@ -94,7 +101,7 @@ describe Flowdock do
94
101
  :tags => ["cool", "stuff"], :link => "http://www.flowdock.com/").should be_true
95
102
  }.should_not raise_error
96
103
  end
97
-
104
+
98
105
  it "should allow overriding sender information per message" do
99
106
  lambda {
100
107
  stub_request(:post, "#{Flowdock::FLOWDOCK_API_URL}/#{@token}").
@@ -114,7 +121,7 @@ describe Flowdock do
114
121
  :from => {:name => "Test", :address => "invalid@nodeta.fi"}).should be_true
115
122
  }.should_not raise_error
116
123
  end
117
-
124
+
118
125
  it "should raise error if backend returns anything but 200 OK" do
119
126
  lambda {
120
127
  stub_request(:post, "#{Flowdock::FLOWDOCK_API_URL}/#{@token}").
@@ -1,9 +1,14 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
3
4
  require 'webmock/rspec'
4
5
 
5
6
  require 'flowdock'
6
7
 
8
+ # Requires supporting files with custom matchers and macros, etc,
9
+ # in ./support/ and its subdirectories.
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
11
+
7
12
  RSpec.configure do |config|
8
- # some (optional) config here
13
+
9
14
  end
metadata CHANGED
@@ -1,25 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flowdock
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
- - anttipitkanen
13
+ - "Antti Pitk\xC3\xA4nen"
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-26 00:00:00 Z
18
+ date: 2011-11-08 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: httparty
22
- prerelease: false
21
+ type: :runtime
23
22
  requirement: &id001 !ruby/object:Gem::Requirement
24
23
  none: false
25
24
  requirements:
@@ -31,12 +30,44 @@ dependencies:
31
30
  - 7
32
31
  - 8
33
32
  version: 0.7.8
34
- type: :runtime
33
+ prerelease: false
34
+ name: httparty
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: rspec
38
- prerelease: false
37
+ type: :development
39
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 27
44
+ segments:
45
+ - 2
46
+ - 4
47
+ - 2
48
+ version: 2.4.2
49
+ prerelease: false
50
+ name: rdoc
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ type: :development
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ hash: 23
60
+ segments:
61
+ - 2
62
+ - 6
63
+ - 0
64
+ version: 2.6.0
65
+ prerelease: false
66
+ name: rspec
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ type: :development
70
+ requirement: &id004 !ruby/object:Gem::Requirement
40
71
  none: false
41
72
  requirements:
42
73
  - - ">="
@@ -45,49 +76,66 @@ dependencies:
45
76
  segments:
46
77
  - 0
47
78
  version: "0"
48
- type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: webmock
52
79
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
80
+ name: webmock
81
+ version_requirements: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ type: :development
84
+ requirement: &id005 !ruby/object:Gem::Requirement
54
85
  none: false
55
86
  requirements:
56
87
  - - ~>
57
88
  - !ruby/object:Gem::Version
58
- hash: 15
89
+ hash: 23
59
90
  segments:
60
91
  - 1
61
- - 6
62
92
  - 0
63
- version: 1.6.0
93
+ - 0
94
+ version: 1.0.0
95
+ prerelease: false
96
+ name: bundler
97
+ version_requirements: *id005
98
+ - !ruby/object:Gem::Dependency
64
99
  type: :development
65
- version_requirements: *id003
100
+ requirement: &id006 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ~>
104
+ - !ruby/object:Gem::Version
105
+ hash: 7
106
+ segments:
107
+ - 1
108
+ - 6
109
+ - 4
110
+ version: 1.6.4
111
+ prerelease: false
112
+ name: jeweler
113
+ version_requirements: *id006
66
114
  description:
67
- email:
68
- - team@flowdock.com
115
+ email: team@flowdock.com
69
116
  executables: []
70
117
 
71
118
  extensions: []
72
119
 
73
- extra_rdoc_files: []
74
-
120
+ extra_rdoc_files:
121
+ - README
75
122
  files:
76
- - .gitignore
123
+ - .document
77
124
  - .rspec
125
+ - .travis.yml
78
126
  - Gemfile
79
127
  - MIT-LICENSE
80
128
  - README
81
129
  - Rakefile
130
+ - VERSION
82
131
  - flowdock.gemspec
83
132
  - lib/flowdock.rb
84
133
  - lib/flowdock/capistrano.rb
85
- - lib/flowdock/version.rb
86
134
  - spec/flowdock_spec.rb
87
135
  - spec/spec_helper.rb
88
- homepage: https://www.flowdock.com/api
89
- licenses: []
90
-
136
+ homepage: http://github.com/flowdock/flowdock-api
137
+ licenses:
138
+ - MIT
91
139
  post_install_message:
92
140
  rdoc_options: []
93
141
 
@@ -113,11 +161,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
161
  version: "0"
114
162
  requirements: []
115
163
 
116
- rubyforge_project: flowdock
164
+ rubyforge_project:
117
165
  rubygems_version: 1.8.10
118
166
  signing_key:
119
167
  specification_version: 3
120
- summary: Ruby Gem for using Flowdock's API.
121
- test_files:
122
- - spec/flowdock_spec.rb
123
- - spec/spec_helper.rb
168
+ summary: Ruby Gem for using Flowdock's API
169
+ test_files: []
170
+
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- .bundle
3
- pkg/*
4
- Gemfile.lock
@@ -1,3 +0,0 @@
1
- module Flowdock
2
- GEM_VERSION = "0.1.4"
3
- end