smog 0.0.2

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/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in smog.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,47 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ smog (0.0.1)
5
+ thor
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ aruba (0.2.3)
11
+ background_process
12
+ cucumber (~> 0.9.0)
13
+ background_process (1.2)
14
+ builder (2.1.2)
15
+ cucumber (0.9.2)
16
+ builder (~> 2.1.2)
17
+ diff-lcs (~> 1.1.2)
18
+ gherkin (~> 2.2.5)
19
+ json (~> 1.4.6)
20
+ term-ansicolor (~> 1.0.5)
21
+ diff-lcs (1.1.2)
22
+ gherkin (2.2.8)
23
+ json (~> 1.4.6)
24
+ term-ansicolor (~> 1.0.5)
25
+ json (1.4.6)
26
+ rspec (2.0.0)
27
+ rspec-core (= 2.0.0)
28
+ rspec-expectations (= 2.0.0)
29
+ rspec-mocks (= 2.0.0)
30
+ rspec-core (2.0.0)
31
+ rspec-expectations (2.0.0)
32
+ diff-lcs (>= 1.1.2)
33
+ rspec-mocks (2.0.0)
34
+ rspec-core (= 2.0.0)
35
+ rspec-expectations (= 2.0.0)
36
+ term-ansicolor (1.0.5)
37
+ thor (0.14.3)
38
+
39
+ PLATFORMS
40
+ ruby
41
+
42
+ DEPENDENCIES
43
+ aruba
44
+ cucumber
45
+ rspec
46
+ smog!
47
+ thor
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/bin/smog ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'smog/cli'
4
+ Smog::CLI.start
@@ -0,0 +1,28 @@
1
+ Feature: Food
2
+ In order to see test the CloudApp items API
3
+ As a user
4
+ I want to see a lit of items
5
+
6
+ Scenario: Get items
7
+ When I run "smog curl --user test@example.com:pass"
8
+ Then the output should contain exactly:
9
+ """
10
+ curl -I --digest -u test@example.com:pass -H "Accept: application/json" "http://my.cloudapp.local/items?page=1&per_page=5"
11
+
12
+ """
13
+
14
+ Scenario: Get items with etag
15
+ When I run "smog curl --etag abc123"
16
+ Then the output should contain exactly:
17
+ """
18
+ curl -I -H "If-None-Match: \"abc123\"" -H "Accept: application/json" "http://my.cloudapp.local/items?page=1&per_page=5"
19
+
20
+ """
21
+
22
+ Scenario: Get items with last-modified
23
+ When I run "smog curl --last-modified \"Tue, 05 Oct 2010 13:44:39 GMT\""
24
+ Then the output should contain exactly:
25
+ """
26
+ curl -I -H "If-Modified-Since: Tue, 05 Oct 2010 13:44:39 GMT" -H "Accept: application/json" "http://my.cloudapp.local/items?page=1&per_page=5"
27
+
28
+ """
@@ -0,0 +1 @@
1
+ require 'aruba'
data/lib/smog.rb ADDED
@@ -0,0 +1,2 @@
1
+ module Smog
2
+ end
data/lib/smog/cli.rb ADDED
@@ -0,0 +1,50 @@
1
+ require 'thor'
2
+ require 'smog'
3
+
4
+ module Smog
5
+ class CLI < Thor
6
+ # Basic curl command:
7
+ # curl
8
+ # --digest -u "test@example.com:pass"
9
+ # -H "Accept: application/json"
10
+ # -H "If-None-Match: \"05122c59185e3bcf8b9a1976d46c2040\""
11
+ # -H "If-Modified-Since: Tue, 05 Oct 2010 13:44:39 GMT"
12
+ # "http://my.cloudapp.local/items?page=1&per_page=5"
13
+
14
+ desc 'curl', 'Prints the curl command to fetch items'
15
+ method_option :user, :aliases => '-u'
16
+ method_option :etag, :aliases => '-e'
17
+ method_option :last_modified, :aliases => '-l'
18
+ def curl
19
+ print build_command(options)
20
+ end
21
+
22
+ private
23
+
24
+ def build_command(options)
25
+ [ 'curl -I' ].tap do |command|
26
+ command << "--digest -u #{ options[:user] }" if options[:user]
27
+
28
+ if options[:etag]
29
+ command << header('If-None-Match', %{\\"#{ options[:etag] }\\"})
30
+ end
31
+
32
+ if options[:last_modified]
33
+ command << header('If-Modified-Since', options[:last_modified])
34
+ end
35
+
36
+ command << header('Accept', 'application/json')
37
+ command << "#{ url }\n"
38
+ end.join ' '
39
+ end
40
+
41
+ def header(name, value)
42
+ %{-H "#{ name }: #{ value }"}
43
+ end
44
+
45
+ def url
46
+ '"http://my.cloudapp.local/items?page=1&per_page=5"'
47
+ end
48
+
49
+ end
50
+ end
@@ -0,0 +1,3 @@
1
+ module Smog
2
+ VERSION = "0.0.2"
3
+ end
data/smog.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "smog/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "smog"
7
+ s.version = Smog::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Larry Marburger"]
10
+ s.email = ["larry@marburger.cc"]
11
+ s.homepage = "http://github.com/lmarburger/smog"
12
+ s.summary = %q{Test the CloudApp API from the command line}
13
+ s.description = %q{Smog simply outputs a curl command to use to test the CloudApp API}
14
+
15
+ s.required_rubygems_version = ">= 1.3.6"
16
+
17
+ s.add_dependency "thor"
18
+
19
+ s.add_development_dependency "rspec"
20
+ s.add_development_dependency "cucumber"
21
+ s.add_development_dependency "aruba"
22
+
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = %w(smog)
26
+ s.default_executable = "smog"
27
+ s.require_paths = ["lib"]
28
+ end
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smog
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Larry Marburger
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-11 00:00:00 -04:00
19
+ default_executable: smog
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: thor
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rspec
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: cucumber
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: aruba
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :development
76
+ version_requirements: *id004
77
+ description: Smog simply outputs a curl command to use to test the CloudApp API
78
+ email:
79
+ - larry@marburger.cc
80
+ executables:
81
+ - smog
82
+ extensions: []
83
+
84
+ extra_rdoc_files: []
85
+
86
+ files:
87
+ - .gitignore
88
+ - Gemfile
89
+ - Gemfile.lock
90
+ - Rakefile
91
+ - bin/smog
92
+ - features/smog.feature
93
+ - features/support/setup.rb
94
+ - lib/smog.rb
95
+ - lib/smog/cli.rb
96
+ - lib/smog/version.rb
97
+ - smog.gemspec
98
+ has_rdoc: true
99
+ homepage: http://github.com/lmarburger/smog
100
+ licenses: []
101
+
102
+ post_install_message:
103
+ rdoc_options: []
104
+
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ hash: 23
122
+ segments:
123
+ - 1
124
+ - 3
125
+ - 6
126
+ version: 1.3.6
127
+ requirements: []
128
+
129
+ rubyforge_project:
130
+ rubygems_version: 1.3.7
131
+ signing_key:
132
+ specification_version: 3
133
+ summary: Test the CloudApp API from the command line
134
+ test_files:
135
+ - features/smog.feature
136
+ - features/support/setup.rb