From 649f0ad25150473bcc3b413f134a1342854083a8 Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Thu, 18 Jul 2013 22:18:16 +0900 Subject: [PATCH 1/7] Add :library_dependencies= to SharedLibraryTask and CExtensionTask. --- examples/shared_library/Rakefile | 1 + examples/shared_library/Rakefile.llvm | 1 + features/shared_library_task.feature | 12 ++++++------ lib/paper-house/c-extension-task.rb | 17 +++++++++-------- lib/paper-house/executable-task.rb | 12 +++++++----- lib/paper-house/linker-options.rb | 10 +++------- lib/paper-house/shared-library-task.rb | 19 ++++++++++++++++++- 7 files changed, 45 insertions(+), 27 deletions(-) diff --git a/examples/shared_library/Rakefile b/examples/shared_library/Rakefile index d453d33..0dbcbe9 100644 --- a/examples/shared_library/Rakefile +++ b/examples/shared_library/Rakefile @@ -3,6 +3,7 @@ require "paper-house" $libhello = PaperHouse::SharedLibraryTask.new :libhello do | task | task.version = "0.1.0" task.sources = "hello.c" + task.library_dependencies = "m" # not used. end diff --git a/examples/shared_library/Rakefile.llvm b/examples/shared_library/Rakefile.llvm index 390cd84..0254bcc 100644 --- a/examples/shared_library/Rakefile.llvm +++ b/examples/shared_library/Rakefile.llvm @@ -4,6 +4,7 @@ $libhello = PaperHouse::SharedLibraryTask.new :libhello do | task | task.version = "0.1.0" task.sources = "hello.c" task.cc = "llvm-gcc" + task.library_dependencies = "m" # not used. end diff --git a/features/shared_library_task.feature b/features/shared_library_task.feature index 3c8e59f..789fc11 100644 --- a/features/shared_library_task.feature +++ b/features/shared_library_task.feature @@ -13,7 +13,7 @@ Feature: PaperHouse::SharedLibraryTask """ gcc -H -fPIC -I. -c hello.c -o ./hello.o gcc -H -fPIC -I. -c main.c -o ./main.o - gcc -shared -Wl,-soname,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o + gcc -shared -Wl,-soname,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o -lm ln -s libhello.so.0.1.0 libhello.so ln -s libhello.so.0.1.0 libhello.so.0 gcc -o ./hello ./main.o -L. -lhello @@ -34,7 +34,7 @@ Feature: PaperHouse::SharedLibraryTask """ gcc -H -fPIC -I. -c hello.c -o ./hello.o gcc -H -fPIC -I. -c main.c -o ./main.o - gcc -shared -Wl,-install_name,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o + gcc -shared -Wl,-install_name,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o -lm ln -s libhello.so.0.1.0 libhello.so ln -s libhello.so.0.1.0 libhello.so.0 gcc -o ./hello ./main.o -L. -lhello @@ -55,7 +55,7 @@ Feature: PaperHouse::SharedLibraryTask """ llvm-gcc -H -fPIC -I. -c hello.c -o ./hello.o llvm-gcc -H -fPIC -I. -c main.c -o ./main.o - llvm-gcc -shared -Wl,-soname,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o + llvm-gcc -shared -Wl,-soname,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o -lm ln -s libhello.so.0.1.0 libhello.so ln -s libhello.so.0.1.0 libhello.so.0 llvm-gcc -o ./hello ./main.o -L. -lhello @@ -76,7 +76,7 @@ Feature: PaperHouse::SharedLibraryTask """ llvm-gcc -H -fPIC -I. -c hello.c -o ./hello.o llvm-gcc -H -fPIC -I. -c main.c -o ./main.o - llvm-gcc -shared -Wl,-install_name,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o + llvm-gcc -shared -Wl,-install_name,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o -lm ln -s libhello.so.0.1.0 libhello.so ln -s libhello.so.0.1.0 libhello.so.0 llvm-gcc -o ./hello ./main.o -L. -lhello @@ -97,7 +97,7 @@ Feature: PaperHouse::SharedLibraryTask """ llvm-gcc -H -fPIC -I. -c hello.c -o ./hello.o llvm-gcc -H -fPIC -I. -c main.c -o ./main.o - llvm-gcc -shared -Wl,-soname,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o + llvm-gcc -shared -Wl,-soname,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o -lm ln -s libhello.so.0.1.0 libhello.so ln -s libhello.so.0.1.0 libhello.so.0 llvm-gcc -o ./hello ./main.o -L. -lhello @@ -118,7 +118,7 @@ Feature: PaperHouse::SharedLibraryTask """ llvm-gcc -H -fPIC -I. -c hello.c -o ./hello.o llvm-gcc -H -fPIC -I. -c main.c -o ./main.o - llvm-gcc -shared -Wl,-install_name,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o + llvm-gcc -shared -Wl,-install_name,libhello.so.0 -o ./libhello.so.0.1.0 ./hello.o -lm ln -s libhello.so.0.1.0 libhello.so ln -s libhello.so.0.1.0 libhello.so.0 llvm-gcc -o ./hello ./main.o -L. -lhello diff --git a/lib/paper-house/c-extension-task.rb b/lib/paper-house/c-extension-task.rb index e1a258c..5edd9c8 100644 --- a/lib/paper-house/c-extension-task.rb +++ b/lib/paper-house/c-extension-task.rb @@ -56,20 +56,21 @@ def library_dependencies def generate_target - sh "#{ cc } #{ LDSHARED } -o #{ target_path } #{ objects.to_s } #{ cc_linker_options }" + sh ( [ cc ] + cc_options ).join( " " ) end - def cc_linker_options - [ - ldflags, - cc_ldflags, - cc_l_options, - ].flatten.join " " + def cc_options + [ LDSHARED, o_option, objects, ldflags, libdir_option, l_options ].flatten end - def cc_ldflags + def o_option + "-o #{ target_path }" + end + + + def libdir_option "-L#{ RUBY_LIBDIR }" end diff --git a/lib/paper-house/executable-task.rb b/lib/paper-house/executable-task.rb index b17852e..06eabc3 100644 --- a/lib/paper-house/executable-task.rb +++ b/lib/paper-house/executable-task.rb @@ -18,6 +18,8 @@ require "paper-house/build-task" require "paper-house/linker-options" +require "paper-house/shared-library-task" +require "paper-house/static-library-task" module PaperHouse @@ -31,7 +33,7 @@ class ExecutableTask < BuildTask def initialize name, &block super name, &block Rake::Task[ name ].prerequisites.each do | each | - find_prerequisites each + find_prerequisites each, [ StaticLibraryTask, SharedLibraryTask ] end end @@ -52,17 +54,17 @@ def executable_name def generate_target - sh "#{ cc } -o #{ target_path } #{ objects.to_s } #{ cc_options }" + sh ( [ cc ] + cc_options ).join( " " ) end def cc_options - [ cc_ldflags, cc_l_options ].join " " + [ o_option, objects, ldflags, l_options ].flatten end - def cc_ldflags - ldflags.join " " + def o_option + "-o #{ target_path }" end end end diff --git a/lib/paper-house/linker-options.rb b/lib/paper-house/linker-options.rb index 19b50b4..4b5c947 100644 --- a/lib/paper-house/linker-options.rb +++ b/lib/paper-house/linker-options.rb @@ -16,10 +16,6 @@ # -require "paper-house/shared-library-task" -require "paper-house/static-library-task" - - module PaperHouse # # Linker option utilities. @@ -57,8 +53,8 @@ def library_dependencies ############################################################################ - def find_prerequisites task - [ StaticLibraryTask, SharedLibraryTask ].each do | klass | + def find_prerequisites task, klass_list + klass_list.each do | klass | maybe_enhance task, klass end end @@ -77,7 +73,7 @@ def enhance library_task end - def cc_l_options + def l_options library_dependencies.collect do | each | "-l#{ each }" end diff --git a/lib/paper-house/shared-library-task.rb b/lib/paper-house/shared-library-task.rb index 309d9cc..cc50e36 100644 --- a/lib/paper-house/shared-library-task.rb +++ b/lib/paper-house/shared-library-task.rb @@ -17,12 +17,14 @@ require "paper-house/library-task" +require "paper-house/linker-options" require "paper-house/platform" module PaperHouse # Compiles *.c files into a shared library. class SharedLibraryTask < LibraryTask + include LinkerOptions include Platform @@ -62,7 +64,22 @@ def soname def generate_target - sh "#{ cc } -shared -Wl,#{ SONAME_OPTION },#{ soname } -o #{ target_path } #{ objects.to_s }" + sh ( [ cc ] + cc_options ).join( " " ) + end + + + def cc_options + [ "-shared", wl_option, o_option, objects, ldflags, l_options ].flatten + end + + + def wl_option + "-Wl,#{ SONAME_OPTION },#{ soname }" + end + + + def o_option + "-o #{ target_path }" end end end From df4e3bc3d321064fd3340c5f104778349abdbc85 Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Thu, 18 Jul 2013 22:55:39 +0900 Subject: [PATCH 2/7] Refactoring. --- lib/paper-house/build-task.rb | 88 ++++++++++++++--------------------- lib/paper-house/cc-options.rb | 67 ++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 52 deletions(-) create mode 100644 lib/paper-house/cc-options.rb diff --git a/lib/paper-house/build-task.rb b/lib/paper-house/build-task.rb index fd60564..361d55d 100644 --- a/lib/paper-house/build-task.rb +++ b/lib/paper-house/build-task.rb @@ -18,6 +18,7 @@ require "paper-house/auto-depends" require "paper-house/dependency" +require "paper-house/cc-options" require "rake/clean" require "rake/tasklib" @@ -27,21 +28,19 @@ module PaperHouse # Common base class for *.c compilation tasks. # class BuildTask < Rake::TaskLib - # Compile options pass to C compiler. - attr_accessor :cflags + include CcOptions + # Name of task. attr_accessor :name - # Directory where *.o files are created. - attr_accessor :target_directory + # @!attribute target_directory + # Directory where *.o files are created. + attr_writer :target_directory - def initialize name, &block - init name.to_s - set_defaults - block.call self if block - define + def target_directory + @target_directory ||= "." end @@ -54,24 +53,27 @@ def cc end - # @!attribute includes - # Glob pattern to match include directories. - attr_writer :includes + # @!attribute sources + # Glob pattern to match source files. + attr_writer :sources - def includes - FileList[ [ @includes ] ] + def sources + @sources ||= "*.c" end - # Glob pattern to match source files. - attr_accessor :sources + def initialize name, &block + @name = name.to_s + block.call self if block + define + end # # Relative path to target file. # def target_path - File.join @target_directory, target_file_name + File.join target_directory, target_file_name end @@ -82,18 +84,22 @@ def target_path def define define_main_task + define_directory_task define_all_c_compile_tasks define_maybe_generate_target_task - define_clean_task - define_clobber_task + define_clean_tasks end def define_main_task path = target_path - main_task = task( name => [ @target_directory, path ] ) + main_task = task( name => [ target_directory, path ] ) main_task.comment = "Build #{ path }" if not main_task.comment - directory @target_directory + end + + + def define_directory_task + directory target_directory end @@ -132,6 +138,12 @@ def check_sources_list end + def define_clean_tasks + define_clean_task + define_clobber_task + end + + def define_clean_task objects.each do | each | next if not FileTest.exist?( each ) @@ -154,20 +166,7 @@ def clobber_targets def objects - sources_list.pathmap File.join( @target_directory, "%n.o" ) - end - - - def init name - @name = name - end - - - def set_defaults - @sources = "*.c" - @target_directory = "." - @cflags = [] - @includes = [] + sources_list.pathmap File.join( target_directory, "%n.o" ) end @@ -185,27 +184,12 @@ def no_need_to_compile?( o_file, c_file ) def auto_depends_cc_options - ( @cflags + [ "-fPIC" ] + cc_i_options ).join " " - end - - - def cc_i_options - include_directories.pathmap "-I%p" - end - - - def include_directories - ( includes + auto_includes ).uniq + ( cflags + [ "-fPIC" ] + cc_i_options ).join " " end def sources_list - FileList.new( @sources ) - end - - - def auto_includes - FileList[ sources_list.pathmap( "%d" ).uniq ] + FileList.new sources end diff --git a/lib/paper-house/cc-options.rb b/lib/paper-house/cc-options.rb new file mode 100644 index 0000000..97486da --- /dev/null +++ b/lib/paper-house/cc-options.rb @@ -0,0 +1,67 @@ +# +# Copyright (C) 2013 NEC Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License, version 3, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + + +module PaperHouse + # CC option utilities. + module CcOptions + # @!attribute cflags + # Compile options pass to C compiler. + attr_writer :cflags + + def cflags + @cflags ||= [] + end + + + # @!attribute includes + # Glob pattern to match include directories. + attr_writer :includes + + def includes + @includes ||= [] + FileList[ [ @includes ] ] + end + + + ############################################################################ + private + ############################################################################ + + + def cc_i_options + include_directories.pathmap "-I%p" + end + + + def include_directories + ( includes + auto_includes ).uniq + end + + + def auto_includes + FileList[ sources_list.pathmap( "%d" ).uniq ] + end + end +end + + +### Local variables: +### mode: Ruby +### coding: utf-8-unix +### indent-tabs-mode: nil +### End: From 2b24477c714656c933f2e396d26aede1c2ccb2bc Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Fri, 19 Jul 2013 09:20:55 +0900 Subject: [PATCH 3/7] Refactoring. --- lib/paper-house/build-task.rb | 20 +------------------- lib/paper-house/cc-options.rb | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/lib/paper-house/build-task.rb b/lib/paper-house/build-task.rb index 361d55d..2d9fc52 100644 --- a/lib/paper-house/build-task.rb +++ b/lib/paper-house/build-task.rb @@ -24,9 +24,7 @@ module PaperHouse - # # Common base class for *.c compilation tasks. - # class BuildTask < Rake::TaskLib include CcOptions @@ -53,15 +51,6 @@ def cc end - # @!attribute sources - # Glob pattern to match source files. - attr_writer :sources - - def sources - @sources ||= "*.c" - end - - def initialize name, &block @name = name.to_s block.call self if block @@ -69,9 +58,7 @@ def initialize name, &block end - # # Relative path to target file. - # def target_path File.join target_directory, target_file_name end @@ -184,12 +171,7 @@ def no_need_to_compile?( o_file, c_file ) def auto_depends_cc_options - ( cflags + [ "-fPIC" ] + cc_i_options ).join " " - end - - - def sources_list - FileList.new sources + ( cflags + [ "-fPIC" ] + i_options ).join " " end diff --git a/lib/paper-house/cc-options.rb b/lib/paper-house/cc-options.rb index 97486da..a1dc8c5 100644 --- a/lib/paper-house/cc-options.rb +++ b/lib/paper-house/cc-options.rb @@ -19,6 +19,15 @@ module PaperHouse # CC option utilities. module CcOptions + # @!attribute sources + # Glob pattern to match source files. + attr_writer :sources + + def sources + @sources ||= "*.c" + end + + # @!attribute cflags # Compile options pass to C compiler. attr_writer :cflags @@ -43,7 +52,7 @@ def includes ############################################################################ - def cc_i_options + def i_options include_directories.pathmap "-I%p" end @@ -56,6 +65,11 @@ def include_directories def auto_includes FileList[ sources_list.pathmap( "%d" ).uniq ] end + + + def sources_list + FileList.new sources + end end end From 8b56755710923a7c855b55a707b7900f9d418627 Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Fri, 19 Jul 2013 10:23:51 +0900 Subject: [PATCH 4/7] Do not use Spork since it is fragile. --- Gemfile | 1 - Guardfile | 22 ++++------------------ features/support/env.rb | 31 +++++-------------------------- spec/spec_helper.rb | 27 ++------------------------- 4 files changed, 11 insertions(+), 70 deletions(-) diff --git a/Gemfile b/Gemfile index 1e7102f..7a7605f 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,6 @@ group :development do gem "guard-bundler", "~> 1.0.0" gem "guard-cucumber", "~> 1.4.0" gem "guard-rspec", "~> 3.0.2" - gem "guard-spork", "~> 1.5.1" gem "rb-fchange", "~> 0.0.6", :require => false gem "rb-fsevent", "~> 0.9.3", :require => false gem "rb-inotify", "~> 0.9.0", :require => false diff --git a/Guardfile b/Guardfile index ead60ad..cc7080a 100644 --- a/Guardfile +++ b/Guardfile @@ -1,21 +1,12 @@ # More info at https://github.com/guard/guard#readme - -guard 'bundler' do +guard :bundler do watch('Gemfile') watch(/^.+\.gemspec/) end -guard 'spork' do - watch('Gemfile') - watch('Gemfile.lock') - watch('spec/spec_helper.rb') { :rspec } - watch(%r{features/support/}) { :cucumber } -end - - -guard 'rspec', :cli => "--color --drb -r rspec/instafail -f RSpec::Instafail", :rvm => [ "1.8.7", "1.9.3", "2.0.0" ], :all_on_start => false do +guard :rspec, :cli => "--color -r rspec/instafail -f RSpec::Instafail", :all_on_start => false do watch(%r{^spec/paper-house/.+_spec\.rb$}) watch(%r{^lib/paper-house/(.+)\.rb$}) { |m| "spec/paper-house/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } @@ -24,14 +15,9 @@ end require "paper-house/platform" -cli_opts = %w(--format progress --strict --profile) -if PaperHouse::Platform::MAC - cli_opts << "mac" -else - cli_opts << "linux" -end +cli_opts = %w(--format progress --strict --profile) + [ PaperHouse::Platform::MAC ? "mac" : "linux" ] -guard 'cucumber', :cli => cli_opts.join( " " ), :rvm => [ "1.8.7", "1.9.3", "2.0.0" ], :all_on_start => false do +guard :cucumber, :cli => cli_opts.join( " " ), :all_on_start => false do watch(%r{^features/.+\.feature$}) watch(%r{^features/support/.+$}) { 'features' } watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } diff --git a/features/support/env.rb b/features/support/env.rb index f5f4bec..bf3a70c 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -17,36 +17,15 @@ require "rubygems" -require "spork" -#uncomment the following line to use spork with the debugger -#require "spork/ext/ruby-debug" +require "aruba/cucumber" +require "rake" -Spork.prefork do - # Loading more in this block will cause your tests to run faster. However, - # if you change any configuration or code from libraries loaded here, you'll - # need to restart spork for it take effect. +ENV[ "LD_LIBRARY_PATH" ] = "." - if not ENV[ "DRB" ] - require "coveralls" - Coveralls.wear_merged! - end - ENV[ "LD_LIBRARY_PATH" ] = "." - - require "aruba/cucumber" - require "rake" -end - - -Spork.each_run do - # This code will be run each time you run your specs. - - if ENV[ "DRB" ] - require "coveralls" - Coveralls.wear_merged! - end -end +require "coveralls" +Coveralls.wear_merged! ### Local variables: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e154257..2d0a7b5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,9 +19,6 @@ require "rubygems" require "rake" require "rspec" -require "spork" -#uncomment the following line to use spork with the debugger -#require "spork/ext/ruby-debug" RSpec.configure do | config | @@ -31,28 +28,8 @@ end -Spork.prefork do - # Loading more in this block will cause your tests to run faster. However, - # if you change any configuration or code from libraries loaded here, you'll - # need to restart spork for it take effect. - - if not ENV[ "DRB" ] - require "coveralls" - Coveralls.wear_merged! - end - - require "rspec" -end - - -Spork.each_run do - # This code will be run each time you run your specs. - - if ENV[ "DRB" ] - require "coveralls" - Coveralls.wear_merged! - end -end +require "coveralls" +Coveralls.wear_merged! ### Local variables: From a7a03086f8a41b691453f92ec448f9c221a76967 Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Fri, 19 Jul 2013 10:39:01 +0900 Subject: [PATCH 5/7] Refactoring coveralls setting. --- features/support/env.rb | 10 ++++++++-- spec/spec_helper.rb | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/features/support/env.rb b/features/support/env.rb index bf3a70c..2aa18ae 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -17,6 +17,10 @@ require "rubygems" + +require "simplecov" +SimpleCov.start + require "aruba/cucumber" require "rake" @@ -24,8 +28,10 @@ ENV[ "LD_LIBRARY_PATH" ] = "." -require "coveralls" -Coveralls.wear_merged! +if ENV[ "TRAVIS" ] + require "coveralls" + Coveralls.wear_merged! +end ### Local variables: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2d0a7b5..405bc63 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,6 +17,11 @@ require "rubygems" + +require "simplecov" +SimpleCov.start + + require "rake" require "rspec" @@ -28,8 +33,10 @@ end -require "coveralls" -Coveralls.wear_merged! +if ENV[ "TRAVIS" ] + require "coveralls" + Coveralls.wear_merged! +end ### Local variables: From bf91fe070059902fa31b57ea24d26d1661ba553c Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Fri, 19 Jul 2013 11:08:54 +0900 Subject: [PATCH 6/7] Add cc-options_spec.rb. --- lib/paper-house/cc-options.rb | 2 +- spec/paper-house/cc-options_spec.rb | 59 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 spec/paper-house/cc-options_spec.rb diff --git a/lib/paper-house/cc-options.rb b/lib/paper-house/cc-options.rb index a1dc8c5..3d8222a 100644 --- a/lib/paper-house/cc-options.rb +++ b/lib/paper-house/cc-options.rb @@ -68,7 +68,7 @@ def auto_includes def sources_list - FileList.new sources + FileList[ sources ] end end end diff --git a/spec/paper-house/cc-options_spec.rb b/spec/paper-house/cc-options_spec.rb new file mode 100644 index 0000000..47f03c5 --- /dev/null +++ b/spec/paper-house/cc-options_spec.rb @@ -0,0 +1,59 @@ +# +# Copyright (C) 2013 NEC Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License, version 3, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + + +require "paper-house/cc-options" + + +module PaperHouse + class TestTask + include CcOptions + + public + :i_options + end + + + describe CcOptions, "(default properties)" do + subject { TestTask.new } + + its( :sources ) { should eq "*.c" } + its( :cflags ) { should be_empty } + its( :includes ) { should be_empty } + end + + + describe CcOptions, "(sources=./sources/foo.c, includes=./includes)" do + subject { + task = TestTask.new + task.sources = "./sources/foo.c" + task.includes = "./includes" + task + } + + its( "i_options.size" ) { should eq 2 } + its( :i_options ) { should include "-I./includes" } + its( :i_options ) { should include "-I./sources" } + end +end + + +### Local variables: +### mode: Ruby +### coding: utf-8-unix +### indent-tabs-mode: nil +### End: From cf32898606566ff78b0aaff065c5773451383d55 Mon Sep 17 00:00:00 2001 From: Yasuhito Takamiya Date: Fri, 19 Jul 2013 11:38:00 +0900 Subject: [PATCH 7/7] Version bump. --- lib/paper-house/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/paper-house/version.rb b/lib/paper-house/version.rb index d63df91..095aa7c 100644 --- a/lib/paper-house/version.rb +++ b/lib/paper-house/version.rb @@ -19,7 +19,7 @@ # Base module. module PaperHouse # gem version. - VERSION = "0.2.1" + VERSION = "0.3.0" end