paper_house 0.4.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 (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +17 -0
  5. data/Gemfile +35 -0
  6. data/Guardfile +28 -0
  7. data/README.md +116 -0
  8. data/Rakefile +139 -0
  9. data/cucumber.yml +3 -0
  10. data/examples/c_extension/.gitignore +5 -0
  11. data/examples/c_extension/Rakefile +3 -0
  12. data/examples/c_extension/Rakefile.llvm +5 -0
  13. data/examples/c_extension/hello.c +6 -0
  14. data/examples/executable/.gitignore +4 -0
  15. data/examples/executable/Rakefile +3 -0
  16. data/examples/executable/Rakefile.llvm +5 -0
  17. data/examples/executable/hello.c +7 -0
  18. data/examples/executable_subdirs/.gitignore +4 -0
  19. data/examples/executable_subdirs/Rakefile +9 -0
  20. data/examples/executable_subdirs/includes/hello.h +1 -0
  21. data/examples/executable_subdirs/sources/hello.c +6 -0
  22. data/examples/executable_subdirs/sources/main.c +8 -0
  23. data/examples/shared_library/.gitignore +8 -0
  24. data/examples/shared_library/Rakefile +17 -0
  25. data/examples/shared_library/Rakefile.llvm +19 -0
  26. data/examples/shared_library/hello.c +6 -0
  27. data/examples/shared_library/hello.h +1 -0
  28. data/examples/shared_library/main.c +7 -0
  29. data/examples/shared_library/symlinks.rake +7 -0
  30. data/examples/shared_library_subdirs/.gitignore +8 -0
  31. data/examples/shared_library_subdirs/Rakefile +27 -0
  32. data/examples/shared_library_subdirs/includes/hello.h +1 -0
  33. data/examples/shared_library_subdirs/sources/hello.c +6 -0
  34. data/examples/shared_library_subdirs/sources/main.c +8 -0
  35. data/examples/static_library/.gitignore +7 -0
  36. data/examples/static_library/Rakefile +13 -0
  37. data/examples/static_library/Rakefile.llvm +14 -0
  38. data/examples/static_library/hello.c +6 -0
  39. data/examples/static_library/hello.h +1 -0
  40. data/examples/static_library/main.c +7 -0
  41. data/examples/static_library_subdirs/.gitignore +7 -0
  42. data/examples/static_library_subdirs/Rakefile +17 -0
  43. data/examples/static_library_subdirs/includes/hello.h +1 -0
  44. data/examples/static_library_subdirs/sources/hello.c +6 -0
  45. data/examples/static_library_subdirs/sources/main.c +8 -0
  46. data/features/c_extension_task.feature +119 -0
  47. data/features/executable_task.feature +83 -0
  48. data/features/shared_library_task.feature +209 -0
  49. data/features/static_library_task.feature +116 -0
  50. data/features/step_definitions/paper_house_steps.rb +8 -0
  51. data/features/support/env.rb +41 -0
  52. data/features/support/hooks.rb +12 -0
  53. data/lib/paper_house/auto_depends.rb +95 -0
  54. data/lib/paper_house/build_task.rb +188 -0
  55. data/lib/paper_house/c_extension_task.rb +95 -0
  56. data/lib/paper_house/cc_options.rb +81 -0
  57. data/lib/paper_house/dependency.rb +74 -0
  58. data/lib/paper_house/executable_task.rb +77 -0
  59. data/lib/paper_house/library_task.rb +64 -0
  60. data/lib/paper_house/linker_options.rb +89 -0
  61. data/lib/paper_house/platform.rb +69 -0
  62. data/lib/paper_house/safe_popen.rb +50 -0
  63. data/lib/paper_house/shared_library_task.rb +92 -0
  64. data/lib/paper_house/static_library_task.rb +65 -0
  65. data/lib/paper_house/version.rb +30 -0
  66. data/lib/paper_house.rb +30 -0
  67. data/paper_house.gemspec +34 -0
  68. data/spec/paper_house/c_extension_task_spec.rb +59 -0
  69. data/spec/paper_house/cc_options_spec.rb +59 -0
  70. data/spec/paper_house/executable_task_spec.rb +49 -0
  71. data/spec/paper_house/shared_library_task_spec.rb +94 -0
  72. data/spec/paper_house/static_library_task_spec.rb +61 -0
  73. data/spec/paper_house/version_spec.rb +31 -0
  74. data/spec/spec_helper.rb +46 -0
  75. metadata +161 -0
@@ -0,0 +1,89 @@
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
+ module PaperHouse
20
+ #
21
+ # Linker option utilities.
22
+ #
23
+ module LinkerOptions
24
+ # @!attribute ldflags
25
+ # Linker options pass to C compiler.
26
+ attr_writer :ldflags
27
+
28
+ def ldflags
29
+ @ldflags ||= []
30
+ [ @ldflags ].flatten.compact
31
+ end
32
+
33
+
34
+ #
35
+ # List of libraries to link.
36
+ #
37
+ def library_dependencies= name
38
+ @library_dependencies = [ name ].flatten.compact
39
+ end
40
+
41
+
42
+ #
43
+ # List of libraries to link.
44
+ #
45
+ def library_dependencies
46
+ @library_dependencies ||= []
47
+ [ @library_dependencies ].flatten.compact
48
+ end
49
+
50
+
51
+ ############################################################################
52
+ private
53
+ ############################################################################
54
+
55
+
56
+ def find_prerequisites task, klass_list
57
+ klass_list.each do | klass |
58
+ maybe_enhance task, klass
59
+ end
60
+ end
61
+
62
+
63
+ def maybe_enhance name, klass
64
+ task = klass.find_by( name )
65
+ enhance task if task
66
+ end
67
+
68
+
69
+ def enhance library_task
70
+ @library_dependencies ||= []
71
+ @library_dependencies |= [ library_task.lname ]
72
+ Rake::Task[ target_path ].enhance [ library_task.target_path ]
73
+ end
74
+
75
+
76
+ def l_options
77
+ library_dependencies.collect do | each |
78
+ "-l#{ each }"
79
+ end
80
+ end
81
+ end
82
+ end
83
+
84
+
85
+ ### Local variables:
86
+ ### mode: Ruby
87
+ ### coding: utf-8-unix
88
+ ### indent-tabs-mode: nil
89
+ ### End:
@@ -0,0 +1,69 @@
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 "rbconfig"
20
+
21
+
22
+ module PaperHouse
23
+ #
24
+ # Platform-dependent stuff.
25
+ #
26
+ module Platform
27
+ include RbConfig
28
+
29
+
30
+ # MACOSX or not.
31
+ MAC = ( /darwin|mac os/=~ CONFIG[ "host_os" ] )
32
+
33
+
34
+ if MAC
35
+ # File extension of C extensions.
36
+ SHARED_EXT = ".bundle"
37
+ # CC options for compiling shared libraries.
38
+ LDSHARED = "-dynamic -bundle"
39
+ # CC option for setting soname.
40
+ SONAME_OPTION = "-install_name"
41
+ else
42
+ SHARED_EXT = ".so"
43
+ LDSHARED = "-shared"
44
+ SONAME_OPTION = "-soname"
45
+ end
46
+
47
+
48
+ # Include directories for compiling C extensions.
49
+ RUBY_INCLUDES = if RUBY_VERSION >= "1.9.0"
50
+ [
51
+ File.join( CONFIG[ "rubyhdrdir" ], CONFIG[ "arch" ] ),
52
+ File.join( CONFIG[ "rubyhdrdir" ], "ruby/backward" ),
53
+ CONFIG[ "rubyhdrdir" ]
54
+ ]
55
+ else
56
+ [ CONFIG[ "archdir" ] ]
57
+ end
58
+
59
+ # Library directories for compiling C extensions.
60
+ RUBY_LIBDIR = CONFIG[ "libdir" ]
61
+ end
62
+ end
63
+
64
+
65
+ ### Local variables:
66
+ ### mode: Ruby
67
+ ### coding: utf-8-unix
68
+ ### indent-tabs-mode: nil
69
+ ### End:
@@ -0,0 +1,50 @@
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 "popen4"
20
+
21
+
22
+ module PaperHouse
23
+ #
24
+ # Thin POpen4 wrapper that avoids POpen4's segraults in 1.8.6.
25
+ # See also https://github.com/engineyard/engineyard/issues/115
26
+ #
27
+ class SafePopen
28
+ #
29
+ # Starts a new process and pass the subprocess IOs and pid to the
30
+ # block supplied.
31
+ #
32
+ def self.popen command, &block
33
+ status = nil
34
+ begin
35
+ GC.disable
36
+ status = POpen4.popen4( command, &block )
37
+ ensure
38
+ GC.enable
39
+ end
40
+ status
41
+ end
42
+ end
43
+ end
44
+
45
+
46
+ ### Local variables:
47
+ ### mode: Ruby
48
+ ### coding: utf-8-unix
49
+ ### indent-tabs-mode: nil
50
+ ### End:
@@ -0,0 +1,92 @@
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/library_task"
20
+ require "paper_house/linker_options"
21
+ require "paper_house/platform"
22
+
23
+
24
+ module PaperHouse
25
+ # Compiles *.c files into a shared library.
26
+ class SharedLibraryTask < LibraryTask
27
+ include LinkerOptions
28
+ include Platform
29
+
30
+
31
+ # Library version string.
32
+ attr_accessor :version
33
+
34
+
35
+ def initialize name, version = nil, &block
36
+ @version = version
37
+ super name, &block
38
+ end
39
+
40
+
41
+ # Real name of target library.
42
+ def target_file_name
43
+ fail ":version option is a mandatory." if not @version
44
+ [ linker_name, @version ].join "."
45
+ end
46
+ alias :real_name :target_file_name
47
+
48
+
49
+ # Name of library used by linkers.
50
+ def linker_name
51
+ library_name + ".so"
52
+ end
53
+
54
+
55
+ # Soname of target library.
56
+ def soname
57
+ File.basename( target_file_name ).sub( /\.\d+\.\d+\Z/, "" )
58
+ end
59
+
60
+
61
+ ############################################################################
62
+ private
63
+ ############################################################################
64
+
65
+
66
+ def generate_target
67
+ sh ( [ cc ] + cc_options ).join( " " )
68
+ end
69
+
70
+
71
+ def cc_options
72
+ [ "-shared", wl_option, o_option, objects, ldflags, l_options ].flatten
73
+ end
74
+
75
+
76
+ def wl_option
77
+ "-Wl,#{ SONAME_OPTION },#{ soname }"
78
+ end
79
+
80
+
81
+ def o_option
82
+ "-o #{ target_path }"
83
+ end
84
+ end
85
+ end
86
+
87
+
88
+ ### Local variables:
89
+ ### mode: Ruby
90
+ ### coding: utf-8-unix
91
+ ### indent-tabs-mode: nil
92
+ ### End:
@@ -0,0 +1,65 @@
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/library_task"
20
+
21
+
22
+ module PaperHouse
23
+ # Compiles *.c files into a static library.
24
+ class StaticLibraryTask < LibraryTask
25
+ # Name of target library file.
26
+ def target_file_name
27
+ library_name + ".a"
28
+ end
29
+
30
+
31
+ ##########################################################################
32
+ private
33
+ ##########################################################################
34
+
35
+
36
+ def generate_target
37
+ maybe_rm_target
38
+ ar
39
+ ranlib
40
+ end
41
+
42
+
43
+ def maybe_rm_target
44
+ a_file = target_path
45
+ sh "rm #{ a_file }" if FileTest.exist?( a_file )
46
+ end
47
+
48
+
49
+ def ar
50
+ sh "ar -cq #{ target_path } #{ objects.to_s }"
51
+ end
52
+
53
+
54
+ def ranlib
55
+ sh "ranlib #{ target_path }"
56
+ end
57
+ end
58
+ end
59
+
60
+
61
+ ### Local variables:
62
+ ### mode: Ruby
63
+ ### coding: utf-8-unix
64
+ ### indent-tabs-mode: nil
65
+ ### End:
@@ -0,0 +1,30 @@
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
+ # Base module.
20
+ module PaperHouse
21
+ # gem version.
22
+ VERSION = "0.4.0"
23
+ end
24
+
25
+
26
+ ### Local variables:
27
+ ### mode: Ruby
28
+ ### coding: utf-8
29
+ ### indent-tabs-mode: nil
30
+ ### End:
@@ -0,0 +1,30 @@
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
+ require "paper_house/executable_task"
21
+ require "paper_house/shared_library_task"
22
+ require "paper_house/static_library_task"
23
+ require "paper_house/version"
24
+
25
+
26
+ ### Local variables:
27
+ ### mode: Ruby
28
+ ### coding: utf-8-unix
29
+ ### indent-tabs-mode: nil
30
+ ### End:
@@ -0,0 +1,34 @@
1
+ lib = File.expand_path( "../lib", __FILE__ )
2
+ $LOAD_PATH.unshift( lib ) unless $LOAD_PATH.include?( lib )
3
+ require "paper_house/version"
4
+
5
+
6
+ Gem::Specification.new do | gem |
7
+ gem.name = "paper_house"
8
+ gem.version = PaperHouse::VERSION
9
+ gem.summary = "Rake for C projects."
10
+ gem.description = "Rake tasks for compiling C projects."
11
+
12
+ gem.license = "GPL3"
13
+
14
+ gem.authors = [ "Yasuhito Takamiya" ]
15
+ gem.email = [ "yasuhito@gmail.com" ]
16
+ gem.homepage = "http://github.com/trema/paper-house"
17
+
18
+ gem.files = `git ls-files`.split( "\n" )
19
+
20
+ gem.require_paths = [ "lib" ]
21
+
22
+ gem.extra_rdoc_files = [ "README.md" ]
23
+ gem.test_files = `git ls-files -- {spec,features}/*`.split( "\n" )
24
+
25
+ gem.add_dependency "POpen4", "~> 0.1.4"
26
+ gem.add_dependency "rake", "~> 10.1.0"
27
+ end
28
+
29
+
30
+ ### Local variables:
31
+ ### mode: Ruby
32
+ ### coding: utf-8-unix
33
+ ### indent-tabs-mode: nil
34
+ ### End:
@@ -0,0 +1,59 @@
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:
@@ -0,0 +1,59 @@
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:
@@ -0,0 +1,49 @@
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/executable_task"
20
+
21
+
22
+ module PaperHouse
23
+ describe ExecutableTask, ".new( :test )" do
24
+ subject { ExecutableTask.new :test }
25
+
26
+ its( :cc ) { should eq "gcc" }
27
+ its( :cflags ) { should be_empty }
28
+ its( :executable_name ) { should eq "test" }
29
+ its( :includes ) { should be_empty }
30
+ its( :ldflags ) { should be_empty }
31
+ its( :library_dependencies ) { should be_empty }
32
+ its( :name ) { should eq "test" }
33
+ its( :sources ) { should eq "*.c" }
34
+ its( :target_directory ) { should eq "." }
35
+
36
+ it {
37
+ expect {
38
+ Rake::Task[ subject.name ].invoke
39
+ }.to raise_error( "Cannot find sources (*.c)." )
40
+ }
41
+ end
42
+ end
43
+
44
+
45
+ ### Local variables:
46
+ ### mode: Ruby
47
+ ### coding: utf-8-unix
48
+ ### indent-tabs-mode: nil
49
+ ### End: