fjson 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,6 @@
1
+ 2006-11-04 (0.0.8)
2
+ * Fixed build issues. Better spec coverage on build.
3
+
1
4
  2006-11-03 (0.0.7)
2
5
  * Fixed reference to mkmf.
3
6
 
@@ -17,4 +20,4 @@
17
20
  * Gem now compiles the extension rather than just distribute the binary.
18
21
 
19
22
  2006-10-10 (0.0.1)
20
- * Initial Rubyforge Version. Forked from ruby json library. http://json.rubyforge.org
23
+ * Initial Rubyforge Version. Forked from ruby json library. http://json.rubyforge.org
data/Rakefile CHANGED
@@ -1,109 +1,51 @@
1
1
  dir = File.dirname(__FILE__)
2
2
  require File.expand_path("#{dir}/rake_helper")
3
- require 'rake/gempackagetask'
4
- require 'rake/contrib/rubyforgepublisher'
5
- require 'rake/clean'
6
- require 'rake/testtask'
7
- require 'rake/rdoctask'
8
-
9
- task :default => [ :compile ] do
10
- end
11
-
12
- task :compile => [
13
- :json_ext,
14
- :state_ext,
15
- :object_ext,
16
- :integer_ext,
17
- :float_ext,
18
- :string_ext,
19
- :true_class_ext,
20
- :false_class_ext,
21
- :nil_class_ext,
22
- :array_ext,
23
- :hash_ext
24
- ] do
25
- end
26
-
27
- task :spec => [:compile, :install] do
28
- require File.expand_path("#{dir}/spec/spec_suite")
29
- end
30
-
31
- task :lib do
32
- directory "lib"
33
- end
34
-
35
- fjson_extensions = [
36
- "json_ext",
37
- "state_ext",
38
- "extensions/object_ext",
39
- "extensions/integer_ext",
40
- "extensions/float_ext",
41
- "extensions/string_ext",
42
- "extensions/true_class_ext",
43
- "extensions/false_class_ext",
44
- "extensions/nil_class_ext",
45
- "extensions/array_ext",
46
- "extensions/hash_ext"
47
- ]
48
-
49
- fjson_extensions.each do |ext|
50
- setup_mkmf_extension ext
51
- end
52
-
53
- task :install do
54
- fjson_extensions.each do |extension_path|
55
- library_path = library_path(extension_path)
56
- raise "Extension binary for #{extension_path} does not exist. Did you run rake compile?" unless library_path
57
- cp build_path(extension_path), library_path(extension_path)
58
- end
59
- end
60
-
61
- task :cleanup do
62
- fjson_extensions.each do |extension_path|
63
- library_path = library_path(extension_path)
64
- rm library_path if library_path && File.exists?(library_path)
65
- rake_file_path = "#{build_path(extension_path)}/Rakefile"
66
- rm rake_file_path if rake_file_path && File.exists?(rake_file_path)
67
- end
68
- end
69
-
70
- def build_path(relative_extension_path)
71
- basename = "#{File.dirname(__FILE__)}/ext/#{relative_extension_path}/#{File.basename(relative_extension_path)}"
72
- if File.exists?("#{basename}.so")
73
- return "#{basename}.so"
74
- elsif File.exists?("#{basename}.bundle")
75
- return "#{basename}.bundle"
76
- end
77
- return nil
78
- end
79
-
80
- def library_path(relative_extension_path)
81
- build_path = build_path(relative_extension_path)
82
- return nil unless build_path
83
- extname = File.extname(build_path)
84
- library_directory_path = File.dirname(__FILE__) + "/lib/" + File.dirname(relative_extension_path)
85
- binary_name = "#{File.basename(relative_extension_path)}#{extname}"
86
- "#{library_directory_path}/#{binary_name}"
87
- end
88
-
89
3
  def win32?
90
4
  ENV["target_platform"] == "win32"
91
5
  end
92
6
 
