apphunk 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +5 -0
- data/README.rdoc +45 -2
- data/{TODO.rdoc → TODO} +0 -0
- data/VERSION +1 -1
- data/apphunk.gemspec +5 -35
- data/lib/apphunk.rb +29 -2
- data/lib/apphunk/config.rb +1 -1
- data/rails/init.rb +0 -2
- data/spec/apphunk_spec.rb +9 -9
- metadata +4 -34
- data/doc/apple-touch-icon.png +0 -0
- data/doc/classes/Apphunk.html +0 -294
- data/doc/classes/Apphunk/Config.html +0 -159
- data/doc/classes/Apphunk/Logger.html +0 -105
- data/doc/classes/Apphunk/Proxy.html +0 -196
- data/doc/classes/Apphunk/Remote.html +0 -117
- data/doc/classes/Apphunk/Remote/Result.html +0 -125
- data/doc/created.rid +0 -1
- data/doc/css/main.css +0 -263
- data/doc/css/panel.css +0 -383
- data/doc/css/reset.css +0 -53
- data/doc/favicon.ico +0 -0
- data/doc/files/LICENSE.html +0 -81
- data/doc/files/README_rdoc.html +0 -87
- data/doc/files/lib/apphunk/config_rb.html +0 -59
- data/doc/files/lib/apphunk/logger_rb.html +0 -59
- data/doc/files/lib/apphunk/proxy_rb.html +0 -68
- data/doc/files/lib/apphunk/remote/result_rb.html +0 -59
- data/doc/files/lib/apphunk/remote_rb.html +0 -70
- data/doc/files/lib/apphunk_rb.html +0 -66
- data/doc/i/arrows.png +0 -0
- data/doc/i/results_bg.png +0 -0
- data/doc/i/tree_bg.png +0 -0
- data/doc/index.html +0 -14
- data/doc/js/jquery-1.3.2.min.js +0 -19
- data/doc/js/jquery-effect.js +0 -593
- data/doc/js/main.js +0 -22
- data/doc/js/searchdoc.js +0 -628
- data/doc/panel/index.html +0 -71
- data/doc/panel/search_index.js +0 -1
- data/doc/panel/tree.js +0 -1
data/History.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -2,15 +2,58 @@
|
|
2
2
|
|
3
3
|
A library that posts messages to the remote logging service apphunk.com.
|
4
4
|
|
5
|
+
== Setup
|
6
|
+
|
7
|
+
Make sure you have a running instance of apphunkd on your machine:
|
8
|
+
gem install apphunkd
|
9
|
+
apphunkd start
|
10
|
+
|
11
|
+
The daemon acts as a proxy between your app(s) and apphunk.com.
|
12
|
+
It comes with init.d and monit scripts so you may want to check out its documentation: http://github.com/apphunk/apphunkd
|
13
|
+
|
14
|
+
Add the gem as dependency if you are on Rails 2.x
|
15
|
+
config.gem "apphunk"
|
16
|
+
|
17
|
+
or add it to you Gemfile for Rails 3 and pure Ruby:
|
18
|
+
gem "apphunk"
|
19
|
+
|
20
|
+
|
21
|
+
== Configuration
|
22
|
+
|
23
|
+
Use the Apphunk.config method to configure the behaviour of the Gem and its outgoing messages. (Note: Each option can be overriden by Apphunk.post’s option parameter.)
|
24
|
+
If the Gem is used as part of a Rails application, the configuration should go to config/initializers/apphunk.rb.
|
25
|
+
|
26
|
+
Apphunk.config do |config|
|
27
|
+
config.token = "secret_project_token"
|
28
|
+
end
|
29
|
+
|
30
|
+
For more information about the available configuration options, check the Rdoc: http://rdoc.info/projects/apphunk/apphunk (Apphunk::Config class).
|
31
|
+
|
32
|
+
== Usage
|
33
|
+
|
34
|
+
Sending messages is as easy as:
|
35
|
+
|
36
|
+
Apphunk.post("Hello World")
|
37
|
+
|
38
|
+
or
|
39
|
+
|
40
|
+
Apphunk.post("Do you like my tags?", :tags => 'hello, world, messages')
|
41
|
+
|
42
|
+
As noted above, each configuration option (Apphunk::Config) can be explicitly specified while posting a message:
|
43
|
+
|
44
|
+
Apphunk.post("Posting to another project", :token => 'another_projects_token')
|
45
|
+
|
46
|
+
|
47
|
+
More details: http://rdoc.info/projects/apphunk/apphunk (Apphunk class)
|
5
48
|
|
6
49
|
== Note on Patches/Pull Requests
|
7
50
|
|
8
51
|
* Fork the project.
|
9
52
|
* Make your feature addition or bug fix.
|
10
|
-
* Add
|
53
|
+
* Add specs for it. This is important so I don't break it in a future version unintentionally.
|
11
54
|
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
12
55
|
* Send me a pull request. Get bonus points for topic branches.
|
13
56
|
|
14
57
|
== Copyright
|
15
58
|
|
16
|
-
Copyright (c) 2009
|
59
|
+
Copyright (c) 2009 Andreas Wolff. See LICENSE for details.
|
data/{TODO.rdoc → TODO}
RENAMED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/apphunk.gemspec
CHANGED
@@ -5,16 +5,17 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{apphunk}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andreas Wolff"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-04-06}
|
13
13
|
s.description = %q{Apphunk is a library that allows your applications (currently only Ruby AND Rails) to send messages to Apphunk.com}
|
14
14
|
s.email = %q{andreas@apphunk.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
"README.rdoc"
|
17
|
+
"README.rdoc",
|
18
|
+
"TODO"
|
18
19
|
]
|
19
20
|
s.files = [
|
20
21
|
".document",
|
@@ -23,40 +24,9 @@ Gem::Specification.new do |s|
|
|
23
24
|
"LICENSE",
|
24
25
|
"README.rdoc",
|
25
26
|
"Rakefile",
|
26
|
-
"TODO
|
27
|
+
"TODO",
|
27
28
|
"VERSION",
|
28
29
|
"apphunk.gemspec",
|
29
|
-
"doc/apple-touch-icon.png",
|
30
|
-
"doc/classes/Apphunk.html",
|
31
|
-
"doc/classes/Apphunk/Config.html",
|
32
|
-
"doc/classes/Apphunk/Logger.html",
|
33
|
-
"doc/classes/Apphunk/Proxy.html",
|
34
|
-
"doc/classes/Apphunk/Remote.html",
|
35
|
-
"doc/classes/Apphunk/Remote/Result.html",
|
36
|
-
"doc/created.rid",
|
37
|
-
"doc/css/main.css",
|
38
|
-
"doc/css/panel.css",
|
39
|
-
"doc/css/reset.css",
|
40
|
-
"doc/favicon.ico",
|
41
|
-
"doc/files/LICENSE.html",
|
42
|
-
"doc/files/README_rdoc.html",
|
43
|
-
"doc/files/lib/apphunk/config_rb.html",
|
44
|
-
"doc/files/lib/apphunk/logger_rb.html",
|
45
|
-
"doc/files/lib/apphunk/proxy_rb.html",
|
46
|
-
"doc/files/lib/apphunk/remote/result_rb.html",
|
47
|
-
"doc/files/lib/apphunk/remote_rb.html",
|
48
|
-
"doc/files/lib/apphunk_rb.html",
|
49
|
-
"doc/i/arrows.png",
|
50
|
-
"doc/i/results_bg.png",
|
51
|
-
"doc/i/tree_bg.png",
|
52
|
-
"doc/index.html",
|
53
|
-
"doc/js/jquery-1.3.2.min.js",
|
54
|
-
"doc/js/jquery-effect.js",
|
55
|
-
"doc/js/main.js",
|
56
|
-
"doc/js/searchdoc.js",
|
57
|
-
"doc/panel/index.html",
|
58
|
-
"doc/panel/search_index.js",
|
59
|
-
"doc/panel/tree.js",
|
60
30
|
"lib/apphunk.rb",
|
61
31
|
"lib/apphunk/config.rb",
|
62
32
|
"lib/apphunk/logger.rb",
|
data/lib/apphunk.rb
CHANGED
@@ -71,7 +71,10 @@ module Apphunk
|
|
71
71
|
self.default_options[:tags] = Apphunk::Config.tags
|
72
72
|
self.default_options[:token] = Apphunk::Config.token
|
73
73
|
self.default_options[:trails] = Apphunk::Config.trails
|
74
|
-
|
74
|
+
|
75
|
+
unless Apphunk::Config.environments.nil?
|
76
|
+
self.default_options[:environments] = Apphunk::Config.environments
|
77
|
+
end
|
75
78
|
|
76
79
|
if Apphunk::Config.environment.nil? || Apphunk::Config.environment == ""
|
77
80
|
Apphunk::Config.environment = self.default_options[:environment]
|
@@ -80,5 +83,29 @@ module Apphunk
|
|
80
83
|
end
|
81
84
|
end
|
82
85
|
|
86
|
+
# Init configuration defaults
|
87
|
+
def init_defaults #:nodoc:
|
88
|
+
if env = rails_environment
|
89
|
+
Apphunk.default_options = {
|
90
|
+
:environment => env,
|
91
|
+
:environments => %w(production)
|
92
|
+
}
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Get the current rails environment if its Rails
|
97
|
+
def rails_environment #:nodoc:
|
98
|
+
case
|
99
|
+
when defined?(RAILS_ENV)
|
100
|
+
RAILS_ENV
|
101
|
+
when defined?(Rails.env)
|
102
|
+
Rails.env
|
103
|
+
else
|
104
|
+
nil
|
105
|
+
end
|
106
|
+
end
|
83
107
|
end
|
84
|
-
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
Apphunk.init_defaults
|
data/lib/apphunk/config.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Apphunk
|
2
2
|
|
3
|
-
# Used to configure the behaviour of Apphunk and its outgoing messages. Each option can be overriden by Apphunk.
|
3
|
+
# Used to configure the behaviour of Apphunk and its outgoing messages. Each option can be overriden by Apphunk.post's +option+ parameter.
|
4
4
|
# If Apphunk is used as part of a Rails application, the configuration should go to +config/initializers/apphunk.rb+.
|
5
5
|
#
|
6
6
|
# *Note*: The configuration must be set using Apphunk.config as shown in the example below.
|
data/rails/init.rb
CHANGED
data/spec/apphunk_spec.rb
CHANGED
@@ -4,58 +4,58 @@ describe "Apphunk" do
|
|
4
4
|
describe 'log' do
|
5
5
|
it 'should send the message to the apphunkd-proxy' do
|
6
6
|
Apphunk::Proxy.should_receive(:send_message_to_apphunkd).with("My Message", anything)
|
7
|
-
Apphunk.
|
7
|
+
Apphunk.post("My Message")
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should bypass all options' do
|
11
11
|
opts = { :tags => "Hello, World", :trails => { :user => '5', :account => '12' } }
|
12
12
|
Apphunk::Proxy.should_receive(:send_message_to_apphunkd).with("My Message", opts)
|
13
|
-
Apphunk.
|
13
|
+
Apphunk.post("My Message", opts)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should merge provided options with Apphunk.default_options' do
|
17
17
|
Apphunk::Proxy.should_receive(:send_message_to_apphunkd).with("My Message", { :tags => 'Hello', :trails => { :user => '5' }})
|
18
18
|
Apphunk.default_options = { :trails => { :user => '5' }}
|
19
|
-
Apphunk.
|
19
|
+
Apphunk.post("My Message", :tags => "Hello")
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should override Apphunk.default_options with provided options' do
|
23
23
|
Apphunk::Proxy.should_receive(:send_message_to_apphunkd).with("My Message", { :tags => 'Bye' })
|
24
24
|
Apphunk.default_options = { :tags => 'Hello'}
|
25
|
-
Apphunk.
|
25
|
+
Apphunk.post("My Message", :tags => "Bye")
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe 'log_with_options' do
|
30
30
|
it 'should yield the Apphunk module back to the block' do
|
31
|
-
Apphunk.
|
31
|
+
Apphunk.post_with_options do |apphunk|
|
32
32
|
apphunk.should == Apphunk
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should set Apphunk.default_options before yielding' do
|
37
|
-
Apphunk.
|
37
|
+
Apphunk.post_with_options(:tags => 'hello') do |apphunk|
|
38
38
|
apphunk.default_options.should == { :tags => 'hello'}
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should merge existing Apphunk.default_options and provided options' do
|
43
43
|
Apphunk.default_options = { :token => 'secret' }
|
44
|
-
Apphunk.
|
44
|
+
Apphunk.post_with_options(:tags => 'hello', :trails => { :user => '5' }) do |apphunk|
|
45
45
|
apphunk.default_options.should == { :tags => 'hello', :trails => { :user => '5'}, :token => 'secret'}
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should init the default_options hash on demand' do
|
50
50
|
Apphunk.default_options = nil
|
51
|
-
Apphunk.
|
51
|
+
Apphunk.post_with_options(:tags => "hallo") do |apphunk|
|
52
52
|
apphunk.should == Apphunk
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'should restore old default_options after yielding' do
|
57
57
|
Apphunk.default_options = { :token => 'secret' }
|
58
|
-
Apphunk.
|
58
|
+
Apphunk.post_with_options(:tags => "hallo") do |apphunk|
|
59
59
|
apphunk.should == Apphunk
|
60
60
|
end
|
61
61
|
Apphunk.default_options.should == { :token => 'secret' }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apphunk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Wolff
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-04-06 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,6 +51,7 @@ extensions: []
|
|
51
51
|
extra_rdoc_files:
|
52
52
|
- LICENSE
|
53
53
|
- README.rdoc
|
54
|
+
- TODO
|
54
55
|
files:
|
55
56
|
- .document
|
56
57
|
- .gitignore
|
@@ -58,40 +59,9 @@ files:
|
|
58
59
|
- LICENSE
|
59
60
|
- README.rdoc
|
60
61
|
- Rakefile
|
61
|
-
- TODO
|
62
|
+
- TODO
|
62
63
|
- VERSION
|
63
64
|
- apphunk.gemspec
|
64
|
-
- doc/apple-touch-icon.png
|
65
|
-
- doc/classes/Apphunk.html
|
66
|
-
- doc/classes/Apphunk/Config.html
|
67
|
-
- doc/classes/Apphunk/Logger.html
|
68
|
-
- doc/classes/Apphunk/Proxy.html
|
69
|
-
- doc/classes/Apphunk/Remote.html
|
70
|
-
- doc/classes/Apphunk/Remote/Result.html
|
71
|
-
- doc/created.rid
|
72
|
-
- doc/css/main.css
|
73
|
-
- doc/css/panel.css
|
74
|
-
- doc/css/reset.css
|
75
|
-
- doc/favicon.ico
|
76
|
-
- doc/files/LICENSE.html
|
77
|
-
- doc/files/README_rdoc.html
|
78
|
-
- doc/files/lib/apphunk/config_rb.html
|
79
|
-
- doc/files/lib/apphunk/logger_rb.html
|
80
|
-
- doc/files/lib/apphunk/proxy_rb.html
|
81
|
-
- doc/files/lib/apphunk/remote/result_rb.html
|
82
|
-
- doc/files/lib/apphunk/remote_rb.html
|
83
|
-
- doc/files/lib/apphunk_rb.html
|
84
|
-
- doc/i/arrows.png
|
85
|
-
- doc/i/results_bg.png
|
86
|
-
- doc/i/tree_bg.png
|
87
|
-
- doc/index.html
|
88
|
-
- doc/js/jquery-1.3.2.min.js
|
89
|
-
- doc/js/jquery-effect.js
|
90
|
-
- doc/js/main.js
|
91
|
-
- doc/js/searchdoc.js
|
92
|
-
- doc/panel/index.html
|
93
|
-
- doc/panel/search_index.js
|
94
|
-
- doc/panel/tree.js
|
95
65
|
- lib/apphunk.rb
|
96
66
|
- lib/apphunk/config.rb
|
97
67
|
- lib/apphunk/logger.rb
|
data/doc/apple-touch-icon.png
DELETED
Binary file
|
data/doc/classes/Apphunk.html
DELETED
@@ -1,294 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<title>Apphunk</title>
|
7
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
8
|
-
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
|
9
|
-
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
|
10
|
-
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
11
|
-
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
|
12
|
-
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
|
13
|
-
</head>
|
14
|
-
|
15
|
-
<body>
|
16
|
-
<div class="banner">
|
17
|
-
<h1>
|
18
|
-
<span class="type">Module</span>
|
19
|
-
Apphunk
|
20
|
-
|
21
|
-
</h1>
|
22
|
-
<ul class="files">
|
23
|
-
|
24
|
-
<li><a href="../files/lib/apphunk/config_rb.html">lib/apphunk/config.rb</a></li>
|
25
|
-
|
26
|
-
<li><a href="../files/lib/apphunk/logger_rb.html">lib/apphunk/logger.rb</a></li>
|
27
|
-
|
28
|
-
<li><a href="../files/lib/apphunk/proxy_rb.html">lib/apphunk/proxy.rb</a></li>
|
29
|
-
|
30
|
-
<li><a href="../files/lib/apphunk/remote/result_rb.html">lib/apphunk/remote/result.rb</a></li>
|
31
|
-
|
32
|
-
<li><a href="../files/lib/apphunk/remote_rb.html">lib/apphunk/remote.rb</a></li>
|
33
|
-
|
34
|
-
<li><a href="../files/lib/apphunk_rb.html">lib/apphunk.rb</a></li>
|
35
|
-
|
36
|
-
</ul>
|
37
|
-
</div>
|
38
|
-
<div id="bodyContent">
|
39
|
-
<div id="content">
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div class="sectiontitle">Methods</div>
|
50
|
-
<dl class="methods">
|
51
|
-
|
52
|
-
<dt>C</dt>
|
53
|
-
<dd>
|
54
|
-
<ul>
|
55
|
-
|
56
|
-
<li><a href="#M000008">config</a></li>
|
57
|
-
|
58
|
-
</ul>
|
59
|
-
</dd>
|
60
|
-
|
61
|
-
<dt>L</dt>
|
62
|
-
<dd>
|
63
|
-
<ul>
|
64
|
-
|
65
|
-
<li><a href="#M000006">log</a>,</li>
|
66
|
-
|
67
|
-
<li><a href="#M000007">log_with_options</a></li>
|
68
|
-
|
69
|
-
</ul>
|
70
|
-
</dd>
|
71
|
-
|
72
|
-
</dl>
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
<div class="sectiontitle">Classes and Modules</div>
|
81
|
-
<ul>
|
82
|
-
|
83
|
-
<li><span class="type">MODULE</span> <a href="Apphunk/Config.html">Apphunk::Config</a></li>
|
84
|
-
|
85
|
-
<li><span class="type">MODULE</span> <a href="Apphunk/Logger.html">Apphunk::Logger</a></li>
|
86
|
-
|
87
|
-
<li><span class="type">MODULE</span> <a href="Apphunk/Proxy.html">Apphunk::Proxy</a></li>
|
88
|
-
|
89
|
-
<li><span class="type">MODULE</span> <a href="Apphunk/Remote.html">Apphunk::Remote</a></li>
|
90
|
-
|
91
|
-
</ul>
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
<div class="sectiontitle">Attributes</div>
|
98
|
-
<table border='0' cellpadding='5'>
|
99
|
-
|
100
|
-
<tr valign='top'>
|
101
|
-
<td class='attr-rw'>
|
102
|
-
[RW]
|
103
|
-
</td>
|
104
|
-
<td class='attr-name'>default_options</td>
|
105
|
-
<td class='attr-desc'><p>
|
106
|
-
Default options to be used for <a
|
107
|
-
href="Apphunk.html#M000006">Apphunk.log</a>. Initialized by <a
|
108
|
-
href="Apphunk/Config.html">Apphunk::Config</a>.
|
109
|
-
</p></td>
|
110
|
-
</tr>
|
111
|
-
|
112
|
-
</table>
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
<div class="sectiontitle">Class Public methods</div>
|
117
|
-
|
118
|
-
<div class="method">
|
119
|
-
<div class="title" id="M000008">
|
120
|
-
|
121
|
-
<a name="M000008"></a><b>config</b>(&block)
|
122
|
-
|
123
|
-
</div>
|
124
|
-
|
125
|
-
<div class="description">
|
126
|
-
<p>
|
127
|
-
Set runtime configuration options
|
128
|
-
</p>
|
129
|
-
<p>
|
130
|
-
Yields <a href="Apphunk/Config.html">Apphunk::Config</a> which can be used
|
131
|
-
to set configuration options in one place. See <a
|
132
|
-
href="Apphunk/Config.html">Apphunk::Config</a> for a list of available
|
133
|
-
options. These options will be available in <a
|
134
|
-
href="Apphunk.html#default_options">Apphunk.default_options</a>.
|
135
|
-
</p>
|
136
|
-
<h4>Examples</h4>
|
137
|
-
<pre>
|
138
|
-
Apphunk.config do |config|
|
139
|
-
config.token = "secret_project_token"
|
140
|
-
config.environments = %w(staging production)
|
141
|
-
end
|
142
|
-
</pre>
|
143
|
-
|
144
|
-
</div>
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
<div class="sourcecode">
|
150
|
-
<p class="source-link">
|
151
|
-
Source: <a href="javascript:toggleSource('M000008_source')" id="l_M000008_source">show</a>
|
152
|
-
|
153
|
-
| <a href="http://github.com/apphunk/apphunk/blob/a37092d225a325b738783fba89641741a886e1ca/lib/apphunk.rb#L68" target="_blank" class="github_url">on GitHub</a>
|
154
|
-
|
155
|
-
</p>
|
156
|
-
<div id="M000008_source" class="dyn-source">
|
157
|
-
<pre><span class="ruby-comment cmt"># File lib/apphunk.rb, line 68</span>
|
158
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">config</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
159
|
-
<span class="ruby-keyword kw">yield</span> <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>
|
160
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>[<span class="ruby-identifier">:tags</span>] = <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">tags</span>
|
161
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>[<span class="ruby-identifier">:token</span>] = <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">token</span>
|
162
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>[<span class="ruby-identifier">:trails</span>] = <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">trails</span>
|
163
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>[<span class="ruby-identifier">:environments</span>] = <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">environments</span>
|
164
|
-
|
165
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">environment</span>.<span class="ruby-identifier">blank?</span>
|
166
|
-
<span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">environment</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>[<span class="ruby-identifier">:environment</span>]
|
167
|
-
<span class="ruby-keyword kw">else</span>
|
168
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>[<span class="ruby-identifier">:environment</span>] = <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Config</span>.<span class="ruby-identifier">environment</span>
|
169
|
-
<span class="ruby-keyword kw">end</span>
|
170
|
-
<span class="ruby-keyword kw">end</span></pre>
|
171
|
-
</div>
|
172
|
-
</div>
|
173
|
-
|
174
|
-
</div>
|
175
|
-
|
176
|
-
<div class="method">
|
177
|
-
<div class="title" id="M000006">
|
178
|
-
|
179
|
-
<a name="M000006"></a><b>log</b>(message, options = {})
|
180
|
-
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div class="description">
|
184
|
-
<p>
|
185
|
-
Sends a <tt>message</tt> to your remote inbox at apphunk.com
|
186
|
-
</p>
|
187
|
-
<ul>
|
188
|
-
<li><tt>message</tt> - The body of the message
|
189
|
-
|
190
|
-
</li>
|
191
|
-
<li><tt>options</tt> - A hash of options. Merges with <a
|
192
|
-
href="Apphunk.html#default_options">Apphunk.default_options</a>
|
193
|
-
|
194
|
-
</li>
|
195
|
-
</ul>
|
196
|
-
<p>
|
197
|
-
For a list of available options see <a
|
198
|
-
href="Apphunk/Config.html">Apphunk::Config</a>.
|
199
|
-
</p>
|
200
|
-
<h4>Examples</h4>
|
201
|
-
<pre>
|
202
|
-
Apphunk.log("Yet another hello world")
|
203
|
-
Apphunk.log("Tag me baby", :tags => 'apphunk, doc, examples', :trails => { :user_id => 5 })
|
204
|
-
Apphunk.log("I'm on my way to a different project", :token => 'secret_project_access_token')
|
205
|
-
</pre>
|
206
|
-
|
207
|
-
</div>
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
<div class="sourcecode">
|
213
|
-
<p class="source-link">
|
214
|
-
Source: <a href="javascript:toggleSource('M000006_source')" id="l_M000006_source">show</a>
|
215
|
-
|
216
|
-
| <a href="http://github.com/apphunk/apphunk/blob/a37092d225a325b738783fba89641741a886e1ca/lib/apphunk.rb#L28" target="_blank" class="github_url">on GitHub</a>
|
217
|
-
|
218
|
-
</p>
|
219
|
-
<div id="M000006_source" class="dyn-source">
|
220
|
-
<pre><span class="ruby-comment cmt"># File lib/apphunk.rb, line 28</span>
|
221
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span> = {})
|
222
|
-
<span class="ruby-identifier">options</span> = (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span> <span class="ruby-operator">||</span> {}).<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
|
223
|
-
<span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Proxy</span>.<span class="ruby-identifier">send_message_to_apphunkd</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span>)
|
224
|
-
<span class="ruby-keyword kw">end</span></pre>
|
225
|
-
</div>
|
226
|
-
</div>
|
227
|
-
|
228
|
-
</div>
|
229
|
-
|
230
|
-
<div class="method">
|
231
|
-
<div class="title" id="M000007">
|
232
|
-
|
233
|
-
<a name="M000007"></a><b>log_with_options</b>(options = {}, &block)
|
234
|
-
|
235
|
-
</div>
|
236
|
-
|
237
|
-
<div class="description">
|
238
|
-
<p>
|
239
|
-
Send messages with predefined options in a block
|
240
|
-
</p>
|
241
|
-
<p>
|
242
|
-
Yields the <a href="Apphunk.html">Apphunk</a> module which can be used to
|
243
|
-
send messages via <a href="Apphunk.html#M000006">Apphunk.log</a>, but
|
244
|
-
temporarily merges the provided <tt>options</tt> with <a
|
245
|
-
href="Apphunk.html#default_options">Apphunk.default_options</a>. Can be
|
246
|
-
used to send a bunch of messages with the same options.
|
247
|
-
</p>
|
248
|
-
<ul>
|
249
|
-
<li><tt>options</tt> - A hash of options. Merges with <a
|
250
|
-
href="Apphunk.html#default_options">Apphunk.default_options</a>
|
251
|
-
|
252
|
-
</li>
|
253
|
-
</ul>
|
254
|
-
<p>
|
255
|
-
For a list of available options see <a
|
256
|
-
href="Apphunk/Config.html">Apphunk::Config</a>.
|
257
|
-
</p>
|
258
|
-
<h4>Examples</h4>
|
259
|
-
<pre>
|
260
|
-
Apphunk.log_with_options(:tags => 'hello world') do |apphunk|
|
261
|
-
apphunk.log("A messages with tags")
|
262
|
-
apphunk.log("Another messages with the same tags")
|
263
|
-
end
|
264
|
-
</pre>
|
265
|
-
|
266
|
-
</div>
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
<div class="sourcecode">
|
272
|
-
<p class="source-link">
|
273
|
-
Source: <a href="javascript:toggleSource('M000007_source')" id="l_M000007_source">show</a>
|
274
|
-
|
275
|
-
| <a href="http://github.com/apphunk/apphunk/blob/a37092d225a325b738783fba89641741a886e1ca/lib/apphunk.rb#L49" target="_blank" class="github_url">on GitHub</a>
|
276
|
-
|
277
|
-
</p>
|
278
|
-
<div id="M000007_source" class="dyn-source">
|
279
|
-
<pre><span class="ruby-comment cmt"># File lib/apphunk.rb, line 49</span>
|
280
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_with_options</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
281
|
-
<span class="ruby-identifier">preserved_defaults</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span>
|
282
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span> = (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span> <span class="ruby-operator">||</span> {}).<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
|
283
|
-
<span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span>
|
284
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">default_options</span> = <span class="ruby-identifier">preserved_defaults</span>
|
285
|
-
<span class="ruby-keyword kw">end</span></pre>
|
286
|
-
</div>
|
287
|
-
</div>
|
288
|
-
|
289
|
-
</div>
|
290
|
-
|
291
|
-
</div>
|
292
|
-
</div>
|
293
|
-
</body>
|
294
|
-
</html>
|