prospector 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -13
- data/lib/prospector.rb +2 -0
- data/lib/prospector/motion/config.rb +9 -0
- data/lib/prospector/railtie.rb +4 -0
- data/lib/prospector/tasks.rb +31 -0
- data/lib/prospector/version.rb +1 -1
- data/lib/tasks/prospector.rake +1 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3271fbbd98467dba799a853bfd28e229274a539d
|
4
|
+
data.tar.gz: 57cb3a89d4a5398524682622ba2c88e0b2675f02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9572530d8f6b69114949fd0b09e72d74a3a24fc56595cf7a2cbdd1d819c974d4cba7f7b0962002dab592e7e09e5cc5b4a10497e7695287584c1fc2fab6d8e913
|
7
|
+
data.tar.gz: 5b3f831db4b95f8c63899e41b7bc641f5f748f1b8fdac72a1e7c86fa064b337bf834d9ba270ed9ec0bc5dd68a2cea95887f836349d70420e3d563430d29bda7f
|
data/README.md
CHANGED
@@ -20,14 +20,18 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Configuration
|
22
22
|
|
23
|
-
|
23
|
+
Projects can be configured via environment variables, a code block, or a RubyMotion configuration.
|
24
|
+
|
25
|
+
### Environment Variables
|
24
26
|
|
25
27
|
```sh
|
28
|
+
export PROSPECTOR_ENABLED=true
|
26
29
|
export PROSPECTOR_SECRET_TOKEN=token
|
27
30
|
export PROSPECTOR_CLIENT_SECRET=secret
|
31
|
+
export PROSPECTOR_BACKGROUND_ADAPTER=sidekiq
|
28
32
|
```
|
29
33
|
|
30
|
-
|
34
|
+
### Code Block
|
31
35
|
|
32
36
|
```ruby
|
33
37
|
Prospector.configure do |config|
|
@@ -39,26 +43,48 @@ Prospector.configure do |config|
|
|
39
43
|
end
|
40
44
|
```
|
41
45
|
|
46
|
+
### RubyMotion
|
47
|
+
|
48
|
+
A common configuration for a RubyMotion project follows, enabling only for release builds.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
Motion::Project::App.setup do |app|
|
52
|
+
app.prospector do |config|
|
53
|
+
config.secret_token = 'token from service'
|
54
|
+
config.client_secret = 'secret from service'
|
55
|
+
end
|
56
|
+
|
57
|
+
app.release do
|
58
|
+
app.prospector do |config|
|
59
|
+
config.enabled = true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
42
65
|
## Usage
|
43
66
|
|
44
67
|
### Rails
|
45
68
|
|
46
|
-
|
69
|
+
Rails integration includes automatic detection and support for ActiveJob as well as Sidekiq, to deliver usage details to the Prospector API in the background on app boot. Additionally, the rake task mentioned below is available to use at any time you see fit, for example as part of your deployment process.
|
47
70
|
|
48
|
-
|
71
|
+
Valid background adapter options are `active_job`, `sidekiq`, and `none`. ActiveJob is preferred and chosen in Rais 4.2 and above with built-in ActiveJob support.
|
49
72
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
73
|
+
### RubyMotion
|
74
|
+
|
75
|
+
Integration with RubyMotion is accomplished via a Rake task that can be run by hand, or simply letting the build system do it's magic. By default, if you have enabled Prospector via an environment variable, or a configuration block, any time the binary is built for a device (such as for distribution) then Prospector will be notified without any further action.
|
76
|
+
|
77
|
+
### Rake Task
|
78
|
+
|
79
|
+
If you prefer to notify the Prospector service at any other time, you can use the included Rake task.
|
80
|
+
|
81
|
+
```
|
82
|
+
rake prospector:deliver
|
57
83
|
```
|
58
84
|
|
59
|
-
###
|
85
|
+
### Manually
|
60
86
|
|
61
|
-
|
87
|
+
If you prefer to notify the Prospector API without using the included Rails or RubyMotion support, you can always call directly.
|
62
88
|
|
63
89
|
```ruby
|
64
90
|
Prospector.notify!
|
data/lib/prospector.rb
CHANGED
@@ -6,8 +6,10 @@ require "prospector/client"
|
|
6
6
|
require "prospector/configuration"
|
7
7
|
require "prospector/error"
|
8
8
|
require "prospector/background"
|
9
|
+
require "prospector/tasks"
|
9
10
|
|
10
11
|
require "prospector/railtie" if defined?(Rails)
|
12
|
+
require "prospector/motion/config" if defined?(Motion::Project::Config)
|
11
13
|
|
12
14
|
begin
|
13
15
|
require "pry"
|
data/lib/prospector/railtie.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
namespace :prospector do
|
4
|
+
|
5
|
+
# Will load and run initializers for configuration info if provided
|
6
|
+
task :require do
|
7
|
+
Rake::Task['environment'].invoke if defined?(Rails)
|
8
|
+
|
9
|
+
App.config if defined?(Motion::Project)
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Deliver usage details to Prospector API service'
|
13
|
+
task deliver: ['prospector:require'] do
|
14
|
+
Prospector.notify!
|
15
|
+
end
|
16
|
+
|
17
|
+
task deliver_quietly: ['prospector:require'] do
|
18
|
+
if Prospector.enabled?
|
19
|
+
App.info 'Prospector', 'Begin uploading usage details to API'
|
20
|
+
|
21
|
+
Prospector.notify!
|
22
|
+
|
23
|
+
App.info 'Prospector', 'Upload complete'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Hook into archive build hook for RubyMotion projects
|
28
|
+
if Rake::Task.task_defined?('build:device')
|
29
|
+
Rake::Task['build:device'].enhance(['prospector:deliver_quietly'])
|
30
|
+
end
|
31
|
+
end
|
data/lib/prospector/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
load(File.expand_path(File.join(File.dirname(__FILE__), '../prospector/tasks.rb')))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prospector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Millsaps-Brewer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -120,8 +120,11 @@ files:
|
|
120
120
|
- lib/prospector/client.rb
|
121
121
|
- lib/prospector/configuration.rb
|
122
122
|
- lib/prospector/error.rb
|
123
|
+
- lib/prospector/motion/config.rb
|
123
124
|
- lib/prospector/railtie.rb
|
125
|
+
- lib/prospector/tasks.rb
|
124
126
|
- lib/prospector/version.rb
|
127
|
+
- lib/tasks/prospector.rake
|
125
128
|
- prospector.gemspec
|
126
129
|
homepage: http://www.gemprospector.com
|
127
130
|
licenses:
|
@@ -143,9 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
146
|
version: '0'
|
144
147
|
requirements: []
|
145
148
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.4.
|
149
|
+
rubygems_version: 2.4.8
|
147
150
|
signing_key:
|
148
151
|
specification_version: 4
|
149
152
|
summary: Prospector provides a simple integration with the Gem Prospector service.
|
150
153
|
test_files: []
|
151
|
-
has_rdoc:
|