jsonbuilder 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ *.gem
3
+ pkg
data/README CHANGED
@@ -49,11 +49,11 @@
49
49
  end
50
50
 
51
51
  def to_hash(options = {})
52
- self.serialize(Builder::Hash.new, options)
52
+ self.serialize(Builder::HashStructure.new, options)
53
53
  end
54
54
 
55
55
  def to_json(options = {})
56
- self.serialize(Builder::Json.new, options)
56
+ self.serialize(Builder::JsonFormat.new, options)
57
57
  end
58
58
 
59
59
  == Synopsis
data/Rakefile CHANGED
@@ -1,143 +1,45 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
- require 'rake/clean'
4
- require 'rake/testtask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require 'rake/rdoctask'
8
- require 'rake/contrib/rubyforgepublisher'
9
- require 'rake/contrib/sshpublisher'
10
- require 'fileutils'
11
- include FileUtils
12
-
13
- NAME = "jsonbuilder"
14
- AUTHOR = "nov"
15
- EMAIL = "nov@matake.jp"
16
- DESCRIPTION = "Builder::XmlMarkup like JsonBuilder"
17
- RUBYFORGE_PROJECT = NAME
18
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
19
- BIN_FILES = %w( )
20
-
21
- $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib"
22
- require 'lib/jsonbuilder'
23
- VERS = JsonBuilder::Version.to_version
24
- CLEAN.include ['*.gem', '.config']
25
- RDOC_OPTS = [
26
- "--title", "#{NAME} documentation",
27
- "--charset", "utf-8",
28
- "--opname", "index.html",
29
- "--line-numbers",
30
- "--main", "README",
31
- "--inline-source",
32
- ]
33
-
34
- task :default => [:spec]
35
- task :package => [:clean]
36
3
 
37
4
  begin
38
- require 'spec/rake/spectask'
39
-
40
- Spec::Rake::SpecTask.new('spec') do |t|
41
- t.spec_opts = ["-f specdoc", "-c"]
42
- t.spec_files = FileList['spec/*_spec.rb', 'spec/builder/*_spec.rb', 'spec/ext/*_spec.rb']
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = 'jsonbuilder'
8
+ gem.summary = %Q{Builder::XmlMarkup like JsonBuilder}
9
+ gem.description = %Q{Builder::XmlMarkup like JsonBuilder}
10
+ gem.email = 'nov@matake.jp'
11
+ gem.homepage = 'http://github.com/nov/jsonbuilder'
12
+ gem.authors = ['nov matake']
13
+ gem.add_dependency 'activesupport'
14
+ gem.add_development_dependency 'rspec'
15
+ gem.add_development_dependency 'rcov'
16
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
43
17
  end
44
-
18
+ Jeweler::GemcutterTasks.new
45
19
  rescue LoadError
46
- desc 'Spec rake task not available'
47
- task :spec do
48
- abort 'Spec rake task is not available. Be sure to install rspec as a gem or plugin'
49
- end
20
+ puts 'Jeweler not available. Install it with: gem install jeweler'
50
21
  end
51
22
 
52
- spec = Gem::Specification.new do |s|
53
- s.name = NAME
54
- s.version = VERS
55
- s.platform = Gem::Platform::RUBY
56
- s.has_rdoc = true
57
- s.extra_rdoc_files = ["README", "ChangeLog"]
58
- s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples)/']
59
- s.summary = DESCRIPTION
60
- s.description = DESCRIPTION
61
- s.author = AUTHOR
62
- s.email = EMAIL
63
- s.homepage = HOMEPATH
64
- s.executables = BIN_FILES
65
- s.rubyforge_project = RUBYFORGE_PROJECT
66
- s.require_path = "lib"
67
- #s.autorequire = ""
68
- s.test_files = Dir["spec/*_spec.rb"]
69
- s.files = %w(README ChangeLog Rakefile) +
70
- Dir.glob("{spec,lib}/**/*") +
71
- Dir.glob("examples/**/*.rb")
72
- s.add_dependency('builder')
23
+ require 'spec/rake/spectask'
24
+ Spec::Rake::SpecTask.new(:spec) do |spec|
25
+ spec.fail_on_error = false
26
+ spec.libs << 'lib' << 'spec'
27
+ spec.spec_files = FileList['spec/**/*_spec.rb']
73
28
  end
74
-
75
- Rake::GemPackageTask.new(spec) do |p|
76
- p.need_tar = true
77
- p.gem_spec = spec
78
- end
79
-
80
- desc "Install"
81
- task :install do
82
- name = "#{NAME}-#{VERS}.gem"
83
- sh %{rake package}
84
- sh %{sudo gem install pkg/#{name}}
85
- end
86
-
87
- desc "Uninstall"
88
- task :uninstall => [:clean] do
89
- sh %{sudo gem uninstall #{NAME}}
29
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
30
+ spec.libs << 'lib' << 'spec'
31
+ spec.pattern = 'spec/**/*_spec.rb'
32
+ spec.rcov = true
33
+ spec.rcov_opts = ['--exclude spec,gems']
90
34
  end
35
+ task :spec => :check_dependencies
36
+ task :default => :spec
91
37
 
38
+ require 'rake/rdoctask'
92
39
  Rake::RDocTask.new do |rdoc|
93
- rdoc.rdoc_dir = 'html'
94
- rdoc.options += RDOC_OPTS
95
- rdoc.template = "resh"
96
- #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
97
- if ENV['DOC_FILES']
98
- rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
99
- else
100
- rdoc.rdoc_files.include('README', 'ChangeLog')
101
- rdoc.rdoc_files.include('lib/**/*.rb')
102
- end
103
- end
104
-
105
- desc "Publish to RubyForge"
106
- task :rubyforge => [:rdoc, :package] do
107
- require 'rubyforge'
108
- Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'nov').upload
109
- end
110
-
111
- # rake release VERSION=x.y.z
112
- desc 'Package and upload the release to rubyforge.'
113
- task :release => [:clean, :package] do |t|
114
- v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
115
- abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
116
- pkg = "pkg/#{NAME}-#{VERS}"
117
-
118
- require 'rubyforge'
119
- rf = RubyForge.new.configure
120
- puts "Logging in"
121
- rf.login
122
-
123
- c = rf.userconfig
124
- c["preformatted"] = true
125
-
126
- files = [
127
- "#{pkg}.tgz",
128
- "#{pkg}.gem"
129
- ].compact
130
-
131
- puts "Releasing #{NAME} v. #{VERS}"
132
- rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
133
- end
134
-
135
- desc 'Show information about the gem.'
136
- task :debug_gem do
137
- puts spec.to_ruby
138
- end
139
-
140
- desc 'Update gem spec'
141
- task :gemspec do
142
- open("#{NAME}.gemspec", 'w').write spec.to_ruby
40
+ version = File.read('VERSION')
41
+ rdoc.rdoc_dir = 'rdoc'
42
+ rdoc.title = 'fb_graph #{version}'
43
+ rdoc.rdoc_files.include('README*')
44
+ rdoc.rdoc_files.include('lib/**/*.rb')
143
45
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -0,0 +1,77 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{jsonbuilder}
8
+ s.version = "0.3.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["nov matake"]
12
+ s.date = %q{2010-05-19}
13
+ s.description = %q{Builder::XmlMarkup like JsonBuilder}
14
+ s.email = %q{nov@matake.jp}
15
+ s.extra_rdoc_files = [
16
+ "ChangeLog",
17
+ "README"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "ChangeLog",
22
+ "README",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "jsonbuilder.gemspec",
26
+ "lib/builder/abstract.rb",
27
+ "lib/builder/hash_structure.rb",
28
+ "lib/builder/json_format.rb",
29
+ "lib/builder/xml_markup.rb",
30
+ "lib/ext/stackable_array.rb",
31
+ "lib/ext/stackable_hash.rb",
32
+ "lib/jsonbuilder.rb",
33
+ "lib/patch/active_support_json_decode.rb",
34
+ "spec/builder/array_mode_spec.rb",
35
+ "spec/builder/hash_structure_spec.rb",
36
+ "spec/builder/json_format_spec.rb",
37
+ "spec/builder/xml_markup_spec.rb",
38
+ "spec/ext/stackable_array_spec.rb",
39
+ "spec/ext/stackable_hash_spec.rb",
40
+ "spec/spec.opts",
41
+ "spec/spec_helper.rb"
42
+ ]
43
+ s.homepage = %q{http://github.com/nov/jsonbuilder}
44
+ s.rdoc_options = ["--charset=UTF-8"]
45
+ s.require_paths = ["lib"]
46
+ s.rubygems_version = %q{1.3.6}
47
+ s.summary = %q{Builder::XmlMarkup like JsonBuilder}
48
+ s.test_files = [
49
+ "spec/builder/array_mode_spec.rb",
50
+ "spec/builder/hash_structure_spec.rb",
51
+ "spec/builder/json_format_spec.rb",
52
+ "spec/builder/xml_markup_spec.rb",
53
+ "spec/ext/stackable_array_spec.rb",
54
+ "spec/ext/stackable_hash_spec.rb",
55
+ "spec/spec_helper.rb"
56
+ ]
57
+
58
+ if s.respond_to? :specification_version then
59
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
60
+ s.specification_version = 3
61
+
62
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
63
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
64
+ s.add_development_dependency(%q<rspec>, [">= 0"])
65
+ s.add_development_dependency(%q<rcov>, [">= 0"])
66
+ else
67
+ s.add_dependency(%q<activesupport>, [">= 0"])
68
+ s.add_dependency(%q<rspec>, [">= 0"])
69
+ s.add_dependency(%q<rcov>, [">= 0"])
70
+ end
71
+ else
72
+ s.add_dependency(%q<activesupport>, [">= 0"])
73
+ s.add_dependency(%q<rspec>, [">= 0"])
74
+ s.add_dependency(%q<rcov>, [">= 0"])
75
+ end
76
+ end
77
+
@@ -1,4 +1,3 @@
1
- require 'activesupport'
2
1
  require 'patch/active_support_json_decode'
3
2
 
4
3
  module Builder
@@ -1,18 +1,4 @@
1
1
  module JsonBuilder
2
- module Version
3
- MAJOR = 0
4
- MINOR = 2
5
- REVISION = 3
6
- class << self
7
- def to_version
8
- "#{MAJOR}.#{MINOR}.#{REVISION}"
9
- end
10
-
11
- def to_name
12
- "#{MAJOR}_#{MINOR}_#{REVISION}"
13
- end
14
- end
15
- end
16
2
  end
17
3
 
18
4
  require 'builder/abstract'
@@ -1,6 +1,8 @@
1
1
  # Copy of rails 2.3.2 ActiveSupport::JSON since 2.2.2 doesn't correctly decode unicode.
2
2
  require 'yaml'
3
3
  require 'strscan'
4
+ require 'active_support/core_ext'
5
+ require 'active_support/json'
4
6
 
5
7
  silence_warnings {
6
8
  module ActiveSupport
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --format
3
+ specdoc
metadata CHANGED
@@ -1,27 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
5
10
  platform: ruby
6
11
  authors:
7
- - nov
12
+ - nov matake
8
13
  autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-10-07 00:00:00 +09:00
17
+ date: 2010-05-19 00:00:00 +09:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
- name: builder
21
+ name: activesupport
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
17
30
  type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: rspec
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :development
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: rcov
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
20
48
  requirements:
21
49
  - - ">="
22
50
  - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
23
53
  version: "0"
24
- version:
54
+ type: :development
55
+ version_requirements: *id003
25
56
  description: Builder::XmlMarkup like JsonBuilder
26
57
  email: nov@matake.jp
27
58
  executables: []
@@ -29,20 +60,15 @@ executables: []
29
60
  extensions: []
30
61
 
31
62
  extra_rdoc_files:
32
- - README
33
63
  - ChangeLog
34
- files:
35
64
  - README
65
+ files:
66
+ - .gitignore
36
67
  - ChangeLog
68
+ - README
37
69
  - Rakefile
38
- - spec/builder/array_mode_spec.rb
39
- - spec/builder/hash_structure_spec.rb
40
- - spec/builder/json_format_spec.rb
41
- - spec/builder/xml_markup_spec.rb
42
- - spec/ext/stackable_array_spec.rb
43
- - spec/ext/stackable_hash_spec.rb
44
- - spec/jsonbuilder_spec.rb
45
- - spec/spec_helper.rb
70
+ - VERSION
71
+ - jsonbuilder.gemspec
46
72
  - lib/builder/abstract.rb
47
73
  - lib/builder/hash_structure.rb
48
74
  - lib/builder/json_format.rb
@@ -51,44 +77,49 @@ files:
51
77
  - lib/ext/stackable_hash.rb
52
78
  - lib/jsonbuilder.rb
53
79
  - lib/patch/active_support_json_decode.rb
80
+ - spec/builder/array_mode_spec.rb
81
+ - spec/builder/hash_structure_spec.rb
82
+ - spec/builder/json_format_spec.rb
83
+ - spec/builder/xml_markup_spec.rb
84
+ - spec/ext/stackable_array_spec.rb
85
+ - spec/ext/stackable_hash_spec.rb
86
+ - spec/spec.opts
87
+ - spec/spec_helper.rb
54
88
  has_rdoc: true
55
- homepage: http://jsonbuilder.rubyforge.org
89
+ homepage: http://github.com/nov/jsonbuilder
56
90
  licenses: []
57
91
 
58
92
  post_install_message:
59
93
  rdoc_options:
60
- - --title
61
- - jsonbuilder documentation
62
- - --charset
63
- - utf-8
64
- - --opname
65
- - index.html
66
- - --line-numbers
67
- - --main
68
- - README
69
- - --inline-source
70
- - --exclude
71
- - ^(examples)/
94
+ - --charset=UTF-8
72
95
  require_paths:
73
96
  - lib
74
97
  required_ruby_version: !ruby/object:Gem::Requirement
75
98
  requirements:
76
99
  - - ">="
77
100
  - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
78
103
  version: "0"
79
- version:
80
104
  required_rubygems_version: !ruby/object:Gem::Requirement
81
105
  requirements:
82
106
  - - ">="
83
107
  - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
84
110
  version: "0"
85
- version:
86
111
  requirements: []
87
112
 
88
- rubyforge_project: jsonbuilder
89
- rubygems_version: 1.3.5
113
+ rubyforge_project:
114
+ rubygems_version: 1.3.6
90
115
  signing_key:
91
116
  specification_version: 3
92
117
  summary: Builder::XmlMarkup like JsonBuilder
93
118
  test_files:
94
- - spec/jsonbuilder_spec.rb
119
+ - spec/builder/array_mode_spec.rb
120
+ - spec/builder/hash_structure_spec.rb
121
+ - spec/builder/json_format_spec.rb
122
+ - spec/builder/xml_markup_spec.rb
123
+ - spec/ext/stackable_array_spec.rb
124
+ - spec/ext/stackable_hash_spec.rb
125
+ - spec/spec_helper.rb
@@ -1,13 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
- describe JsonBuilder::Version, "#to_version" do
4
- it "should return version in 'X.Y.Z' format" do
5
- JsonBuilder::Version.to_version.should =~ /\d+\.\d+\.\d+/
6
- end
7
- end
8
-
9
- describe JsonBuilder::Version, "#to_name" do
10
- it "should return version in 'X_Y_Z' format" do
11
- JsonBuilder::Version.to_name.should =~ /\d+_\d+_\d+/
12
- end
13
- end