carbon 1.1.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.gitignore +4 -22
  2. data/CHANGELOG +11 -0
  3. data/Gemfile +10 -1
  4. data/README.markdown +185 -0
  5. data/Rakefile +13 -26
  6. data/bin/carbon +3 -3
  7. data/carbon.gemspec +17 -23
  8. data/developer_notes/MULTI.markdown +25 -0
  9. data/developer_notes/REDUCE_HTTP_CONNECTIONS.markdown +46 -0
  10. data/features/shell.feature +1 -1
  11. data/features/support/env.rb +3 -4
  12. data/lib/carbon.rb +242 -96
  13. data/lib/carbon/registry.rb +50 -0
  14. data/lib/carbon/shell.rb +14 -8
  15. data/lib/carbon/shell/emitter.rb +33 -29
  16. data/lib/carbon/version.rb +1 -1
  17. data/test/carbon_test.rb +167 -0
  18. metadata +128 -182
  19. data/MIT-LICENSE.txt +0 -19
  20. data/README.rdoc +0 -266
  21. data/doc/INTEGRATION_GUIDE.rdoc +0 -1002
  22. data/doc/examining-response-with-jsonview.png +0 -0
  23. data/doc/shell_example +0 -43
  24. data/doc/timeout-error.png +0 -0
  25. data/doc/with-committee-reports.png +0 -0
  26. data/doc/without-committee-reports.png +0 -0
  27. data/lib/carbon/base.rb +0 -62
  28. data/lib/carbon/emission_estimate.rb +0 -165
  29. data/lib/carbon/emission_estimate/request.rb +0 -100
  30. data/lib/carbon/emission_estimate/response.rb +0 -61
  31. data/lib/carbon/emission_estimate/storage.rb +0 -33
  32. data/spec/fixtures/vcr_cassettes/flight.yml +0 -47
  33. data/spec/fixtures/vcr_cassettes/residence.yml +0 -44
  34. data/spec/lib/carbon/emission_estimate/request_spec.rb +0 -41
  35. data/spec/lib/carbon/emission_estimate/response_spec.rb +0 -33
  36. data/spec/lib/carbon/emission_estimate_spec.rb +0 -32
  37. data/spec/lib/carbon_spec.rb +0 -384
  38. data/spec/spec_helper.rb +0 -60
  39. data/spec/specwatchr +0 -60
data/spec/spec_helper.rb DELETED
@@ -1,60 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- Bundler.setup
4
- require 'rspec'
5
- require 'active_support/json/encoding'
6
- require 'fakeweb'
7
- $LOAD_PATH.unshift(File.dirname(__FILE__))
8
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
- require 'carbon'
10
-
11
- Carbon.log = Logger.new nil
12
-
13
- class RentalCar
14
- include Carbon
15
- attr_accessor :model, :model_year, :fuel_economy
16
- class Make
17
- attr_accessor :name
18
- def to_param
19
- name
20
- end
21
- end
22
- def make
23
- @make ||= Make.new
24
- end
25
- emit_as :automobile_trip do
26
- provide :make
27
- provide :model
28
- provide :model_year
29
- provide :fuel_economy, :as => :fuel_efficiency
30
- end
31
- end
32
-
33
- class DonutFactory
34
- include Carbon
35
- attr_accessor :smokestack_size, :oven_count, :employees
36
- class Mixer
37
- attr_accessor :upc
38
- def to_param
39
- raise "Use #to_characteristic instead please"
40
- end
41
- def to_characteristic
42
- upc
43
- end
44
- end
45
- def mixer
46
- @mixer ||= Mixer.new
47
- end
48
- emit_as :factory do
49
- provide :smokestack_size
50
- provide :oven_count
51
- provide :employees, :as => :personnel
52
- provide :mixer, :key => :upc
53
- end
54
- end
55
-
56
- require 'vcr'
57
- VCR.config do |c|
58
- c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
59
- c.stub_with :fakeweb
60
- end
data/spec/specwatchr DELETED
@@ -1,60 +0,0 @@
1
- # Run me with:
2
- #
3
- # $ watchr specs.watchr.rb
4
-
5
- # --------------------------------------------------
6
- # Convenience Methods
7
- # --------------------------------------------------
8
- def all_test_files
9
- Dir['spec/**/*_spec.rb'] - ['spec/spec_helper.rb']
10
- end
11
-
12
- def run(cmd)
13
- puts "\e[H\e[2J" #clear console
14
- puts(cmd)
15
- system(cmd)
16
- end
17
-
18
- def run_all_tests
19
- cmd = "spec spec"
20
- run(cmd)
21
- end
22
-
23
- def run_spec(file_name)
24
- return unless File.exist?(file_name)
25
- file_text = File.read(file_name)
26
- if file_text =~ /#\s*wip/
27
- current_line = 2
28
- exec_line = nil
29
- file_text.each_line do |line|
30
- if line =~ /#\s*wip/
31
- exec_line ||= current_line
32
- end
33
- current_line += 1
34
- end
35
- run "spec #{file_name}:#{exec_line}"
36
- else
37
- run "spec #{file_name}"
38
- end
39
- end
40
-
41
- # --------------------------------------------------
42
- # Watchr Rules
43
- # --------------------------------------------------
44
- watch('^spec/.+_spec.rb' ) { |m| run_spec(m[0]) }
45
- watch('^app/(.+)/(.+)\.rb') { |m| run_spec("spec/#{m[1]}/#{m[2]}_spec.rb") }
46
- watch('^lib/(.*)\.rb' ) { |m| run_spec("spec/lib/#{m[1]}_spec.rb") }
47
- watch('^spec/spec_helper\.rb') { run_all_tests }
48
- watch('actors_controller') { |m| run "spec spec/controllers" }
49
-
50
- # --------------------------------------------------
51
- # Signal Handling
52
- # --------------------------------------------------
53
- # Ctrl-\
54
- Signal.trap('QUIT') do
55
- puts " --- Running all tests ---\n\n"
56
- run_all_tests
57
- end
58
-
59
- # Ctrl-C
60
- Signal.trap('INT') { abort("\n") }