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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ea6ae785fa211406e6a4ff2e033dec0c8c0deca
4
- data.tar.gz: 89739a65b7bdea8a3324523397d4711185c070ed
3
+ metadata.gz: 3271fbbd98467dba799a853bfd28e229274a539d
4
+ data.tar.gz: 57cb3a89d4a5398524682622ba2c88e0b2675f02
5
5
  SHA512:
6
- metadata.gz: 2fd0d5cd8bbbd4bb783881236301ee4e56081bed86dac1903b8e5e68927943f38e20a5fa3c13b93281c7cf4469b08f34a3dc642bc3791b80c5ceb561aa541357
7
- data.tar.gz: f0afbf0e2512dc5ce8d42b29341e5181de16ff87690d48d0aa2de67aed974b4b19c3cc2f9e3bf849db4e72eb37028b23d43c57ac08995977ee1ac13e30c0a599
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
- The access token and secret can be configured either via environment variables, or with an initializer block.
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
- or:
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
- When the gem is included into a Rails project, you have the option of specifying a background adapter to run the notification service asynchronously on. The default adapter is `ActiveJob` if available in your Rails project, but we also support `Sidekiq` at this time.
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
- You can choose to enable Prospector in the initializer file, or by the presence of an ENV variable "PROSPECTOR_ENABLED" as shown below.
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
- ```ruby
51
- # set the ENV variable
52
- # ENV['PROSPECTOR_ENABLED'] = 'true'
53
- # or
54
- Prospector.configure do |config|
55
- config.enabled = Rails.env.production?
56
- end
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
- ### Without Rails
85
+ ### Manually
60
86
 
61
- Without Rails, you need to manually call the method to notify the Prospector service yourself.
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!
@@ -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"
@@ -0,0 +1,9 @@
1
+ module Motion; module Project; class Config
2
+ variable :prospector
3
+
4
+ def prospector(&block)
5
+ Prospector.configure(&block) if block_given?
6
+
7
+ Prospector.configuration
8
+ end
9
+ end; end; end
@@ -3,5 +3,9 @@ module Prospector
3
3
  config.after_initialize do
4
4
  Background.enqueue unless Object.const_defined?('Rake')
5
5
  end
6
+
7
+ rake_tasks do
8
+ require File.expand_path('../tasks', __FILE__)
9
+ end
6
10
  end
7
11
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Prospector
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -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.2.2
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-08-20 00:00:00.000000000 Z
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.7
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: