rake-builder 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,6 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
1
+ load File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ require 'json'
2
4
 
3
5
  describe 'when handling generated files' do
4
6
 
@@ -13,7 +15,7 @@ describe 'when handling generated files' do
13
15
  'rake-builder-testfile.txt',
14
16
  @project.makedepend_file,
15
17
  @project.target ],
16
- SPEC_PATH )
18
+ RakeBuilderHelper::SPEC_PATH )
17
19
  end
18
20
 
19
21
  after( :each ) do
@@ -25,10 +27,10 @@ describe 'when handling generated files' do
25
27
  end
26
28
 
27
29
  it 'lists generated files, via the task' do
28
- output = capturing_output do
30
+ stdout, _ = capturing_output do
29
31
  Rake::Task[ 'generated_files' ].invoke
30
32
  end
31
- eval( output ).should =~ @expected_generated
33
+ JSON.load(stdout). should =~ @expected_generated
32
34
  end
33
35
 
34
36
  it 'removes generated files with \'clean\'' do
@@ -50,7 +52,7 @@ describe 'when adding generated files' do
50
52
 
51
53
  before( :each ) do
52
54
  @file = 'foobar.txt'
53
- @file_with_path = Rake::Path.expand_with_root( @file, SPEC_PATH )
55
+ @file_with_path = Rake::Path.expand_with_root( @file, RakeBuilderHelper::SPEC_PATH )
54
56
  end
55
57
 
56
58
  it 'includes added files' do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
1
+ load File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe 'when using libraries' do
4
4
 
@@ -22,12 +22,14 @@ describe 'when using libraries' do
22
22
  end
23
23
 
24
24
  it 'fails to build if libraries are missing' do
25
+ @project = cpp_task( :executable ) do |builder|
26
+ builder.library_dependencies = [ 'library_that_doesnt_exist' ]
27
+ end
28
+
25
29
  expect do
26
- @project = cpp_task( :executable ) do |builder|
27
- builder.library_dependencies = [ 'library_that_doesnt_exist' ]
28
- end
29
30
  Rake::Task[ 'build' ].invoke
30
- end.to raise_error( Rake::Builder::BuildFailure )
31
+ end. to raise_error( Rake::Builder::BuildFailure )
31
32
  end
32
33
 
33
34
  end
35
+
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
1
+ load File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  LOCAL_CONFIG_SPEC_PATH = File.expand_path( File.dirname(__FILE__) )
4
4
 
@@ -10,6 +10,9 @@ describe 'local config files' do
10
10
  @local_config_file = Rake::Path.expand_with_root( '.rake-builder', LOCAL_CONFIG_SPEC_PATH )
11
11
  @expected_path = "/some/special/path"
12
12
  @config = {:rake_builder=>{:config_file=>{:version=>"1.0"}}, :include_paths=>[ @expected_path ]}
13
+ end
14
+
15
+ after( :each ) do
13
16
  `rm -f '#{ @local_config_file }'`
14
17
  end
15
18
 
@@ -27,13 +30,58 @@ describe 'local config files' do
27
30
  config.include_paths. should include( @expected_path )
28
31
  end
29
32
 
30
- it 'fails if there\'s no version' do
33
+ it 'fails if the file version is incorrect' do
31
34
  @config[ :rake_builder ][ :config_file ].delete( :version )
32
35
  save_config
33
36
  lambda do
34
37
  config = Rake::LocalConfig.new( @local_config_file )
35
38
  config.load
36
- end.should raise_error( Rake::Builder::BuilderError, 'Config file version missing' )
39
+ end.should raise_error( Rake::Builder::BuilderError, 'Config file version incorrect' )
40
+ end
41
+
42
+ context 'dependencies' do
43
+
44
+ before( :each ) do
45
+ Rake::Task.clear
46
+ @project = cpp_task( :executable )
47
+ Rake::Task[ 'clean' ].execute
48
+ `rm -f #{ @project.local_config }`
49
+ end
50
+
51
+ context 'when local_config is invoked' do
52
+
53
+ it 'should no longer be needed' do
54
+ exist?( @project.local_config ).should be_false
55
+ Rake::Task[ @project.local_config ].needed?.should be_true
56
+
57
+ Rake::Task[ @project.local_config ].invoke
58
+
59
+ exist?( @project.local_config ).should be_true
60
+ Rake::Task[ @project.local_config ].needed?.should be_false
61
+ end
62
+
63
+ end
64
+
65
+ context 'when load_local_config is invoked' do
66
+
67
+ it 'should no longer be needed' do
68
+ Rake::Task[ 'load_local_config' ].needed?.should be_true
69
+
70
+ Rake::Task[ 'load_local_config' ].invoke
71
+
72
+ Rake::Task[ 'load_local_config' ].needed?.should be_false
73
+ end
74
+
75
+ it 'local_config should no longer be needed' do
76
+ Rake::Task[ @project.local_config ].needed?.should be_true
77
+
78
+ Rake::Task[ 'load_local_config' ].invoke
79
+
80
+ Rake::Task[ @project.local_config ].needed?.should be_false
81
+ end
82
+
83
+ end
84
+
37
85
  end
38
86
 
39
87
  private
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
1
+ load File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe 'the logger' do
4
4
 
@@ -22,3 +22,4 @@ describe 'the logger' do
22
22
  # builder.logger.level = Logger::DEBUG
23
23
 
24
24
  end
25
+
@@ -0,0 +1,32 @@
1
+ load File.dirname(__FILE__) + '/spec_helper.rb'
2
+ require 'fileutils'
3
+
4
+ describe Rake::Microsecond::DirectoryTask do
5
+
6
+ include RakeBuilderHelper
7
+ include FileUtils
8
+
9
+ before :all do
10
+ @path = File.join(File.dirname(__FILE__), 'microsecond_directory')
11
+ end
12
+
13
+ before :each do
14
+ rm_rf @path, :verbose => false
15
+ end
16
+
17
+ it 'should memorize the directory creation time including fractional seconds' do
18
+ File.directory?( @path ).should be_false
19
+
20
+ t = Rake::Microsecond::DirectoryTask.define_task( @path )
21
+
22
+ isolating_seconds do
23
+ sleep 0.01
24
+ t.invoke
25
+ end
26
+
27
+ File.directory?( @path ).should be_true
28
+ t.timestamp.usec.should_not == 0
29
+ end
30
+
31
+ end
32
+
@@ -1,4 +1,7 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
1
+ load File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ # Only run on OS X
4
+ if RUBY_PLATFORM['darwin']
2
5
 
3
6
  describe 'when building an Objective-C executable' do
4
7
 
@@ -6,10 +9,10 @@ describe 'when building an Objective-C executable' do
6
9
 
7
10
  before( :all ) do
8
11
  @test_output_file = Rake::Path.expand_with_root(
9
- 'rake-builder-testfile.txt', SPEC_PATH )
12
+ 'rake-builder-testfile.txt', RakeBuilderHelper::SPEC_PATH )
10
13
  @expected_target = Rake::Path.expand_with_root(
11
14
  RakeBuilderHelper::TARGET[ :executable ],
12
- SPEC_PATH )
15
+ RakeBuilderHelper::SPEC_PATH )
13
16
  end
14
17
 
15
18
  before( :each ) do
@@ -64,3 +67,6 @@ describe 'when building an Objective-C executable' do
64
67
  end
65
68
 
66
69
  end
70
+
71
+ end
72
+
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
1
+ load File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  PATHS_SPEC_PATH = File.expand_path( File.dirname(__FILE__) )
4
4
 
@@ -1,11 +1,10 @@
1
- require 'spec'
1
+ require 'rspec'
2
2
  require File.expand_path( File.dirname(__FILE__) + '/../lib/rake/builder' )
3
3
 
4
- SPEC_PATH = File.expand_path( File.dirname(__FILE__) )
5
-
6
4
  module RakeBuilderHelper
7
5
 
8
- TARGET = {
6
+ SPEC_PATH ||= File.expand_path( File.dirname(__FILE__) )
7
+ TARGET ||= {
9
8
  :executable => 'the_executable',
10
9
  :static_library => 'libthe_static_library.a',
11
10
  :shared_library => 'libthe_dynamic_library.so',
@@ -82,12 +81,13 @@ module RakeBuilderHelper
82
81
  end
83
82
 
84
83
  def capturing_output
85
- output = StringIO.new
86
- $stdout = output
84
+ originals = [$stdout, $stderr]
85
+ stdout, stderr = StringIO.new, StringIO.new
86
+ $stdout, $stderr = stdout, stderr
87
87
  yield
88
- output.string
88
+ [stdout.string, stderr.string]
89
89
  ensure
90
- $stdout = STDOUT
90
+ $stdout, $stderr = *originals
91
91
  end
92
92
 
93
93
  # Most file systems have a 1s resolution
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
1
+ load File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe 'when creating tasks' do
4
4
 
@@ -32,7 +32,7 @@ describe 'when creating tasks' do
32
32
  builder = Rake::Builder.new do |builder|
33
33
  builder.source_search_paths = [ 'cpp_project' ]
34
34
  end
35
- builder.target.should == Rake::Path.expand_with_root( 'a.out', SPEC_PATH )
35
+ builder.target.should == Rake::Path.expand_with_root( 'a.out', RakeBuilderHelper::SPEC_PATH )
36
36
  end
37
37
 
38
38
  it 'raises an error when the supplied target_type is unknown' do
metadata CHANGED
@@ -1,129 +1,200 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rake-builder
3
- version: !ruby/object:Gem::Version
4
- hash: 3
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 14
10
- version: 0.0.14
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.15
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Joe Yates
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-04-04 00:00:00 +01:00
19
- default_executable:
20
- dependencies: []
21
-
22
- description: Provides Rake:Builder, a specific rake TaskLib for building C, C++, Objective-C and Objective-C++ projects
12
+ date: 2012-08-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.7
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.7
30
+ - !ruby/object:Gem::Dependency
31
+ name: json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 2.3.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.3.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: pry
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: pry-doc
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: Provides Rake:Builder, a specific rake TaskLib for building C, C++, Objective-C
95
+ and Objective-C++ projects
23
96
  email: joe.g.yates@gmail.com
24
97
  executables: []
25
-
26
98
  extensions: []
27
-
28
99
  extra_rdoc_files: []
29
-
30
- files:
100
+ files:
31
101
  - CHANGES
32
102
  - COPYING
33
103
  - Rakefile
34
104
  - README.rdoc
35
105
  - lib/compiler.rb
106
+ - lib/rake/path.rb
107
+ - lib/rake/once_task.rb
36
108
  - lib/rake/builder/qt_builder.rb
37
109
  - lib/rake/builder/version.rb
38
- - lib/rake/builder.rb
39
- - lib/rake/file_task_alias.rb
40
110
  - lib/rake/local_config.rb
41
- - lib/rake/path.rb
42
- - examples/03_search_paths/include/main.h
111
+ - lib/rake/file_task_alias.rb
112
+ - lib/rake/builder.rb
113
+ - lib/rake/microsecond.rb
43
114
  - examples/04_zlib/include/main.h
44
- - examples/05_tests/include/main.h
45
115
  - examples/05_tests/include/units.h
116
+ - examples/05_tests/include/main.h
117
+ - examples/03_search_paths/include/main.h
46
118
  - examples/02_hello_world_c/main.c
47
119
  - examples/04_zlib/src/main.c
48
- - examples/01_hello_world_cpp/main.cpp
49
- - examples/03_search_paths/src/main.cpp
50
120
  - examples/05_tests/src/main.cpp
51
121
  - examples/05_tests/src/units.cpp
52
122
  - examples/05_tests/test/test_unit.cpp
123
+ - examples/03_search_paths/src/main.cpp
124
+ - examples/01_hello_world_cpp/main.cpp
53
125
  - examples/06_hello_world_objective_c/main.m
54
126
  - examples/README.rdoc
55
- - examples/01_hello_world_cpp/Rakefile
56
127
  - examples/02_hello_world_c/Rakefile
57
- - examples/03_search_paths/Rakefile
58
128
  - examples/04_zlib/Rakefile
59
129
  - examples/05_tests/Rakefile
130
+ - examples/03_search_paths/Rakefile
131
+ - examples/01_hello_world_cpp/Rakefile
60
132
  - examples/06_hello_world_objective_c/Rakefile
61
- - spec/c_project/main.c
62
- - spec/c_project/main.h
63
- - spec/c_project_spec.rb
64
- - spec/cpp_project/main.cpp
65
- - spec/cpp_project/main.h
133
+ - spec/logger_spec.rb
134
+ - spec/objective_c_project/main.m
135
+ - spec/objective_c_project/main.h
136
+ - spec/paths_spec.rb
137
+ - spec/local_config_spec.rb
66
138
  - spec/cpp_project_spec.rb
67
139
  - spec/dependencies_spec.rb
140
+ - spec/objective_c_project_spec.rb
141
+ - spec/c_project_spec.rb
68
142
  - spec/generated_files_spec.rb
143
+ - spec/target_spec.rb
69
144
  - spec/libraries_spec.rb
70
- - spec/local_config_spec.rb
71
- - spec/logger_spec.rb
72
- - spec/objective_c_project/main.h
73
- - spec/objective_c_project/main.m
74
- - spec/objective_c_project_spec.rb
75
- - spec/paths_spec.rb
145
+ - spec/microsecond_task_spec.rb
146
+ - spec/cpp_project/main.h
147
+ - spec/cpp_project/main.cpp
76
148
  - spec/spec_helper.rb
77
- - spec/target_spec.rb
78
- has_rdoc: true
149
+ - spec/c_project/main.c
150
+ - spec/c_project/main.h
79
151
  homepage: http://github.com/joeyates/rake-builder
80
152
  licenses: []
81
-
82
153
  post_install_message:
83
154
  rdoc_options: []
84
-
85
- require_paths:
155
+ require_paths:
86
156
  - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
157
+ required_ruby_version: !ruby/object:Gem::Requirement
88
158
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
159
+ requirements:
160
+ - - ! '>='
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ segments:
94
164
  - 0
95
- version: "0"
96
- required_rubygems_version: !ruby/object:Gem::Requirement
165
+ hash: 4207918046978875061
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
167
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
168
+ requirements:
169
+ - - ! '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ segments:
103
173
  - 0
104
- version: "0"
174
+ hash: 4207918046978875061
105
175
  requirements: []
106
-
107
176
  rubyforge_project: nowarning
108
- rubygems_version: 1.3.7
177
+ rubygems_version: 1.8.23
109
178
  signing_key:
110
179
  specification_version: 3
111
180
  summary: Rake for C/C++ Projects
112
- test_files:
113
- - spec/c_project/main.c
114
- - spec/c_project/main.h
115
- - spec/c_project_spec.rb
116
- - spec/cpp_project/main.cpp
117
- - spec/cpp_project/main.h
181
+ test_files:
182
+ - spec/logger_spec.rb
183
+ - spec/objective_c_project/main.m
184
+ - spec/objective_c_project/main.h
185
+ - spec/paths_spec.rb
186
+ - spec/local_config_spec.rb
118
187
  - spec/cpp_project_spec.rb
119
188
  - spec/dependencies_spec.rb
189
+ - spec/objective_c_project_spec.rb
190
+ - spec/c_project_spec.rb
120
191
  - spec/generated_files_spec.rb
192
+ - spec/target_spec.rb
121
193
  - spec/libraries_spec.rb
122
- - spec/local_config_spec.rb
123
- - spec/logger_spec.rb
124
- - spec/objective_c_project/main.h
125
- - spec/objective_c_project/main.m
126
- - spec/objective_c_project_spec.rb
127
- - spec/paths_spec.rb
194
+ - spec/microsecond_task_spec.rb
195
+ - spec/cpp_project/main.h
196
+ - spec/cpp_project/main.cpp
128
197
  - spec/spec_helper.rb
129
- - spec/target_spec.rb
198
+ - spec/c_project/main.c
199
+ - spec/c_project/main.h
200
+ has_rdoc: