autoparse 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ # 0.3.1
2
+
3
+ * Replaced json gem dependency with multi_json
4
+ * Fixed issue with certain JSON libraries breaking on automatic #to_json calls
5
+
6
+ # 0.3.0
7
+
8
+ * Fixed handling of additional properties w/ a set schema
9
+ * Modified index methods to allow either raw or parsed access
10
+ * Modified index methods to default to parsed access
11
+
12
+ # 0.2.3
13
+
14
+ * Fixed stupid bug in inspect method
15
+
16
+ # 0.2.2
17
+
18
+ * The AutoParse.generate method was changed to use an options Hash
19
+ * Fixed some issues around array imports and exports
20
+ * Schemas of type object should now correctly inherit their id URI values
21
+
22
+ # 0.2.1
23
+
24
+ * Fixed URI resolution when base URI is missing
25
+
26
+ # 0.2.0
27
+
28
+ * Added support for union types
29
+ * Added support for recursive references
30
+ * Aixed vestigial code from refactoring extraction
31
+ * Fixed issue with references when schema URI is not supplied
32
+ * Fixed issue with missing gem dependencies
33
+
34
+ # 0.1.0
35
+
36
+ * Initial release
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # AutoParse
2
2
 
3
3
  <dl>
4
- <dt>Homepage</dt><dd><a href="http://autoparse.rubyforge.org/">http://autoparse.rubyforge.org/</a></dd>
4
+ <dt>Homepage</dt><dd><a href="http://code.google.com/p/ruby-autoparse/">http://code.google.com/p/ruby-autoparse/</a></dd>
5
5
  <dt>Author</dt><dd><a href="mailto:bobaman@google.com">Bob Aman</a></dd>
6
6
  <dt>Copyright</dt><dd>Copyright © 2010 Google, Inc.</dd>
7
7
  <dt>License</dt><dd>Apache 2.0</dd>
@@ -10,11 +10,7 @@
10
10
  # Description
11
11
 
12
12
  An implementation of the JSON Schema specification. Provides automatic parsing
13
- for any given JSON Schema.
14
-
15
- # Example Usage
16
-
17
- # Some code goes here.
13
+ for a given JSON Schema.
18
14
 
19
15
  # Requirements
20
16
 
data/Rakefile CHANGED
@@ -4,17 +4,13 @@ $:.uniq!
4
4
 
5
5
  require 'rubygems'
6
6
  require 'rake'
7
- require 'rake/testtask'
8
- require 'rake/rdoctask'
9
- require 'rake/packagetask'
10
- require 'rake/gempackagetask'
11
- require 'rake/contrib/rubyforgepublisher'
12
7
 
8
+ gem 'rspec', '~> 1.2.9'
13
9
  begin
14
10
  require 'spec/rake/spectask'
15
11
  rescue LoadError
16
- STDERR.puts 'Please install rspec:'
17
- STDERR.puts 'sudo gem install rspec'
12
+ STDERR.puts "Please install rspec:"
13
+ STDERR.puts "sudo gem install rspec"
18
14
  exit(1)
19
15
  end
20
16
 
@@ -345,7 +345,7 @@ module AutoParse
345
345
  elsif value.respond_to?(:to_hash)
346
346
  value.to_hash
347
347
  elsif value.respond_to?(:to_json)
348
- ::JSON.parse(value.to_json)
348
+ MultiJson.decode(value.to_json)
349
349
  else
350
350
  raise TypeError, "Expected Hash, got #{value.class}."
351
351
  end
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require 'json'
16
+ require 'multi_json'
17
17
  require 'time'
18
18
  require 'autoparse/inflection'
19
19
  require 'addressable/uri'
@@ -446,8 +446,16 @@ module AutoParse
446
446
  return @data
447
447
  end
448
448
 
449
- def to_json
450
- return ::JSON.generate(self.to_hash)
449
+ ##
450
+ # Converts the instance value to JSON.
451
+ #
452
+ # @return [String] The instance value converted to JSON.
453
+ #
454
+ # @note
455
+ # Ignores extra arguments to avoid throwing errors w/ certain JSON
456
+ # libraries.
457
+ def to_json(*args)
458
+ return MultiJson.encode(self.to_hash)
451
459
  end
452
460
 
453
461
  ##
@@ -18,7 +18,7 @@ unless defined? AutoParse::VERSION
18
18
  module VERSION
19
19
  MAJOR = 0
20
20
  MINOR = 3
21
- TINY = 0
21
+ TINY = 1
22
22
 
23
23
  STRING = [MAJOR, MINOR, TINY].join('.')
24
24
  end
@@ -1,4 +1,7 @@
1
- require 'rake/gempackagetask'
1
+ require 'rubygems/package_task'
2
+ require 'rake/clean'
3
+
4
+ CLOBBER.include('pkg')
2
5
 
3
6
  namespace :gem do
4
7
  GEM_SPEC = Gem::Specification.new do |s|
@@ -22,8 +25,8 @@ namespace :gem do
22
25
  s.extra_rdoc_files = %w( README.md )
23
26
  s.rdoc_options.concat ['--main', 'README.md']
24
27
 
25
- s.add_runtime_dependency('addressable', '~> 2.2.2')
26
- s.add_runtime_dependency('json', '>= 1.4.6')
28
+ s.add_runtime_dependency('addressable', '~> 2.2.3')
29
+ s.add_runtime_dependency('multi_json', '>= 1.0.0')
27
30
  s.add_runtime_dependency('extlib', '>= 0.9.15')
28
31
 
29
32
  s.add_development_dependency('rake', '~> 0.8.3')
@@ -34,7 +37,7 @@ namespace :gem do
34
37
  s.require_path = 'lib'
35
38
  end
36
39
 
37
- Rake::GemPackageTask.new(GEM_SPEC) do |p|
40
+ Gem::PackageTask.new(GEM_SPEC) do |p|
38
41
  p.gem_spec = GEM_SPEC
39
42
  p.need_tar = true
40
43
  p.need_zip = true
@@ -45,6 +48,21 @@ namespace :gem do
45
48
  puts GEM_SPEC.to_ruby
46
49
  end
47
50
 
51
+ desc "Generates .gemspec file"
52
+ task :gemspec do
53
+ spec_string = GEM_SPEC.to_ruby
54
+
55
+ begin
56
+ Thread.new { eval("$SAFE = 3\n#{spec_string}", binding) }.join
57
+ rescue
58
+ abort "unsafe gemspec: #{$!}"
59
+ else
60
+ File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file|
61
+ file.write spec_string
62
+ end
63
+ end
64
+ end
65
+
48
66
  desc 'Install the gem'
49
67
  task :install => ['clobber', 'gem:package'] do
50
68
  sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
@@ -10,7 +10,7 @@ namespace :git do
10
10
 
11
11
  desc 'Create a new tag in the Git repository'
12
12
  task :create do
13
- changelog = File.open('CHANGELOG', 'r') { |file| file.read }
13
+ changelog = File.open('CHANGELOG.md', 'r') { |file| file.read }
14
14
  puts '-' * 80
15
15
  puts changelog
16
16
  puts '-' * 80
@@ -1,4 +1,15 @@
1
- require 'rake/rdoctask'
1
+ require 'rubygems'
2
+ begin
3
+ # We prefer to use the RDoc gem over the site version.
4
+ gem 'rdoc'
5
+ rescue Gem::LoadError
6
+ end unless defined?(RDoc)
7
+
8
+ require 'rdoc/task'
9
+ require 'rake/clean'
10
+
11
+ CLOBBER.include('doc', 'ri')
12
+ CLOBBER.uniq!
2
13
 
3
14
  namespace :doc do
4
15
  desc 'Generate RDoc documentation'
@@ -8,7 +19,7 @@ namespace :doc do
8
19
  rdoc.options << '--line-numbers' << '--inline-source' <<
9
20
  '--accessor' << 'cattr_accessor=object' << '--charset' << 'utf-8'
10
21
  rdoc.template = "#{ENV['template']}.rb" if ENV['template']
11
- rdoc.rdoc_files.include('README', 'CHANGELOG', 'LICENSE')
22
+ rdoc.rdoc_files.include('README.md', 'CHANGELOG.md', 'LICENSE')
12
23
  rdoc.rdoc_files.include('lib/**/*.rb')
13
24
  end
14
25
 
@@ -16,11 +27,4 @@ namespace :doc do
16
27
  task :ri do
17
28
  sh 'rdoc --ri -o ri .'
18
29
  end
19
-
20
- desc 'Remove ri products'
21
- task :clobber_ri do
22
- rm_r 'ri' rescue nil
23
- end
24
30
  end
25
-
26
- task 'clobber' => ['doc:clobber_rdoc', 'doc:clobber_ri']
@@ -10,7 +10,7 @@ begin
10
10
  yardoc.name = 'yard'
11
11
  yardoc.options = ['--verbose']
12
12
  yardoc.files = [
13
- 'lib/**/*.rb', 'ext/**/*.c', 'README', 'CHANGELOG', 'LICENSE'
13
+ 'lib/**/*.rb', 'ext/**/*.c', 'README.md', 'CHANGELOG.md', 'LICENSE'
14
14
  ]
15
15
  end
16
16
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoparse
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bob Aman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-10 00:00:00 Z
18
+ date: 2012-02-10 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: addressable
@@ -25,28 +25,28 @@ dependencies:
25
25
  requirements:
26
26
  - - ~>
27
27
  - !ruby/object:Gem::Version
28
- hash: 3
28
+ hash: 1
29
29
  segments:
30
30
  - 2
31
31
  - 2
32
- - 2
33
- version: 2.2.2
32
+ - 3
33
+ version: 2.2.3
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: json
37
+ name: multi_json
38
38
  prerelease: false
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- hash: 11
44
+ hash: 23
45
45
  segments:
46
46
  - 1
47
- - 4
48
- - 6
49
- version: 1.4.6
47
+ - 0
48
+ - 0
49
+ version: 1.0.0
50
50
  type: :runtime
51
51
  version_requirements: *id002
52
52
  - !ruby/object:Gem::Dependency
@@ -169,11 +169,10 @@ files:
169
169
  - tasks/git.rake
170
170
  - tasks/metrics.rake
171
171
  - tasks/rdoc.rake
172
- - tasks/rubyforge.rake
173
172
  - tasks/spec.rake
174
173
  - tasks/yard.rake
175
174
  - website/index.html
176
- - CHANGELOG
175
+ - CHANGELOG.md
177
176
  - LICENSE
178
177
  - Rakefile
179
178
  - README.md
@@ -207,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
206
  requirements: []
208
207
 
209
208
  rubyforge_project: autoparse
210
- rubygems_version: 1.8.6
209
+ rubygems_version: 1.8.15
211
210
  signing_key:
212
211
  specification_version: 3
213
212
  summary: A parsing system based on JSON Schema.
data/CHANGELOG DELETED
@@ -1,31 +0,0 @@
1
- == 0.3.0
2
-
3
- * fixed handling of additional properties w/ a set schema
4
- * modified index methods to allow either raw or parsed access
5
- * modified index methods to default to parsed access
6
-
7
- == 0.2.3
8
-
9
- * fixed stupid bug in inspect method
10
-
11
- == 0.2.2
12
-
13
- * the AutoParse.generate method was changed to use an options Hash
14
- * fixed some issues around array imports and exports
15
- * schemas of type object should now correctly inherit their id URI values
16
-
17
- == 0.2.1
18
-
19
- * fixed URI resolution when base URI is missing
20
-
21
- == 0.2.0
22
-
23
- * added support for union types
24
- * added support for recursive references
25
- * fixed vestigial code from refactoring extraction
26
- * fixed issue with references when schema URI is not supplied
27
- * fixed issue with missing gem dependencies
28
-
29
- == 0.1.0
30
-
31
- * initial release
@@ -1,103 +0,0 @@
1
- namespace :gem do
2
- desc 'Package and upload to RubyForge'
3
- task :release => ['gem:package'] do |t|
4
- require 'rubyforge'
5
-
6
- v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
7
- abort "Versions don't match #{v} vs #{PROJ.version}" if v != PKG_VERSION
8
- pkg = "pkg/#{GEM_SPEC.full_name}"
9
-
10
- rf = RubyForge.new
11
- rf.configure
12
- puts 'Logging in...'
13
- rf.login
14
-
15
- c = rf.userconfig
16
- changelog = File.open('CHANGELOG') { |file| file.read }
17
- c['release_changes'] = changelog
18
- c['preformatted'] = true
19
-
20
- files = ["#{pkg}.tgz", "#{pkg}.zip", "#{pkg}.gem"]
21
-
22
- puts "Releasing #{PKG_NAME} v. #{PKG_VERSION}"
23
- rf.add_release RUBY_FORGE_PROJECT, PKG_NAME, PKG_VERSION, *files
24
- end
25
- end
26
-
27
- namespace :doc do
28
- desc 'Publish RDoc to RubyForge'
29
- task :release => ['doc:rdoc'] do
30
- require 'rake/contrib/sshpublisher'
31
- require 'yaml'
32
-
33
- config = YAML.load(
34
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
35
- )
36
- host = "#{config['username']}@rubyforge.org"
37
- remote_dir = RUBY_FORGE_PATH + '/api'
38
- local_dir = 'doc'
39
- if !File.exist?('website/api')
40
- system('mkdir website/api')
41
- end
42
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
43
- end
44
- end
45
-
46
- namespace :spec do
47
- desc 'Publish specdoc to RubyForge'
48
- task :release => ['spec:specdoc'] do
49
- require 'rake/contrib/sshpublisher'
50
- require 'yaml'
51
-
52
- config = YAML.load(
53
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
54
- )
55
- host = "#{config['username']}@rubyforge.org"
56
- remote_dir = RUBY_FORGE_PATH + '/specdoc'
57
- local_dir = 'specdoc'
58
- if !File.exist?('website/specdoc')
59
- system('mkdir website/specdoc')
60
- end
61
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
62
- end
63
-
64
- namespace :rcov do
65
- desc 'Publish coverage report to RubyForge'
66
- task :release => ['spec:rcov'] do
67
- require 'rake/contrib/sshpublisher'
68
- require 'yaml'
69
-
70
- config = YAML.load(
71
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
72
- )
73
- host = "#{config['username']}@rubyforge.org"
74
- remote_dir = RUBY_FORGE_PATH + '/coverage'
75
- local_dir = 'coverage'
76
- if !File.exist?('website/coverage')
77
- system('mkdir website/coverage')
78
- end
79
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
80
- end
81
- end
82
- end
83
-
84
- namespace :website do
85
- desc 'Publish website to RubyForge'
86
- task :init do
87
- require 'rake/contrib/sshpublisher'
88
- require 'yaml'
89
-
90
- config = YAML.load(
91
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
92
- )
93
- host = "#{config['username']}@rubyforge.org"
94
- remote_dir = RUBY_FORGE_PATH
95
- local_dir = 'website'
96
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
97
- end
98
-
99
- desc 'Publish website to RubyForge'
100
- task :release => [
101
- 'website:init', 'doc:release', 'spec:release', 'spec:rcov:release'
102
- ]
103
- end