sniff 0.1.0 → 0.1.1
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.
- data/README.markdown +15 -0
- data/lib/sniff/rake_task.rb +28 -0
- data/lib/sniff.rb +1 -1
- metadata +4 -4
- data/lib/sniff/tasks.rb +0 -9
data/README.markdown
CHANGED
@@ -16,6 +16,21 @@ Sniff is never used directly but rather as a requirement of a specific emitter.
|
|
16
16
|
|
17
17
|
For a complete list, see the emission estimate service's [documentation](http://carbon.brighterplanet.com/use).
|
18
18
|
|
19
|
+
### Rake Task
|
20
|
+
Sniff comes with a rake task that will load a console with a given earth domain:
|
21
|
+
|
22
|
+
require 'sniff'
|
23
|
+
require 'sniff/rake_task'
|
24
|
+
Sniff::RakeTask.new do |t|
|
25
|
+
t.earth_domains = [:air, :locality]
|
26
|
+
end
|
27
|
+
|
28
|
+
At the command prompt, do:
|
29
|
+
|
30
|
+
> rake console
|
31
|
+
irb > ZipCode.first
|
32
|
+
#=> <ZipCode id="...>
|
33
|
+
|
19
34
|
## The emitter
|
20
35
|
An emitter is a software model of a real-world emission source, like a flight. Brighter Planet's emitter libraries each comprise a carbon model, an attribute curation policy, a persistence schema, and a summarization strategy.
|
21
36
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Sniff
|
2
|
+
class RakeTask
|
3
|
+
attr_accessor :earth_domains
|
4
|
+
|
5
|
+
def initialize(name = 'console', desc = 'Load IRB console with Sniff environment')
|
6
|
+
yield self if block_given?
|
7
|
+
|
8
|
+
define_task
|
9
|
+
end
|
10
|
+
|
11
|
+
def earth_domains
|
12
|
+
@earth_domains ||= :all
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def define_task
|
17
|
+
task :console do
|
18
|
+
require 'sniff'
|
19
|
+
cwd = Dir.pwd
|
20
|
+
Sniff.init cwd, :earth => earth_domains
|
21
|
+
|
22
|
+
require 'irb'
|
23
|
+
ARGV.clear
|
24
|
+
IRB.start
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/sniff.rb
CHANGED
@@ -21,7 +21,7 @@ module Sniff
|
|
21
21
|
|
22
22
|
Sniff::Database.init local_root, options
|
23
23
|
|
24
|
-
if
|
24
|
+
if options[:cucumber]
|
25
25
|
cukes = Dir.glob File.join(File.dirname(__FILE__), 'test_support', 'cucumber', '**', '*.rb')
|
26
26
|
cukes.each { |support_file| require support_file }
|
27
27
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sniff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Derek Kastner
|
@@ -232,7 +232,7 @@ files:
|
|
232
232
|
- lib/sniff.rb
|
233
233
|
- lib/sniff/database.rb
|
234
234
|
- lib/sniff/emitter.rb
|
235
|
-
- lib/sniff/
|
235
|
+
- lib/sniff/rake_task.rb
|
236
236
|
- lib/test_support/cucumber/step_definitions/carbon_steps.rb
|
237
237
|
- lib/test_support/cucumber/step_definitions/committee_steps.rb
|
238
238
|
- lib/test_support/cucumber/support/values.rb
|