93
- if win32?
94
- #Rake::Task[].invoke
95
- end
7
+ rake_builder = MkmfRakeBuilder.new
8
+ rake_builder.project_dir = File.dirname(__FILE__)
9
+ rake_builder.rake_application = Rake.application
10
+ rake_builder.rake_tasks = Rake::Task
11
+ rake_builder.rake_file_tasks = Rake::FileTask
12
+ rake_builder.dir_class = Dir
13
+ rake_builder.file_class = File
14
+ rake_builder.file_extension = (RUBY_PLATFORM =~ /darwin/) ? "bundle" : "so"
15
+ fjson_extensions = rake_builder.extensions_to_build = [
16
+ [:json_ext, "json_ext"],
17
+ [:state_ext, "state_ext"],
18
+ [:object_ext, "extensions/object_ext"],
19
+ [:integer_ext, "extensions/integer_ext"],
20
+ [:float_ext, "extensions/float_ext"],
21
+ [:string_ext, "extensions/string_ext"],
22
+ [:true_class_ext, "extensions/true_class_ext"],
23
+ [:false_class_ext, "extensions/false_class_ext"],
24
+ [:nil_class_ext, "extensions/nil_class_ext"],
25
+ [:array_ext, "extensions/array_ext"],
26
+ [:hash_ext, "extensions/hash_ext"]
27
+ ]
28
+ rake_builder.extconf_arguments = "-I /usr/local/lib/ruby-mingw32/lib/ruby/1.8/i386-mingw32" if win32?
29
+
30
+ rake_builder.build_default_task
31
+ rake_builder.build_compile_task
32
+ rake_builder.build_spec_task
33
+ rake_builder.build_lib_task
34
+ rake_builder.build_extension_compile_tasks
35
+ rake_builder.build_install_task
36
+ rake_builder.build_cleanup_task
96
37
 
97
38
  PKG_NAME = "fjson"
98
- PKG_VERSION = "0.0.7"
39
+ PKG_VERSION = "0.0.8"
99
40
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
100
41
  PKG_FILES = FileList[
101
42
  '[A-Z]*',
102
43
  '*.rb',
103
44
  'lib/**/*.rb',
104
- 'ext/**/*.{h,c,rb}',
105
45
  'spec/**/*.rb'
106
46
  ]
47
+ executable_extensions = (win32?) ? 'lib/**/*.so' : 'ext/**/*.{h,c,rb}'
48
+ PKG_FILES.include(executable_extensions)
107
49
 
108
50
  spec = Gem::Specification.new do |s|
109
51
  s.name = PKG_NAME
@@ -115,6 +57,7 @@ spec = Gem::Specification.new do |s|
115
57
  EOF
116
58
  s.test_files = Dir.glob('spec/*_spec.rb')
117
59
  s.description = s.summary
60
+ s.platform = (win32?) ? Gem::Platform::WIN32 : Gem::Platform::RUBY
118
61
 
119
62
  s.files = PKG_FILES.to_a
120
63
  s.require_path = 'lib'
@@ -130,13 +73,10 @@ spec = Gem::Specification.new do |s|
130
73
  s.homepage = "http://fjson.rubyforge.org"
131
74
  s.rubyforge_project = "fjson"
132
75
 
133
- s.extensions = ["Rakefile"]
76
+ s.extensions = ["Rakefile"] unless win32?
134
77
 
78
+ s.add_dependency "rspec", ">=0.6.4"
135
79
  #s.add_dependency "mkrf", ">=0.1.2"
136
-
137
- if win32?
138
-
139
- end
140
80
  end
141
81
 
142
82
  Rake::GemPackageTask.new(spec) do |pkg|
@@ -974,7 +974,7 @@ module JSON
974
974
  #vbox.border_width = 0
975
975
 
976
976
  @treeview = JSONTreeView.new(self)
977
- @treeview.signal_connect(:'cursor-changed') do
977
+ @treeview.signal_connect(:"cursor-changed") do
978
978
  display_status('')
979
979
  end
980
980
 
@@ -0,0 +1,177 @@
1
+ class MkmfRakeBuilder
2
+ attr_writer :project_dir,
3
+ :rake_application,
4
+ :rake_tasks,
5
+ :rake_file_tasks,
6
+ :dir_class,
7
+ :file_extension,
8
+ :extensions_to_build,
9
+ :file_class,
10
+ :extconf_arguments
11
+
12
+ def initialize
13
+ @extconf_file = "extconf.mkmf.rb"
14
+ end
15
+
16
+ def build_default_task
17
+ task(:default => [ :compile ]) do
18
+ end
19
+ end
20
+
21
+ def build_compile_task
22
+ task :compile => @extensions_to_build.collect {|ext| ext.first} do
23
+ end
24
+ end
25
+
26
+ def build_spec_task
27
+ task :spec => [:compile, :install] do
28
+ dir = @project_dir
29
+ require expand_path("#{dir}/spec/spec_suite")
30
+ end
31
+ end
32
+
33
+ def build_lib_task
34
+ task :lib do
35
+ directory "lib"
36
+ end
37
+ end
38
+
39
+ def build_extension_compile_tasks
40
+ @extensions_to_build.each do |data|
41
+ build_extension_compile_task(data[1])
42
+ end
43
+ end
44
+
45
+ def build_install_task
46
+ extension_paths = self.extension_paths
47
+ task :install do
48
+ extension_paths.each do |extension_path|
49
+ library_path = library_path(extension_path)
50
+ raise "Extension binary for #{extension_path} does not exist. Did you run rake compile?" unless library_path
51
+ build_path = build_path(extension_path)
52
+ raise "File #{build_path} does not exist" unless file_exists?(build_path)
53
+ cp build_path, library_path(extension_path)
54
+ end
55
+ end
56
+ extension_paths
57
+ end
58
+
59
+ def build_cleanup_task
60
+ extension_paths = self.extension_paths
61
+ task :cleanup do
62
+ extension_paths.each do |extension_path|
63
+ library_path = library_path(extension_path)
64
+ rm library_path if library_path && file_exists?(library_path)
65
+
66
+ build_file_path = build_path(extension_path)
67
+ rm build_file_path if build_file_path && file_exists?(build_file_path)
68
+
69
+ build_object_path = "#{build_path_without_file_extension(extension_path)}.o"
70
+ rm build_object_path if build_object_path && file_exists?(build_object_path)
71
+
72
+ build_dir = build_dir(extension_path)
73
+ make_file_path = "#{build_dir}/Makefile"
74
+ rm make_file_path if make_file_path && file_exists?(make_file_path)
75
+ end
76
+ end
77
+ extension_paths
78
+ end
79
+
80
+ protected
81
+ def extension_paths
82
+ @extensions_to_build.collect {|data| data[1]}
83
+ end
84
+
85
+ def build_extension_compile_task(extension_path)
86
+ extension_dir = "ext/#{extension_path}"
87
+ extension = file_name(extension_path)
88
+ extension_path = "#{extension_dir}/#{extension}.#{@file_extension}"
89
+
90
+ desc "Builds the #{extension} extension"
91
+ task extension.to_sym => ["#{extension_dir}/Makefile", extension_path ]
92
+
93
+ file "#{extension_dir}/Makefile" => ["#{extension_dir}/#{@extconf_file}"] do
94
+ extconf extension_dir
95
+ end
96
+
97
+ ext_files = FileList[
98
+ "#{extension_dir}/*.c",
99
+ "#{extension_dir}/*.h",
100
+ "#{extension_dir}/#{@extconf_file}",
101
+ "#{extension_dir}/Makefile",
102
+ "lib"
103
+ ]
104
+ file extension_path => ext_files do
105
+ make extension_dir
106
+ end
107
+ end
108
+
109
+ def extconf(dir)
110
+ chdir(dir) do
111
+ ruby "#{@extconf_arguments} #{@extconf_file}"
112
+ end
113
+ end
114
+
115
+ def ruby(file)
116
+ sh("ruby #{file}")
117
+ end
118
+
119
+ def make(makedir)
120
+ chdir(makedir) do
121
+ sh("make")
122
+ end
123
+ end
124
+
125
+ def chdir(dir, &block)
126
+ @dir_class.chdir(dir) do
127
+ yield
128
+ end
129
+ end
130
+
131
+ def desc(comment)
132
+ @rake_application.last_comment = comment
133
+ end
134
+
135
+ def task(*args, &block)
136
+ @rake_tasks.define_task(*args, &block)
137
+ end
138
+
139
+ def file(*args, &block)
140
+ @rake_file_tasks.define_task(*args, &block)
141
+ end
142
+
143
+ def build_dir(relative_extension_path)
144
+ "#{@project_dir}/ext/#{relative_extension_path}"
145
+ end
146
+
147
+ def build_path(relative_extension_path)
148
+ basename = build_path_without_file_extension(relative_extension_path)
149
+ "#{basename}.#{@file_extension}"
150
+ end
151
+
152
+ def build_path_without_file_extension(relative_extension_path)
153
+ "#{build_dir(relative_extension_path)}/#{file_name(relative_extension_path)}"
154
+ end
155
+
156
+ def library_path(relative_extension_path)
157
+ library_directory_path = "#{@project_dir}/lib/#{file_directory(relative_extension_path)}"
158
+ binary_name = "#{file_name(relative_extension_path)}.#{@file_extension}"
159
+ "#{library_directory_path}/#{binary_name}"
160
+ end
161
+
162
+ def expand_path(path)
163
+ @file_class.expand_path path
164
+ end
165
+
166
+ def file_exists?(path)
167
+ @file_class.exists? path
168
+ end
169
+
170
+ def file_name(path)
171
+ @file_class.basename path
172
+ end
173
+
174
+ def file_directory(path)
175
+ @file_class.dirname path
176
+ end
177
+ end
@@ -1,53 +1,8 @@
1
- def setup_mkrf_extension(extension_path, extension=nil)
2
- ext_dir = "ext/#{extension_path}"
3
- extension = File.basename(extension_path) if extension.nil?
4
- ext_so = "#{ext_dir}/#{extension}.#{Config::CONFIG['DLEXT']}"
5
-
6
- desc "Builds the #{extension} extension"
7
- task extension.to_sym => ["#{ext_dir}/Rakefile", ext_so ]
8
-
9
- file "#{ext_dir}/Rakefile" => ["#{ext_dir}/extconf.rb"] do
10
- extconf "#{ext_dir}"
11
- end
12
-
13
- create_so_file_tasks(ext_dir, ext_so)
14
- end
15
-
16
- def setup_mkmf_extension(extension_path, extension=nil)
17
- ext_dir = "ext/#{extension_path}"
18
- extension = File.basename(extension_path) if extension.nil?
19
- ext_so = "#{ext_dir}/#{extension}.#{Config::CONFIG['DLEXT']}"
20
-
21
- desc "Builds the #{extension} extension"
22
- task extension.to_sym => ["#{ext_dir}/Makefile", ext_so ]
23
-
24
- file "#{ext_dir}/Makefile" => ["#{ext_dir}/extconf.mkmf.rb"] do
25
- extconf "#{ext_dir}"
26
- end
27
-
28
- create_so_file_tasks(ext_dir, ext_so)
29
- end
30
-
31
-
32
- def create_so_file_tasks(ext_dir, ext_so)
33
- ext_files = FileList[
34
- "#{ext_dir}/*.c",
35
- "#{ext_dir}/*.h",
36
- "#{ext_dir}/extconf.rb",
37
- "#{ext_dir}/Rakefile",
38
- "lib"
39
- ]
40
- file ext_so => ext_files do
41
- rake ext_dir
42
- end
43
- end
44
-
45
- def extconf(dir)
46
- Dir.chdir(dir) do ruby "extconf.rb" end
47
- end
48
-
49
- def rake(rakedir)
50
- Dir.chdir(rakedir) do
51
- sh("rake")
52
- end
53
- end
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/contrib/rubyforgepublisher'
4
+ require 'rake/clean'
5
+ require 'rake/testtask'
6
+ require 'rake/rdoctask'
7
+ dir = File.dirname(__FILE__)
8
+ require "#{dir}/mkmf_rake_builder"
@@ -0,0 +1,223 @@
1
+ dir = File.dirname(__FILE__)
2
+ require "#{dir}/spec_helper"
3
+
4
+ context "A MkmfRakeBuilder" do
5
+ setup do
6
+ @builder = MkmfRakeBuilder.new
7
+
8
+ dir = File.dirname(__FILE__)
9
+ @project_dir = @builder.project_dir = "/project/dir"
10
+ @rake_application = @builder.rake_application = mock("rake_application")
11
+ @rake_tasks = @builder.rake_tasks = mock("rake_tasks")
12
+ @rake_file_tasks = @builder.rake_file_tasks = mock("rake_file_tasks")
13
+ @dir_class = @builder.dir_class = mock("dir_class")
14
+ @file_class = @builder.file_class = File
15
+ end
16
+
17
+ specify "should build the default task" do
18
+ @rake_tasks.should_receive(:define_task).with({:default => [ :compile ]})
19
+ @builder.build_default_task
20
+ end
21
+
22
+ specify "should build the compile task" do
23
+ extensions_to_build = @builder.extensions_to_build = [[:foo, "foo"], [:bar, "bar"]]
24
+ @rake_tasks.should_receive(:define_task).with({:compile => [:foo, :bar]})
25
+ @builder.build_compile_task
26
+ end
27
+
28
+ specify "should build spec task to require spec suite" do
29
+ spec_task = nil
30
+ @rake_tasks.should_receive(:define_task).with({:spec => [:compile, :install]}).
31
+ and_return{|definition, spec_task| spec_task = spec_task}
32
+ @builder.build_spec_task
33
+
34
+ require_args = nil
35
+ @builder.define_instance_method :require do |*args|
36
+ require_args = args
37
+ end
38
+ spec_task.call
39
+ require_args.should_equal ["/project/dir/spec/spec_suite"]
40
+ end
41
+
42
+ specify "should build lib task to create the lib directory" do
43
+ spec_task = nil
44
+ @rake_tasks.should_receive(:define_task).with(:lib).
45
+ and_return{|definition, spec_task| spec_task = spec_task}
46
+ @builder.build_lib_task
47
+
48
+ directory_args = nil
49
+ @builder.define_instance_method :directory do |*args|
50
+ directory_args = args
51
+ end
52
+ spec_task.call
53
+ directory_args.should_equal ["lib"]
54
+ end
55
+
56
+ specify "should build all extension compile tasks" do
57
+ extensions_to_build = @builder.extensions_to_build = [[:foo, "foo"], [:bar, "bar"]]
58
+ specify_build_extension_compile_task("foo", "foo")
59
+ specify_build_extension_compile_task("bar", "bar")
60
+ @builder.build_extension_compile_tasks
61
+ end
62
+
63
+ specify "should build extension compile task that creates a makefile and executable" do
64
+ extension_path = "extension/path"
65
+ class << @builder
66
+ public :build_extension_compile_task
67
+ end
68
+ makefile_task, executable_task = specify_build_extension_compile_task(extension_path, "path") do
69
+ @builder.build_extension_compile_task(extension_path)
70
+ end
71
+
72
+ specify_makefile_task(makefile_task)
73
+ specify_executable_task(executable_task)
74
+ end
75
+
76
+ def specify_makefile_task(makefile_task)
77
+ dir_class = @builder.dir_class = mock("dir_class_for_makefile")
78
+ @builder.extconf_arguments = "extconf_arguments"
79
+ makefile_chdir_task = nil
80
+ dir_class.should_receive(:chdir).with("ext/extension/path").
81
+ and_return do |name, makefile_chdir_task|
82
+ makefile_chdir_task = makefile_chdir_task
83
+ end
84
+ makefile_task.call
85
+
86
+ sh_args = []
87
+ @builder.define_instance_method :sh do |*args|
88
+ sh_args << args
89
+ end
90
+ makefile_chdir_task.call
91
+ sh_args.should_equal [["ruby extconf_arguments extconf.mkmf.rb"]]
92
+ end
93
+
94
+ def specify_executable_task(executable_task)
95
+ dir_class = @builder.dir_class = mock("dir_class_for_executable")
96
+ executable_chdir_task = nil
97
+ dir_class.should_receive(:chdir).with("ext/extension/path").
98
+ and_return do |name, executable_chdir_task|
99
+ executable_chdir_task = executable_chdir_task
100
+ end
101
+ executable_task.call
102
+
103
+ sh_args = []
104
+ @builder.define_instance_method :sh do |*args|
105
+ sh_args << args
106
+ end
107
+ executable_chdir_task.call
108
+ sh_args.should_equal [["make"]]
109
+ end
110
+
111
+ specify "should build install task to install all of the compiled extensions" do
112
+ extensions_to_build = @builder.extensions_to_build = [[:foo, "extensions/foo"], [:bar, "extensions/bar"]]
113
+ file_extension = @builder.file_extension = "file_extension"
114
+ rake_task = nil
115
+ @rake_tasks.should_receive(:define_task).with(:install).
116
+ and_return {|name, rake_task| rake_task = rake_task}
117
+ @builder.build_install_task.should_equal ["extensions/foo", "extensions/bar"]
118
+
119
+ file_class = @builder.file_class = mock("file_class")
120
+ file_class.should_receive(:dirname).at_least(1).with("extensions/foo").and_return("extensions")
121
+ file_class.should_receive(:dirname).at_least(1).with("extensions/bar").and_return("extensions")
122
+ file_class.should_receive(:basename).at_least(1).with("extensions/foo").and_return("foo")
123
+ file_class.should_receive(:basename).at_least(1).with("extensions/bar").and_return("bar")
124
+ file_class.should_receive(:exists?).at_least(1).
125
+ with("/project/dir/ext/extensions/foo/foo.file_extension").and_return(true)
126
+ file_class.should_receive(:exists?).at_least(1).
127
+ with("/project/dir/ext/extensions/bar/bar.file_extension").and_return(true)
128
+
129
+ cp_args = []
130
+ @builder.define_instance_method :cp do |*args|
131
+ cp_args << args
132
+ end
133
+ rake_task.call
134
+
135
+ cp_args.should_equal [
136
+ ["/project/dir/ext/extensions/foo/foo.file_extension", "/project/dir/lib/extensions/foo.file_extension"],
137
+ ["/project/dir/ext/extensions/bar/bar.file_extension", "/project/dir/lib/extensions/bar.file_extension"]
138
+ ]
139
+ end
140
+
141
+ specify "should build cleanup task that removes all of the compiled files" do
142
+ extensions_to_build = @builder.extensions_to_build = [[:foo, "extensions/foo"], [:bar, "extensions/bar"]]
143
+ file_extension = @builder.file_extension = "file_extension"
144
+ cleanup_task = nil
145
+ @rake_tasks.should_receive(:define_task).with(:cleanup).
146
+ and_return do |name, cleanup_task|
147
+ cleanup_task = cleanup_task
148
+ end
149
+ @builder.build_cleanup_task.should_equal ["extensions/foo", "extensions/bar"]
150
+
151
+ file_class = @builder.file_class = mock("file_class")
152
+ file_class.should_receive(:dirname).at_least(1).with("extensions/foo").and_return("extensions")
153
+ file_class.should_receive(:dirname).at_least(1).with("extensions/bar").and_return("extensions")
154
+ file_class.should_receive(:basename).at_least(1).with("extensions/foo").and_return("foo")
155
+ file_class.should_receive(:basename).at_least(1).with("extensions/bar").and_return("bar")
156
+ file_class.should_receive(:exists?).at_least(1).
157
+ with("/project/dir/ext/extensions/foo/foo.file_extension").and_return(true)
158
+ file_class.should_receive(:exists?).at_least(1).
159
+ with("/project/dir/ext/extensions/bar/bar.file_extension").and_return(true)
160
+ file_class.should_receive(:exists?).at_least(1).
161
+ with("/project/dir/ext/extensions/foo/foo.o").and_return(true)
162
+ file_class.should_receive(:exists?).at_least(1).
163
+ with("/project/dir/ext/extensions/bar/bar.o").and_return(true)
164
+ file_class.should_receive(:exists?).at_least(1).
165
+ with("/project/dir/lib/extensions/foo.file_extension").and_return(true)
166
+ file_class.should_receive(:exists?).at_least(1).
167
+ with("/project/dir/lib/extensions/bar.file_extension").and_return(true)
168
+ file_class.should_receive(:exists?).at_least(1).
169
+ with("/project/dir/ext/extensions/foo/Makefile").and_return(true)
170
+ file_class.should_receive(:exists?).at_least(1).
171
+ with("/project/dir/ext/extensions/bar/Makefile").and_return(true)
172
+
173
+
174
+ rm_args = []
175
+ @builder.define_instance_method :rm do |*args|
176
+ rm_args << args
177
+ end
178
+ cleanup_task.call
179
+
180
+ rm_args.should_equal [
181
+ ["/project/dir/lib/extensions/foo.file_extension"],
182
+ ["/project/dir/ext/extensions/foo/foo.file_extension"],
183
+ ["/project/dir/ext/extensions/foo/foo.o"],
184
+ ["/project/dir/ext/extensions/foo/Makefile"],
185
+ ["/project/dir/lib/extensions/bar.file_extension"],
186
+ ["/project/dir/ext/extensions/bar/bar.file_extension"],
187
+ ["/project/dir/ext/extensions/bar/bar.o"],
188
+ ["/project/dir/ext/extensions/bar/Makefile"],
189
+ ]
190
+ end
191
+
192
+ def specify_build_extension_compile_task(extension_path, extension)
193
+ file_extension = @builder.file_extension = "file_extension"
194
+ @rake_application.should_receive(:last_comment=).with("Builds the #{extension} extension")
195
+ expected_executable = "ext/#{extension_path}/#{extension}.file_extension"
196
+ @rake_tasks.should_receive(:define_task).with({extension.to_sym => ["ext/#{extension_path}/Makefile", expected_executable ]})
197
+ makefile_task = nil
198
+ @rake_file_tasks.should_receive(:define_task).
199
+ with({"ext/#{extension_path}/Makefile" => ["ext/#{extension_path}/extconf.mkmf.rb"]}).
200
+ and_return do |task_name, makefile_task|
201
+ makefile_task = makefile_task
202
+ end
203
+
204
+ file_list = FileList[
205
+ "ext/#{extension_path}/*.c",
206
+ "ext/#{extension_path}/*.h",
207
+ "ext/#{extension_path}/extconf.mkmf.rb",
208
+ "ext/#{extension_path}/Makefile",
209
+ "lib"
210
+ ]
211
+ executable_task = nil
212
+ @rake_file_tasks.should_receive(:define_task).with({expected_executable => file_list}).
213
+ and_return do |task_name, executable_task|
214
+ executable_task = executable_task
215
+ end
216
+
217
+ yield if block_given?
218
+ [makefile_task, executable_task]
219
+ end
220
+
221
+ def specify_make_executable_task(expected_executable, extension_path)
222
+ end
223
+ end
@@ -0,0 +1,9 @@
1
+ dir = File.dirname(__FILE__)
2
+ require "#{dir}/spec_helper"
3
+ require "#{dir}/../rake_helper"
4
+
5
+ context "A Rake Helper" do
6
+ specify "should setup mkmf extensions" do
7
+
8
+ end
9
+ end
@@ -1,6 +1,7 @@
1
+ require 'rubygems'
1
2
  require 'spec'
2
3
  dir = File.dirname(__FILE__)
3
- args = ARGV.dup
4
+ require "#{dir}/../rake_helper"
4
5
 
5
6
  class Object
6
7
  def metaclass
@@ -11,17 +12,3 @@ class Object
11
12
  metaclass.__send__(:define_method, sym, &block)
12
13
  end
13
14
  end
14
-
15
- unless args.include?("-f") || args.include?("--format")
16
- args << "--format"
17
- args << "specdoc"
18
- end
19
- args << $0
20
-
21
- $context_runner = ::Spec::Runner::OptionParser.create_context_runner(args, false, STDERR, STDOUT)
22
-
23
- at_exit do
24
- unless context_runner.instance_eval {@reporter}.instance_eval {@start_time}
25
- context_runner.run(false)
26
- end
27
- end
@@ -1,3 +1,21 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+
4
+ args = ARGV.dup
5
+ unless args.include?("-f") || args.include?("--format")
6
+ args << "--format"
7
+ args << "specdoc"
8
+ end
9
+ args << $0
10
+
11
+ $context_runner = ::Spec::Runner::OptionParser.create_context_runner(args, false, STDERR, STDOUT)
12
+
13
+ at_exit do
14
+ unless context_runner.instance_eval {@reporter}.instance_eval {@start_time}
15
+ context_runner.run(false)
16
+ end
17
+ end
18
+
1
19
  dir = File.dirname(__FILE__)
2
20
 
3
21
  Dir["#{dir}/**/*_spec.rb"].each do |file|
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: fjson
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.7
7
- date: 2006-11-03 00:00:00 -08:00
6
+ version: 0.0.8
7
+ date: 2006-11-04 00:00:00 -08:00
8
8
  summary: This library is for parsing JSON strings and unparsing ruby data structures. This library is a fork of Florian Frank's JSON library with key parts implemented in C for performance improvements.
9
9
  require_paths:
10
10
  - lib
@@ -37,12 +37,31 @@ files:
37
37
  - hash_benchmark.rb
38
38
  - rake_helper.rb
39
39
  - install.rb
40
+ - mkmf_rake_builder.rb
40
41
  - lib/parser.rb
41
42
  - lib/fjson.rb
42
43
  - lib/extensions/kernel.rb
43
44
  - lib/extensions/class.rb
44
45
  - lib/extensions/string.rb
45
46
  - lib/json/editor.rb
47
+ - spec/rake_helper_spec.rb
48
+ - spec/true_class_spec.rb
49
+ - spec/float_spec.rb
50
+ - spec/string_spec.rb
51
+ - spec/object_spec.rb
52
+ - spec/nil_class_spec.rb
53
+ - spec/array_spec.rb
54
+ - spec/spec_helper.rb
55
+ - spec/false_class_spec.rb
56
+ - spec/string_when_not_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
57
+ - spec/state_spec.rb
58
+ - spec/hash_spec.rb
59
+ - spec/spec_suite.rb
60
+ - spec/integer_spec.rb
61
+ - spec/string_when_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
62
+ - spec/string_with_latin1_character_set_json_spec.rb
63
+ - spec/mkmf_rake_builder_spec.rb
64
+ - spec/string_with_utf8_values_when_supporting_unicode_json_spec.rb
46
65
  - ext/extensions/false_class_ext/false_class_ext.h
47
66
  - ext/extensions/hash_ext/hash_ext.h
48
67
  - ext/extensions/true_class_ext/true_class_ext.h
@@ -87,23 +106,8 @@ files:
87
106
  - ext/state_ext/extconf.rb
88
107
  - ext/json_ext/extconf.mkmf.rb
89
108
  - ext/json_ext/extconf.rb
90
- - spec/true_class_spec.rb
91
- - spec/float_spec.rb
92
- - spec/string_spec.rb
93
- - spec/object_spec.rb
94
- - spec/nil_class_spec.rb
95
- - spec/array_spec.rb
96
- - spec/spec_helper.rb
97
- - spec/false_class_spec.rb
98
- - spec/string_when_not_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
99
- - spec/state_spec.rb
100
- - spec/hash_spec.rb
101
- - spec/spec_suite.rb
102
- - spec/integer_spec.rb
103
- - spec/string_when_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
104
- - spec/string_with_latin1_character_set_json_spec.rb
105
- - spec/string_with_utf8_values_when_supporting_unicode_json_spec.rb
106
109
  test_files:
110
+ - spec/rake_helper_spec.rb
107
111
  - spec/true_class_spec.rb
108
112
  - spec/float_spec.rb
109
113
  - spec/string_spec.rb
@@ -117,6 +121,7 @@ test_files:
117
121
  - spec/integer_spec.rb
118
122
  - spec/string_when_supporting_unicode_and_kcode_is_not_utf8_json_spec.rb
119
123
  - spec/string_with_latin1_character_set_json_spec.rb
124
+ - spec/mkmf_rake_builder_spec.rb
120
125
  - spec/string_with_utf8_values_when_supporting_unicode_json_spec.rb
121
126
  rdoc_options: []
122
127
 
@@ -128,5 +133,13 @@ extensions:
128
133
  - Rakefile
129
134
  requirements: []
130
135
 
131
- dependencies: []
132
-
136
+ dependencies:
137
+ - !ruby/object:Gem::Dependency
138
+ name: rspec
139
+ version_requirement:
140
+ version_requirements: !ruby/object:Gem::Version::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 0.6.4
145
+ version: