mudbug 0.4.7.1 → 0.4.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/MANIFEST.txt CHANGED
@@ -1,8 +1,8 @@
1
- README.md
2
- VERSION
3
- rakefile.rb
4
1
  MANIFEST.txt
2
+ VERSION
3
+ README.md
5
4
  LICENSE.txt
5
+ rakefile.rb
6
6
  lib/mudbug.rb
7
7
  test/mudbug.rb
8
8
  examples/accepts_and_methods.rb
data/README.md CHANGED
@@ -75,7 +75,7 @@ Call Mudbug#resource directly for finer-grained response handling:
75
75
  # process resp.body
76
76
  # etc.
77
77
 
78
- Here is the heart of the Mudbug's [response processing](https://github.com/rickhull/mudbug/blob/master/lib/mudbug.rb#L45):
78
+ Here is the heart of Mudbug's [response processing](https://github.com/rickhull/mudbug/blob/master/lib/mudbug.rb#L45):
79
79
 
80
80
  # this structure declares what we support in the request Accept: header
81
81
  # and defines automatic processing of the response based on the
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.7.1
1
+ 0.4.7.2
@@ -1,7 +1,6 @@
1
- # normally, just require 'mudbug', but this will use your local version
1
+ require 'mudbug'
2
2
  # useful for development purposes
3
- #
4
- require_relative '../lib/mudbug'
3
+ #require_relative '../lib/mudbug'
5
4
 
6
5
  sites = %w{google.com yahoo.com microsoft.com amazon.com ibm.com reddit.com}
7
6
  accepts = [:json, :html, :text, :xml]
@@ -14,14 +13,14 @@ unless ARGV.shift == 'skip'
14
13
  puts "Checking Accepts across sites"
15
14
  puts "============================="
16
15
  sites.each { |site|
17
- b = Mudbug.new(site)
16
+ mb = Mudbug.new(site)
18
17
  url = "http://#{site}#{path}"
19
18
 
20
19
  accepts.each { |acp|
21
- b.accept(acp)
20
+ mb.accept(acp)
22
21
 
23
22
  puts "GET #{url} [#{acp}]"
24
- b.get path
23
+ mb.get path
25
24
  }
26
25
  puts
27
26
  }
@@ -38,7 +37,7 @@ unless ARGV.shift == 'skip'
38
37
  puts "POST/PUT payload = #{payload.to_json}"
39
38
  puts
40
39
  sites.each { |site|
41
- b = Mudbug.new(site)
40
+ mb = Mudbug.new(site)
42
41
  url = "http://#{site}#{path}"
43
42
 
44
43
  http_methods.each { |meth|
@@ -47,7 +46,7 @@ unless ARGV.shift == 'skip'
47
46
 
48
47
  print "#{meth.to_s.upcase} #{url} "
49
48
  begin
50
- b.send(*args)
49
+ mb.send(*args)
51
50
  puts
52
51
  rescue RuntimeError => e
53
52
  puts "#{e} (#{e.class})"
data/lib/mudbug.rb CHANGED
@@ -72,7 +72,7 @@ class Mudbug
72
72
  return hsh[:proc].call(resp.body) if ct == hsh[:type]
73
73
  }
74
74
 
75
- @lager.warn { "abort processing -- unrecognized Content-type: #{ct}" }
75
+ @lager.warn { "abandon processing -- unrecognized Content-type: #{ct}" }
76
76
  return resp.body
77
77
  end
78
78
 
data/rakefile.rb CHANGED
@@ -1,133 +1,24 @@
1
- require 'rubygems/package_task'
1
+ require 'buildar/tasks'
2
2
  require 'rake/testtask'
3
3
 
4
- Rake::TestTask.new :test do |t|
5
- t.pattern = 'test/*.rb'
4
+ Buildar.conf(__FILE__) do |b|
5
+ b.name = 'mudbug'
6
+ b.use_version_file = true
7
+ b.version_filename = 'VERSION'
8
+ b.use_manifest_file = true
9
+ b.manifest_filename = 'MANIFEST.txt'
10
+ b.use_git = true
11
+ b.publish[:rubygems] = true
12
+
13
+ b.gemspec.summary = "This hardy creature consumes JSON / REST APIs"
14
+ b.gemspec.description = "GET, POST, PUT, and DELETE JSON payloads. Easy Accept headers. Fine-grained response handling using Mudbug#resource."
15
+ b.gemspec.author = "Rick Hull"
16
+ b.gemspec.homepage = "http://github.com/rickhull/mudbug"
17
+ b.gemspec.license = 'LGPL'
18
+
19
+ b.gemspec.add_runtime_dependency "rest-client", ["~> 1"]
20
+ b.gemspec.add_runtime_dependency "json", ["~> 1"]
21
+ b.gemspec.add_runtime_dependency "lager", [">= 0.2"]
22
+ b.gemspec.add_development_dependency "minitest", [">= 0"]
23
+ b.gemspec.add_development_dependency "buildar", ["~> 1.2"]
6
24
  end
7
-
8
- PROJECT_ROOT = File.dirname(__FILE__)
9
- PROJECT_NAME = File.split(PROJECT_ROOT).last
10
- VERSION_FILE = File.join(PROJECT_ROOT, 'VERSION')
11
- MANIFEST_FILE = File.join(PROJECT_ROOT, 'MANIFEST.txt')
12
-
13
- def version
14
- File.read(VERSION_FILE).chomp
15
- end
16
-
17
- task :version do
18
- puts "#{PROJECT_NAME} #{version}"
19
- end
20
-
21
- task :tag => [:test] do
22
- tagname = "v#{version}"
23
- sh "git tag -a #{tagname} -m 'auto-tagged #{tagname} by Rake'"
24
- sh "git push origin --tags"
25
- end
26
-
27
- def manifest
28
- File.readlines(MANIFEST_FILE).map { |line| line.chomp }
29
- end
30
-
31
- task :manifest do
32
- puts manifest.join("\n")
33
- end
34
-
35
- task :build => [:test, :bump_build] do
36
- spec = Gem::Specification.new do |s|
37
- # Static assignments
38
- s.name = "mudbug"
39
- s.summary = "This hardy creature consumes JSON / REST APIs"
40
- s.description = "GET, POST, PUT, and DELETE JSON payloads. Easy Accept headers. Fine-grained response handling using Mudbug#resource."
41
- s.authors = ["Rick Hull"]
42
- s.email = "rick@cloudscaling.com"
43
- s.homepage = "http://github.com/rickhull/mudbug"
44
- s.licenses = ['LGPL']
45
-
46
- # Dynamic assignments
47
- s.files = manifest
48
- s.version = version
49
- s.date = Time.now.strftime("%Y-%m-%d")
50
-
51
- s.add_runtime_dependency "rest-client", ["~> 1"]
52
- s.add_runtime_dependency "json", ["~> 1"]
53
- s.add_runtime_dependency "lager", [">= 0.2"]
54
- s.add_development_dependency "minitest", [">= 0"]
55
- s.add_development_dependency "rake", [">= 0"]
56
- end
57
-
58
- # we're definining the task at runtime, rather than requiretime
59
- # so that the gemspec will reflect any version bumping since requiretime
60
- #
61
- Gem::PackageTask.new(spec).define
62
- Rake::Task["package"].invoke
63
- end
64
-
65
- # e.g. bump(:minor, '1.2.3') #=> '1.3.0'
66
- # only works for integers delimited by periods (dots)
67
- #
68
- def bump(position, version)
69
- pos = [:major, :minor, :patch, :build].index(position) || position
70
- places = version.split('.')
71
- raise "bad position: #{pos} (for version #{version})" unless places[pos]
72
- places.map.with_index { |place, i|
73
- if i < pos
74
- place
75
- elsif i == pos
76
- place.to_i + 1
77
- else
78
- 0
79
- end
80
- }.join('.')
81
- end
82
-
83
- def write_version new_version
84
- File.open(VERSION_FILE, 'w') { |f| f.write(new_version) }
85
- end
86
-
87
- [:major, :minor, :patch, :build].each { |v|
88
- task "bump_#{v}" do
89
- old_version = version
90
- new_version = bump(v, old_version)
91
- puts "bumping #{old_version} to #{new_version}"
92
- write_version new_version
93
- sh "git add VERSION"
94
- sh "git commit -m 'rake bump_#{v}'"
95
- end
96
- }
97
- task :bump => [:bump_patch]
98
-
99
- task :verify_publish_credentials do
100
- creds = '~/.gem/credentials'
101
- fp = File.expand_path(creds)
102
- raise "#{creds} does not exist" unless File.exists?(fp)
103
- raise "can't read #{creds}" unless File.readable?(fp)
104
- end
105
-
106
- task :publish => [:verify_publish_credentials] do
107
- fragment = "-#{version}.gem"
108
- pkg_dir = File.join(PROJECT_ROOT, 'pkg')
109
- Dir.chdir(pkg_dir) {
110
- candidates = Dir.glob "*#{fragment}"
111
- case candidates.length
112
- when 0
113
- raise "could not find .gem matching #{fragment}"
114
- when 1
115
- sh "gem push #{candidates.first}"
116
- else
117
- raise "multiple candidates found matching #{fragment}"
118
- end
119
- }
120
- end
121
-
122
- task :gitpush do
123
- # may prompt
124
- sh "git push origin"
125
- # this kills the automation
126
- # use key-based auth?
127
- # consider a timeout?
128
- end
129
-
130
- task :release => [:build, :tag, :publish, :gitpush]
131
- task :release_patch => [:bump_patch, :release]
132
- task :release_minor => [:bump_minor, :release]
133
- task :release_major => [:bump_major, :release]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mudbug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7.1
4
+ version: 0.4.7.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-05 00:00:00.000000000 Z
12
+ date: 2013-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -76,33 +76,33 @@ dependencies:
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
- name: rake
79
+ name: buildar
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ! '>='
83
+ - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: '1.2'
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ! '>='
91
+ - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: '1.2'
94
94
  description: GET, POST, PUT, and DELETE JSON payloads. Easy Accept headers. Fine-grained
95
95
  response handling using Mudbug#resource.
96
- email: rick@cloudscaling.com
96
+ email:
97
97
  executables: []
98
98
  extensions: []
99
99
  extra_rdoc_files: []
100
100
  files:
101
- - README.md
102
- - VERSION
103
- - rakefile.rb
104
101
  - MANIFEST.txt
102
+ - VERSION
103
+ - README.md
105
104
  - LICENSE.txt
105
+ - rakefile.rb
106
106
  - lib/mudbug.rb
107
107
  - test/mudbug.rb
108
108
  - examples/accepts_and_methods.rb