paper_house 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +1 -0
  5. data/CONTRIBUTING.md +12 -0
  6. data/Gemfile +24 -25
  7. data/Guardfile +1 -7
  8. data/README.md +10 -10
  9. data/Rakefile +54 -65
  10. data/examples/executable/Rakefile +3 -1
  11. data/examples/executable_subdirs/Rakefile +8 -6
  12. data/examples/{c_extension → ruby_extension}/.gitignore +0 -0
  13. data/examples/ruby_extension/Rakefile +5 -0
  14. data/examples/ruby_extension/Rakefile.llvm +5 -0
  15. data/examples/{c_extension → ruby_extension}/hello.c +0 -0
  16. data/examples/shared_library/Rakefile +17 -11
  17. data/examples/shared_library/Rakefile.llvm +11 -5
  18. data/examples/shared_library_subdirs/Rakefile +16 -15
  19. data/examples/static_library/Rakefile +6 -5
  20. data/examples/static_library_subdirs/Rakefile +11 -9
  21. data/features/executable_task.feature +15 -27
  22. data/features/{c_extension_task.feature → ruby_extension_task.feature} +30 -48
  23. data/features/shared_library_task.feature +33 -60
  24. data/features/static_library_task.feature +18 -33
  25. data/features/step_definitions/paper_house_steps.rb +13 -4
  26. data/features/support/env.rb +8 -11
  27. data/features/support/hooks.rb +10 -5
  28. data/lib/paper_house/auto_depends.rb +24 -29
  29. data/lib/paper_house/build_task.rb +49 -75
  30. data/lib/paper_house/cc_options.rb +7 -17
  31. data/lib/paper_house/dependency.rb +12 -21
  32. data/lib/paper_house/executable_task.rb +12 -22
  33. data/lib/paper_house/library_task.rb +13 -15
  34. data/lib/paper_house/linker_options.rb +14 -24
  35. data/lib/paper_house/platform.rb +15 -24
  36. data/lib/paper_house/{c_extension_task.rb → ruby_extension_task.rb} +15 -35
  37. data/lib/paper_house/safe_popen.rb +4 -6
  38. data/lib/paper_house/shared_library_task.rb +14 -28
  39. data/lib/paper_house/static_library_task.rb +6 -15
  40. data/lib/paper_house/version.rb +2 -3
  41. data/lib/paper_house.rb +6 -7
  42. data/paper_house.gemspec +17 -19
  43. data/rake_simplecov_hook.rb +24 -0
  44. data/rubocop-todo.yml +6 -0
  45. data/spec/paper_house/executable_task_spec.rb +65 -20
  46. data/spec/paper_house/ruby_extension_task_spec.rb +129 -0
  47. data/spec/paper_house/shared_library_task_spec.rb +124 -49
  48. data/spec/paper_house/static_library_task_spec.rb +81 -27
  49. data/spec/paper_house/version_spec.rb +5 -5
  50. data/spec/spec_helper.rb +8 -13
  51. metadata +17 -15
  52. data/examples/c_extension/Rakefile +0 -3
  53. data/examples/c_extension/Rakefile.llvm +0 -5
  54. data/examples/shared_library/symlinks.rake +0 -7
  55. data/spec/paper_house/c_extension_task_spec.rb +0 -59
  56. data/spec/paper_house/cc_options_spec.rb +0 -59
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  #
2
3
  # Copyright (C) 2013 NEC Corporation
3
4
  #
@@ -15,78 +16,152 @@
15
16
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
17
  #
17
18
 
19
+ require 'paper_house/shared_library_task'
18
20
 
19
- require "paper_house/shared_library_task"
21
+ describe Rake::Task do
22
+ before { Rake::Task.clear }
20
23
 
24
+ describe '.[]' do
25
+ subject { Rake::Task[task] }
21
26
 
22
- module PaperHouse
23
- describe SharedLibraryTask do
24
- it "should find registered tasks by name" do
25
- task = SharedLibraryTask.new( :libtest, "0.1.0" )
27
+ context 'with :libtest' do
28
+ let(:task) { :libtest }
29
+
30
+ context 'when SharedLibraryTask named :libtest is defined' do
31
+ before { PaperHouse::SharedLibraryTask.new :libtest, '0.1.0' }
32
+
33
+ describe '#invoke' do
34
+ it do
35
+ expect do
36
+ subject.invoke
37
+ end.to raise_error('Cannot find sources (*.c).')
38
+ end
39
+ end
40
+ end
26
41
 
27
- SharedLibraryTask.find_by( :libtest ).should eq task
28
- SharedLibraryTask.find_by( "libtest" ).should eq task
29
- SharedLibraryTask.find_by( :no_such_task ).should be_nil
42
+ context 'when StaticLibraryTask named :libtest is not defined' do
43
+ it { expect { subject }.to raise_error }
44
+ end
30
45
  end
31
46
  end
47
+ end
32
48
 
49
+ #
50
+ # PaperHouse::SharedLibraryTask spec.
51
+ #
52
+ module PaperHouse
53
+ describe SharedLibraryTask do
54
+ before { Rake::Task.clear }
33
55
 
34
- describe SharedLibraryTask, %{.new( :libtest, "0.1.0" )} do
35
- subject { SharedLibraryTask.new :libtest, "0.1.0" }
36
-
37
- its( :cc ) { should eq "gcc" }
38
- its( :cflags ) { should be_empty }
39
- its( :includes ) { should be_empty }
40
- its( :name ) { should eq "libtest" }
41
- its( :sources ) { should eq "*.c" }
42
- its( :target_directory ) { should eq "." }
43
- its( :version ) { should eq "0.1.0" }
44
- its( :linker_name ) { should eq "libtest.so" }
45
- its( :soname ) { should eq "libtest.so.0" }
46
- its( :target_file_name ) { should eq "libtest.so.0.1.0" }
47
- its( :library_name ) { should eq "libtest" }
48
- its( :lname ) { should eq "test" }
49
-
50
- it {
51
- expect {
52
- Rake::Task[ subject.name ].invoke
53
- }.to raise_error( "Cannot find sources (*.c)." )
54
- }
55
- end
56
+ describe '.find_named' do
57
+ subject { SharedLibraryTask.find_named name }
58
+
59
+ context 'with :libtest' do
60
+ let(:name) { :libtest }
56
61
 
62
+ context 'when SharedLibraryTask named :libtest is defined' do
63
+ before { SharedLibraryTask.new :libtest, '0.1.0' }
57
64
 
58
- describe SharedLibraryTask, %{(:library_name = "libtest")} do
59
- subject {
60
- SharedLibraryTask.new( :libtest, "0.1.0" ) do | task |
61
- task.library_name = "libtest"
65
+ it { expect(subject).to be_a SharedLibraryTask }
66
+ end
67
+
68
+ context 'when SharedLibraryTask named :libtest is not defined' do
69
+ it { expect(subject).to be_nil }
70
+ end
62
71
  end
63
- }
64
72
 
65
- its( :library_name ) { should eq "libtest" }
66
- end
73
+ context %{with 'libtest'} do
74
+ let(:name) { 'libtest' }
67
75
 
76
+ context %{when SharedLibraryTask named 'libtest' is defined} do
77
+ before { SharedLibraryTask.new :libtest, '0.1.0' }
68
78
 
69
- describe SharedLibraryTask, %{(:library_name = "test")} do
70
- subject {
71
- SharedLibraryTask.new( :libtest, "0.1.0" ) do | task |
72
- task.library_name = "test"
79
+ it { expect(subject).to be_a SharedLibraryTask }
80
+ end
73
81
  end
74
- }
75
82
 
76
- its( :library_name ) { should eq "libtest" }
83
+ context 'with :no_such_task' do
84
+ let(:name) { :no_such_task }
85
+
86
+ it { expect(subject).to be_nil }
87
+ end
88
+ end
77
89
  end
78
90
 
91
+ describe '.new' do
92
+ context %{with name :libtest and version '0.1.0'} do
93
+ subject { SharedLibraryTask.new :libtest, '0.1.0' }
94
+
95
+ its(:cc) { should eq 'gcc' }
96
+ its(:cflags) { should be_empty }
97
+ its(:includes) { should be_empty }
98
+ its(:name) { should eq 'libtest' }
99
+ its(:sources) { should eq '*.c' }
100
+ its(:target_directory) { should eq '.' }
101
+ its(:version) { should eq '0.1.0' }
102
+ its(:linker_name) { should eq 'libtest.so' }
103
+ its(:soname) { should eq 'libtest.so.0' }
104
+ its(:target_file_name) { should eq 'libtest.so.0.1.0' }
105
+ its(:library_name) { should eq 'libtest' }
106
+ its(:lname) { should eq 'test' }
107
+ end
108
+
109
+ context 'with name :libtest and no version string' do
110
+ subject { SharedLibraryTask.new :libtest }
111
+
112
+ it do
113
+ expect { subject }.to raise_error('version option is a mandatory.')
114
+ end
115
+ end
116
+
117
+ context 'with name :libtest and block' do
118
+ subject do
119
+ SharedLibraryTask.new(:libtest) do | task |
120
+ task.library_name = library_name
121
+ task.version = version
122
+ end
123
+ end
124
+
125
+ context %{with #version = '0.1.0'} do
126
+ let(:version) { '0.1.0' }
127
+
128
+ context %{with #library_name = 'libtest'} do
129
+ let(:library_name) { 'libtest' }
130
+
131
+ its(:library_name) { should eq 'libtest' }
132
+ end
133
+
134
+ context 'with #library_name = :libtest' do
135
+ let(:library_name) { :libtest }
79
136
 
80
- describe SharedLibraryTask, %{.new( :libtest )} do
81
- subject { SharedLibraryTask.new "libtest" }
137
+ its(:library_name) { should eq 'libtest' }
138
+ end
82
139
 
83
- it {
84
- expect { subject }.to raise_error( ":version option is a mandatory." )
85
- }
140
+ context %{with #library_name = 'test'} do
141
+ let(:library_name) { 'test' }
142
+
143
+ its(:library_name) { should eq 'libtest' }
144
+ end
145
+
146
+ context 'with #library_name = :test' do
147
+ let(:library_name) { :test }
148
+
149
+ its(:library_name) { should eq 'libtest' }
150
+ end
151
+ end
152
+
153
+ context 'with #version = nil' do
154
+ let(:library_name) { 'libtest' }
155
+ let(:version) { nil }
156
+
157
+ it do
158
+ expect { subject }.to raise_error('version option is a mandatory.')
159
+ end
160
+ end
161
+ end
86
162
  end
87
163
  end
88
164
 
89
-
90
165
  ### Local variables:
91
166
  ### mode: Ruby
92
167
  ### coding: utf-8-unix
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  #
2
3
  # Copyright (C) 2013 NEC Corporation
3
4
  #
@@ -15,45 +16,98 @@
15
16
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
17
  #
17
18
 
19
+ require 'paper_house/static_library_task'
18
20
 
19
- require "paper_house/static_library_task"
21
+ describe 'Rake::Task' do
22
+ before { Rake::Task.clear }
20
23
 
24
+ describe '.[]' do
25
+ subject { Rake::Task[task] }
21
26
 
27
+ context 'with :libtest' do
28
+ let(:task) { :libtest }
29
+
30
+ context 'when StaticLibraryTask named :libtest is defined' do
31
+ before { PaperHouse::StaticLibraryTask.new :libtest }
32
+
33
+ describe '#invoke' do
34
+ it do
35
+ expect do
36
+ subject.invoke
37
+ end.to raise_error('Cannot find sources (*.c).')
38
+ end
39
+ end
40
+ end
41
+
42
+ context 'when StaticLibraryTask named :libtest is not defined' do
43
+ it { expect { subject }.to raise_error }
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ #
50
+ # PaperHouse::StaticLibraryTask spec.
51
+ #
22
52
  module PaperHouse
23
53
  describe StaticLibraryTask do
24
- it "should find registered tasks by name" do
25
- task = StaticLibraryTask.new( :libtest )
54
+ before { Rake::Task.clear }
55
+
56
+ describe '.find_named' do
57
+ subject { StaticLibraryTask.find_named name }
58
+
59
+ context 'with :libtest' do
60
+ let(:name) { :libtest }
26
61
 
27
- StaticLibraryTask.find_by( :libtest ).should eq task
28
- StaticLibraryTask.find_by( "libtest" ).should eq task
29
- StaticLibraryTask.find_by( :no_such_task ).should be_nil
62
+ context 'when StaticLibraryTask named :libtest is defined' do
63
+ before { StaticLibraryTask.new :libtest }
64
+
65
+ it { expect(subject).to be_a StaticLibraryTask }
66
+ end
67
+
68
+ context 'when StaticLibraryTask named :libtest is not defined' do
69
+ it { expect(subject).to be_nil }
70
+ end
71
+ end
72
+
73
+ context %{with 'libtest'} do
74
+ let(:name) { 'libtest' }
75
+
76
+ context 'when StaticLibraryTask named :libtest is defined' do
77
+ before { StaticLibraryTask.new :libtest }
78
+
79
+ it { expect(subject).to be_a StaticLibraryTask }
80
+ end
81
+ end
82
+
83
+ context 'with :no_such_task' do
84
+ let(:name) { :no_such_task }
85
+
86
+ it { expect(subject).to be_nil }
87
+ end
30
88
  end
31
- end
32
89
 
90
+ describe '.new' do
91
+ subject { StaticLibraryTask.new task }
92
+
93
+ context 'with :libtest' do
94
+ let(:task) { :libtest }
33
95
 
34
- describe StaticLibraryTask, ".new( :libtest )" do
35
- subject { StaticLibraryTask.new :libtest }
36
-
37
- its( :cc ) { should eq "gcc" }
38
- its( :cflags ) { should be_empty }
39
- its( :includes ) { should be_empty }
40
- its( :name ) { should eq "libtest" }
41
- its( :sources ) { should eq "*.c" }
42
- its( :target_directory ) { should eq "." }
43
- its( :library_name ) { should eq "libtest" }
44
- its( :lname ) { should eq "test" }
45
- its( :target_file_name ) { should eq "libtest.a" }
46
- its( :target_path ) { should eq "./libtest.a" }
47
-
48
- it {
49
- expect {
50
- Rake::Task[ subject.name ].invoke
51
- }.to raise_error( "Cannot find sources (*.c)." )
52
- }
96
+ its(:cc) { should eq 'gcc' }
97
+ its(:cflags) { should be_empty }
98
+ its(:includes) { should be_empty }
99
+ its(:name) { should eq 'libtest' }
100
+ its(:sources) { should eq '*.c' }
101
+ its(:target_directory) { should eq '.' }
102
+ its(:library_name) { should eq 'libtest' }
103
+ its(:lname) { should eq 'test' }
104
+ its(:target_file_name) { should eq 'libtest.a' }
105
+ its(:target_path) { should eq './libtest.a' }
106
+ end
107
+ end
53
108
  end
54
109
  end
55
110
 
56
-
57
111
  ### Local variables:
58
112
  ### mode: Ruby
59
113
  ### coding: utf-8-unix
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  #
2
3
  # Copyright (C) 2013 NEC Corporation
3
4
  #
@@ -15,15 +16,14 @@
15
16
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
17
  #
17
18
 
18
-
19
- require "paper_house/version"
20
-
19
+ require 'paper_house/version'
21
20
 
22
21
  describe PaperHouse do
23
- it { expect( PaperHouse::VERSION ).to match( /\A\d+\.\d+\.\d+\Z/ ) }
22
+ describe '::VERSION' do
23
+ it { expect(PaperHouse::VERSION).to match(/\A\d+\.\d+\.\d+\Z/) }
24
+ end
24
25
  end
25
26
 
26
-
27
27
  ### Local variables:
28
28
  ### mode: Ruby
29
29
  ### coding: utf-8-unix
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  #
2
3
  # Copyright (C) 2013 NEC Corporation
3
4
  #
@@ -15,32 +16,26 @@
15
16
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
17
  #
17
18
 
19
+ require 'rubygems'
18
20
 
19
- require "rubygems"
20
-
21
- require "simplecov"
21
+ require 'simplecov'
22
22
  SimpleCov.start
23
23
 
24
-
25
- require "rake"
26
- require "rspec"
27
-
24
+ require 'rake'
25
+ require 'rspec'
28
26
 
29
27
  RSpec.configure do | config |
30
- config.before( :all ) do
28
+ config.before(:all) do
31
29
  Rake::Task.clear
32
30
  end
33
31
  end
34
32
 
35
-
36
- if ENV[ "TRAVIS" ]
37
- require "coveralls"
33
+ if ENV['TRAVIS']
34
+ require 'coveralls'
38
35
  Coveralls.wear_merged!
39
36
  end
40
37
 
41
-
42
38
  ### Local variables:
43
39
  ### mode: Ruby
44
- ### coding: utf-8-unix
45
40
  ### indent-tabs-mode: nil
46
41
  ### End:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_house
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhito Takamiya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-12 00:00:00.000000000 Z
11
+ date: 2013-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: POpen4
@@ -48,16 +48,15 @@ extra_rdoc_files:
48
48
  files:
49
49
  - .gitignore
50
50
  - .rspec
51
+ - .rubocop.yml
52
+ - .ruby-version
51
53
  - .travis.yml
54
+ - CONTRIBUTING.md
52
55
  - Gemfile
53
56
  - Guardfile
54
57
  - README.md
55
58
  - Rakefile
56
59
  - cucumber.yml
57
- - examples/c_extension/.gitignore
58
- - examples/c_extension/Rakefile
59
- - examples/c_extension/Rakefile.llvm
60
- - examples/c_extension/hello.c
61
60
  - examples/executable/.gitignore
62
61
  - examples/executable/Rakefile
63
62
  - examples/executable/Rakefile.llvm
@@ -67,13 +66,16 @@ files:
67
66
  - examples/executable_subdirs/includes/hello.h
68
67
  - examples/executable_subdirs/sources/hello.c
69
68
  - examples/executable_subdirs/sources/main.c
69
+ - examples/ruby_extension/.gitignore
70
+ - examples/ruby_extension/Rakefile
71
+ - examples/ruby_extension/Rakefile.llvm
72
+ - examples/ruby_extension/hello.c
70
73
  - examples/shared_library/.gitignore
71
74
  - examples/shared_library/Rakefile
72
75
  - examples/shared_library/Rakefile.llvm
73
76
  - examples/shared_library/hello.c
74
77
  - examples/shared_library/hello.h
75
78
  - examples/shared_library/main.c
76
- - examples/shared_library/symlinks.rake
77
79
  - examples/shared_library_subdirs/.gitignore
78
80
  - examples/shared_library_subdirs/Rakefile
79
81
  - examples/shared_library_subdirs/includes/hello.h
@@ -90,8 +92,8 @@ files:
90
92
  - examples/static_library_subdirs/includes/hello.h
91
93
  - examples/static_library_subdirs/sources/hello.c
92
94
  - examples/static_library_subdirs/sources/main.c
93
- - features/c_extension_task.feature
94
95
  - features/executable_task.feature
96
+ - features/ruby_extension_task.feature
95
97
  - features/shared_library_task.feature
96
98
  - features/static_library_task.feature
97
99
  - features/step_definitions/paper_house_steps.rb
@@ -100,21 +102,22 @@ files:
100
102
  - lib/paper_house.rb
101
103
  - lib/paper_house/auto_depends.rb
102
104
  - lib/paper_house/build_task.rb
103
- - lib/paper_house/c_extension_task.rb
104
105
  - lib/paper_house/cc_options.rb
105
106
  - lib/paper_house/dependency.rb
106
107
  - lib/paper_house/executable_task.rb
107
108
  - lib/paper_house/library_task.rb
108
109
  - lib/paper_house/linker_options.rb
109
110
  - lib/paper_house/platform.rb
111
+ - lib/paper_house/ruby_extension_task.rb
110
112
  - lib/paper_house/safe_popen.rb
111
113
  - lib/paper_house/shared_library_task.rb
112
114
  - lib/paper_house/static_library_task.rb
113
115
  - lib/paper_house/version.rb
114
116
  - paper_house.gemspec
115
- - spec/paper_house/c_extension_task_spec.rb
116
- - spec/paper_house/cc_options_spec.rb
117
+ - rake_simplecov_hook.rb
118
+ - rubocop-todo.yml
117
119
  - spec/paper_house/executable_task_spec.rb
120
+ - spec/paper_house/ruby_extension_task_spec.rb
118
121
  - spec/paper_house/shared_library_task_spec.rb
119
122
  - spec/paper_house/static_library_task_spec.rb
120
123
  - spec/paper_house/version_spec.rb
@@ -139,21 +142,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
142
  version: '0'
140
143
  requirements: []
141
144
  rubyforge_project:
142
- rubygems_version: 2.1.5
145
+ rubygems_version: 2.0.7
143
146
  signing_key:
144
147
  specification_version: 4
145
148
  summary: Rake for C projects.
146
149
  test_files:
147
- - features/c_extension_task.feature
148
150
  - features/executable_task.feature
151
+ - features/ruby_extension_task.feature
149
152
  - features/shared_library_task.feature
150
153
  - features/static_library_task.feature
151
154
  - features/step_definitions/paper_house_steps.rb
152
155
  - features/support/env.rb
153
156
  - features/support/hooks.rb
154
- - spec/paper_house/c_extension_task_spec.rb
155
- - spec/paper_house/cc_options_spec.rb
156
157
  - spec/paper_house/executable_task_spec.rb
158
+ - spec/paper_house/ruby_extension_task_spec.rb
157
159
  - spec/paper_house/shared_library_task_spec.rb
158
160
  - spec/paper_house/static_library_task_spec.rb
159
161
  - spec/paper_house/version_spec.rb
@@ -1,3 +0,0 @@
1
- require "paper_house"
2
-
3
- PaperHouse::CExtensionTask.new :hello
@@ -1,5 +0,0 @@
1
- require "paper_house"
2
-
3
- PaperHouse::CExtensionTask.new :hello do | task |
4
- task.cc = "llvm-gcc"
5
- end
@@ -1,7 +0,0 @@
1
- [ $libhello.linker_name, $libhello.soname ].each do | each |
2
- file each do | task |
3
- symlink $libhello.target_file_name, task.name
4
- end
5
-
6
- CLOBBER.include each if FileTest.exists?( each )
7
- end
@@ -1,59 +0,0 @@
1
- #
2
- # Copyright (C) 2013 NEC Corporation
3
- #
4
- # This program is free software; you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License, version 3, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License along
14
- # with this program; if not, write to the Free Software Foundation, Inc.,
15
- # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
- #
17
-
18
-
19
- require "paper_house/c_extension_task"
20
-
21
-
22
- module PaperHouse
23
- [ CExtensionTask, RubyLibraryTask ].each do | klass |
24
- describe klass, ".new :libtest" do
25
- subject { klass.new :libtest }
26
-
27
- its( :cc ) { should eq "gcc" }
28
- its( :cflags ) { should be_empty }
29
- its( :includes ) { should be_empty }
30
- its( :name ) { should eq "libtest" }
31
- its( :sources ) { should eq "*.c" }
32
- its( :target_directory ) { should eq "." }
33
-
34
- it {
35
- expect {
36
- Rake::Task[ subject.name ].invoke
37
- }.to raise_error( "Cannot find sources (*.c)." )
38
- }
39
- end
40
-
41
-
42
- describe klass, ".new( :libtest ) do ... end" do
43
- subject {
44
- klass.new :libtest do | task |
45
- task.library_name = "test"
46
- end
47
- }
48
-
49
- its( :library_name ) { should eq "test" }
50
- end
51
- end
52
- end
53
-
54
-
55
- ### Local variables:
56
- ### mode: Ruby
57
- ### coding: utf-8-unix
58
- ### indent-tabs-mode: nil
59
- ### End:
@@ -1,59 +0,0 @@
1
- #
2
- # Copyright (C) 2013 NEC Corporation
3
- #
4
- # This program is free software; you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License, version 3, as
6
- # published by the Free Software Foundation.
7
- #
8
- # This program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License along
14
- # with this program; if not, write to the Free Software Foundation, Inc.,
15
- # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
- #
17
-
18
-
19
- require "paper_house/cc_options"
20
-
21
-
22
- module PaperHouse
23
- class TestTask
24
- include CcOptions
25
-
26
- public
27
- :i_options
28
- end
29
-
30
-
31
- describe CcOptions, "(default properties)" do
32
- subject { TestTask.new }
33
-
34
- its( :sources ) { should eq "*.c" }
35
- its( :cflags ) { should be_empty }
36
- its( :includes ) { should be_empty }
37
- end
38
-
39
-
40
- describe CcOptions, "(sources=./sources/foo.c, includes=./includes)" do
41
- subject {
42
- task = TestTask.new
43
- task.sources = "./sources/foo.c"
44
- task.includes = "./includes"
45
- task
46
- }
47
-
48
- its( "i_options.size" ) { should eq 2 }
49
- its( :i_options ) { should include "-I./includes" }
50
- its( :i_options ) { should include "-I./sources" }
51
- end
52
- end
53
-
54
-
55
- ### Local variables:
56
- ### mode: Ruby
57
- ### coding: utf-8-unix
58
- ### indent-tabs-mode: nil
59
- ### End: