paper_house 0.6.0 → 0.6.1
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.
- checksums.yaml +4 -4
 - data/README.md +3 -1
 - data/Rakefile +3 -10
 - data/examples/executable/Rakefile +5 -0
 - data/examples/executable/Rakefile.llvm +5 -0
 - data/examples/executable/hello.c +7 -0
 - data/examples/executable_subdirs/Rakefile +11 -0
 - data/examples/executable_subdirs/includes/hello.h +1 -0
 - data/examples/executable_subdirs/sources/hello.c +6 -0
 - data/examples/executable_subdirs/sources/main.c +8 -0
 - data/examples/fail/Rakefile +5 -0
 - data/examples/fail/hello +0 -0
 - data/examples/fail/hello.c +1 -0
 - data/examples/ruby_extension/Rakefile +5 -0
 - data/examples/ruby_extension/Rakefile.llvm +5 -0
 - data/examples/ruby_extension/hello.c +6 -0
 - data/examples/shared_library/Rakefile +23 -0
 - data/examples/shared_library/Rakefile.llvm +25 -0
 - data/examples/shared_library/hello.c +6 -0
 - data/examples/shared_library/hello.h +1 -0
 - data/examples/shared_library/main.c +7 -0
 - data/examples/shared_library_subdirs/Rakefile +28 -0
 - data/examples/shared_library_subdirs/includes/hello.h +1 -0
 - data/examples/shared_library_subdirs/sources/hello.c +6 -0
 - data/examples/shared_library_subdirs/sources/main.c +8 -0
 - data/examples/static_library/Rakefile +14 -0
 - data/examples/static_library/Rakefile.llvm +14 -0
 - data/examples/static_library/hello.c +6 -0
 - data/examples/static_library/hello.h +1 -0
 - data/examples/static_library/main.c +7 -0
 - data/examples/static_library_subdirs/Rakefile +19 -0
 - data/examples/static_library_subdirs/includes/hello.h +1 -0
 - data/examples/static_library_subdirs/sources/hello.c +6 -0
 - data/examples/static_library_subdirs/sources/main.c +8 -0
 - data/features/step_definitions/paper_house_steps.rb +1 -1
 - data/features/support/hooks.rb +2 -2
 - data/lib/paper_house/auto_depends.rb +3 -8
 - data/lib/paper_house/build_failed.rb +3 -1
 - data/lib/paper_house/build_task.rb +7 -4
 - data/lib/paper_house/dependency.rb +9 -7
 - data/lib/paper_house/executable_task.rb +13 -1
 - data/lib/paper_house/library_task.rb +7 -6
 - data/lib/paper_house/linker_options.rb +1 -1
 - data/lib/paper_house/platform.rb +7 -8
 - data/lib/paper_house/ruby_extension_task.rb +0 -4
 - data/lib/paper_house/shared_library_task.rb +11 -0
 - data/lib/paper_house/version.rb +1 -1
 - data/paper_house.gemspec +2 -1
 - data/spec/paper_house/executable_task_spec.rb +35 -42
 - data/spec/paper_house/ruby_extension_task_spec.rb +38 -76
 - data/spec/paper_house/shared_library_task_spec.rb +71 -105
 - data/spec/paper_house/static_library_task_spec.rb +63 -54
 - data/spec/paper_house/version_spec.rb +2 -4
 - data/spec/spec_helper.rb +2 -1
 - metadata +54 -24
 - data/lib/paper_house/safe_popen.rb +0 -26
 
| 
         @@ -3,140 +3,106 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'paper_house/shared_library_task'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            describe Rake::Task do
         
     | 
| 
       6 
     | 
    
         
            -
               
     | 
| 
      
 6 
     | 
    
         
            +
              context 'when SharedLibraryTask (name = :libtest) is defined' do
         
     | 
| 
      
 7 
     | 
    
         
            +
                Given { Rake::Task.clear }
         
     | 
| 
      
 8 
     | 
    
         
            +
                Given { PaperHouse::SharedLibraryTask.new :libtest, '0.1.0' }
         
     | 
| 
       7 
9 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
                describe '.[]' do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  context 'with :libtest' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                    Given(:name) { :libtest }
         
     | 
| 
       10 
13 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                  context 'when SharedLibraryTask named :libtest is defined' do
         
     | 
| 
       15 
     | 
    
         
            -
                    before { PaperHouse::SharedLibraryTask.new :libtest, '0.1.0' }
         
     | 
| 
      
 14 
     | 
    
         
            +
                    When(:task) { Rake::Task[name] }
         
     | 
| 
      
 15 
     | 
    
         
            +
                    Then { task.is_a? Rake::Task }
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                    describe '#invoke' do
         
     | 
| 
       18 
     | 
    
         
            -
                       
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                        end.to raise_error('Cannot find sources (*.c).')
         
     | 
| 
      
 18 
     | 
    
         
            +
                      When(:result) { task.invoke }
         
     | 
| 
      
 19 
     | 
    
         
            +
                      Then do
         
     | 
| 
      
 20 
     | 
    
         
            +
                        result == Failure(RuntimeError, 'Cannot find sources (*.c).')
         
     | 
| 
       22 
21 
     | 
    
         
             
                      end
         
     | 
| 
       23 
22 
     | 
    
         
             
                    end
         
     | 
| 
       24 
23 
     | 
    
         
             
                  end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                  context 'when StaticLibraryTask named :libtest is not defined' do
         
     | 
| 
       27 
     | 
    
         
            -
                    it { expect { subject }.to raise_error }
         
     | 
| 
       28 
     | 
    
         
            -
                  end
         
     | 
| 
       29 
24 
     | 
    
         
             
                end
         
     | 
| 
       30 
25 
     | 
    
         
             
              end
         
     | 
| 
       31 
26 
     | 
    
         
             
            end
         
     | 
| 
       32 
27 
     | 
    
         | 
| 
       33 
28 
     | 
    
         
             
            describe PaperHouse::SharedLibraryTask do
         
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              describe '.find_named' do
         
     | 
| 
       37 
     | 
    
         
            -
                subject { PaperHouse::SharedLibraryTask.find_named name }
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                context 'with :libtest' do
         
     | 
| 
       40 
     | 
    
         
            -
                  let(:name) { :libtest }
         
     | 
| 
      
 29 
     | 
    
         
            +
              context 'when no tasks are defined' do
         
     | 
| 
      
 30 
     | 
    
         
            +
                Given { Rake::Task.clear }
         
     | 
| 
       41 
31 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                     
     | 
| 
       46 
     | 
    
         
            -
                  end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                  context 'when SharedLibraryTask named :libtest is not defined' do
         
     | 
| 
       49 
     | 
    
         
            -
                    it { expect(subject).to be_nil }
         
     | 
| 
      
 32 
     | 
    
         
            +
                describe '.find_by_name' do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  context "with 'libtest'" do
         
     | 
| 
      
 34 
     | 
    
         
            +
                    When(:result) { PaperHouse::SharedLibraryTask.find_by_name('libtest') }
         
     | 
| 
      
 35 
     | 
    
         
            +
                    Then { result.nil? }
         
     | 
| 
       50 
36 
     | 
    
         
             
                  end
         
     | 
| 
       51 
37 
     | 
    
         
             
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
       52 
39 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                  context %(when SharedLibraryTask named 'libtest' is defined) do
         
     | 
| 
       57 
     | 
    
         
            -
                    before { PaperHouse::SharedLibraryTask.new :libtest, '0.1.0' }
         
     | 
| 
      
 40 
     | 
    
         
            +
              context 'when SharedLibraryTask (name = :libtest) is defined' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                Given { Rake::Task.clear }
         
     | 
| 
      
 42 
     | 
    
         
            +
                Given { PaperHouse::SharedLibraryTask.new :libtest, '0.1.0' }
         
     | 
| 
       58 
43 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
      
 44 
     | 
    
         
            +
                describe '.find_by_name' do
         
     | 
| 
      
 45 
     | 
    
         
            +
                  context "with 'libtest'" do
         
     | 
| 
      
 46 
     | 
    
         
            +
                    When(:result) { PaperHouse::SharedLibraryTask.find_by_name('libtest') }
         
     | 
| 
      
 47 
     | 
    
         
            +
                    Then { result.is_a? PaperHouse::SharedLibraryTask }
         
     | 
| 
       60 
48 
     | 
    
         
             
                  end
         
     | 
| 
       61 
49 
     | 
    
         
             
                end
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                context 'with :no_such_task' do
         
     | 
| 
       64 
     | 
    
         
            -
                  let(:name) { :no_such_task }
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                  it { expect(subject).to be_nil }
         
     | 
| 
       67 
     | 
    
         
            -
                end
         
     | 
| 
       68 
50 
     | 
    
         
             
              end
         
     | 
| 
       69 
51 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
               
     | 
| 
       71 
     | 
    
         
            -
                 
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                  its(:cc) { should eq 'gcc' }
         
     | 
| 
       75 
     | 
    
         
            -
                  its(:cflags) { should be_empty }
         
     | 
| 
       76 
     | 
    
         
            -
                  its(:includes) { should be_empty }
         
     | 
| 
       77 
     | 
    
         
            -
                  its(:name) { should eq 'libtest' }
         
     | 
| 
       78 
     | 
    
         
            -
                  its(:sources) { should eq '*.c'  }
         
     | 
| 
       79 
     | 
    
         
            -
                  its(:target_directory) { should eq '.' }
         
     | 
| 
       80 
     | 
    
         
            -
                  its(:version) { should eq '0.1.0' }
         
     | 
| 
       81 
     | 
    
         
            -
                  its(:linker_name) { should eq 'libtest.so' }
         
     | 
| 
       82 
     | 
    
         
            -
                  its(:soname) { should eq 'libtest.so.0' }
         
     | 
| 
       83 
     | 
    
         
            -
                  its(:target_file_name) { should eq 'libtest.so.0.1.0' }
         
     | 
| 
       84 
     | 
    
         
            -
                  its(:library_name) { should eq 'libtest' }
         
     | 
| 
       85 
     | 
    
         
            -
                  its(:lname) { should eq 'test' }
         
     | 
| 
       86 
     | 
    
         
            -
                end
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
                context 'with name :libtest and no version string' do
         
     | 
| 
       89 
     | 
    
         
            -
                  subject { PaperHouse::SharedLibraryTask.new :libtest }
         
     | 
| 
      
 52 
     | 
    
         
            +
              context "when SharedLibraryTask (name = 'libtest') is defined" do
         
     | 
| 
      
 53 
     | 
    
         
            +
                Given { Rake::Task.clear }
         
     | 
| 
      
 54 
     | 
    
         
            +
                Given { PaperHouse::SharedLibraryTask.new 'libtest', '0.1.0' }
         
     | 
| 
       90 
55 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
                describe '.find_by_name' do
         
     | 
| 
      
 57 
     | 
    
         
            +
                  context "with 'libtest'" do
         
     | 
| 
      
 58 
     | 
    
         
            +
                    When(:result) { PaperHouse::SharedLibraryTask.find_by_name('libtest') }
         
     | 
| 
      
 59 
     | 
    
         
            +
                    Then { result.is_a? PaperHouse::SharedLibraryTask }
         
     | 
| 
       93 
60 
     | 
    
         
             
                  end
         
     | 
| 
       94 
61 
     | 
    
         
             
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
            end
         
     | 
| 
       95 
64 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
                    context 'with #library_name = :libtest' do
         
     | 
| 
       114 
     | 
    
         
            -
                      let(:library_name) { :libtest }
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                      its(:library_name) { should eq 'libtest' }
         
     | 
| 
       117 
     | 
    
         
            -
                    end
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
                    context %(with #library_name = 'test') do
         
     | 
| 
       120 
     | 
    
         
            -
                      let(:library_name) { 'test' }
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
                      its(:library_name) { should eq 'libtest' }
         
     | 
| 
       123 
     | 
    
         
            -
                    end
         
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
                    context 'with #library_name = :test' do
         
     | 
| 
       126 
     | 
    
         
            -
                      let(:library_name) { :test }
         
     | 
| 
      
 65 
     | 
    
         
            +
            describe PaperHouse::SharedLibraryTask, '.new' do
         
     | 
| 
      
 66 
     | 
    
         
            +
              context "with :libtest and '0.1.0'" do
         
     | 
| 
      
 67 
     | 
    
         
            +
                When(:task) { PaperHouse::SharedLibraryTask.new(:libtest, '0.1.0') }
         
     | 
| 
      
 68 
     | 
    
         
            +
                Then { task.name == 'libtest' }
         
     | 
| 
      
 69 
     | 
    
         
            +
                Then { task.library_name == 'libtest' }
         
     | 
| 
      
 70 
     | 
    
         
            +
                Then { task.cc == 'gcc' }
         
     | 
| 
      
 71 
     | 
    
         
            +
                Then { task.cflags.empty? }
         
     | 
| 
      
 72 
     | 
    
         
            +
                Then { task.includes.empty? }
         
     | 
| 
      
 73 
     | 
    
         
            +
                Then { task.sources == '*.c'  }
         
     | 
| 
      
 74 
     | 
    
         
            +
                Then { task.target_directory == '.' }
         
     | 
| 
      
 75 
     | 
    
         
            +
                Then { task.lname == 'test' }
         
     | 
| 
      
 76 
     | 
    
         
            +
                Then { task.version == '0.1.0' }
         
     | 
| 
      
 77 
     | 
    
         
            +
                Then { task.linker_name == 'libtest.so' }
         
     | 
| 
      
 78 
     | 
    
         
            +
                Then { task.soname == 'libtest.so.0' }
         
     | 
| 
      
 79 
     | 
    
         
            +
                Then { task.target_file_name == 'libtest.so.0.1.0' }
         
     | 
| 
      
 80 
     | 
    
         
            +
                Then { task.target_path == './libtest.so.0.1.0' }
         
     | 
| 
      
 81 
     | 
    
         
            +
              end
         
     | 
| 
       127 
82 
     | 
    
         | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
      
 83 
     | 
    
         
            +
              context 'with :test and a block setting '\
         
     | 
| 
      
 84 
     | 
    
         
            +
              ":version = '0.1.0' and :library_name = 'libfoo'" do
         
     | 
| 
      
 85 
     | 
    
         
            +
                When(:task) do
         
     | 
| 
      
 86 
     | 
    
         
            +
                  PaperHouse::SharedLibraryTask.new(:libtest) do |task|
         
     | 
| 
      
 87 
     | 
    
         
            +
                    task.version = '0.1.0'
         
     | 
| 
      
 88 
     | 
    
         
            +
                    task.library_name = 'libfoo'
         
     | 
| 
       130 
89 
     | 
    
         
             
                  end
         
     | 
| 
      
 90 
     | 
    
         
            +
                end
         
     | 
| 
      
 91 
     | 
    
         
            +
                Then { task.version == '0.1.0' }
         
     | 
| 
      
 92 
     | 
    
         
            +
                Then { task.library_name == 'libfoo' }
         
     | 
| 
      
 93 
     | 
    
         
            +
              end
         
     | 
| 
       131 
94 
     | 
    
         | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
                    it do
         
     | 
| 
       137 
     | 
    
         
            -
                      expect { subject }.to raise_error('version option is a mandatory.')
         
     | 
| 
       138 
     | 
    
         
            -
                    end
         
     | 
| 
      
 95 
     | 
    
         
            +
              context "with :test, '0.1.0' and a block setting :library_name = :libfoo" do
         
     | 
| 
      
 96 
     | 
    
         
            +
                When(:task) do
         
     | 
| 
      
 97 
     | 
    
         
            +
                  PaperHouse::SharedLibraryTask.new(:libtest, '0.1.0') do |task|
         
     | 
| 
      
 98 
     | 
    
         
            +
                    task.library_name = 'libfoo'
         
     | 
| 
       139 
99 
     | 
    
         
             
                  end
         
     | 
| 
       140 
100 
     | 
    
         
             
                end
         
     | 
| 
      
 101 
     | 
    
         
            +
                Then { task.library_name == 'libfoo' }
         
     | 
| 
      
 102 
     | 
    
         
            +
              end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
              context 'with :test and no optional arguments' do
         
     | 
| 
      
 105 
     | 
    
         
            +
                When(:result) { PaperHouse::SharedLibraryTask.new(:libtest) }
         
     | 
| 
      
 106 
     | 
    
         
            +
                Then { result == Failure(RuntimeError, 'version option is a mandatory.') }
         
     | 
| 
       141 
107 
     | 
    
         
             
              end
         
     | 
| 
       142 
108 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,86 +3,95 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'paper_house/static_library_task'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            describe Rake::Task do
         
     | 
| 
       6 
     | 
    
         
            -
               
     | 
| 
      
 6 
     | 
    
         
            +
              context 'when StaticLibraryTask (name = :libtest) is defined' do
         
     | 
| 
      
 7 
     | 
    
         
            +
                Given { Rake::Task.clear }
         
     | 
| 
      
 8 
     | 
    
         
            +
                Given { PaperHouse::StaticLibraryTask.new :libtest }
         
     | 
| 
       7 
9 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
                describe '.[]' do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  context 'with :libtest' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                    Given(:name) { :libtest }
         
     | 
| 
       10 
13 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                  context 'when StaticLibraryTask named :libtest is defined' do
         
     | 
| 
       15 
     | 
    
         
            -
                    before { PaperHouse::StaticLibraryTask.new :libtest }
         
     | 
| 
      
 14 
     | 
    
         
            +
                    When(:task) { Rake::Task[name] }
         
     | 
| 
      
 15 
     | 
    
         
            +
                    Then { task.is_a? Rake::Task }
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                    describe '#invoke' do
         
     | 
| 
       18 
     | 
    
         
            -
                       
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                        end.to raise_error('Cannot find sources (*.c).')
         
     | 
| 
      
 18 
     | 
    
         
            +
                      When(:result) { task.invoke }
         
     | 
| 
      
 19 
     | 
    
         
            +
                      Then do
         
     | 
| 
      
 20 
     | 
    
         
            +
                        result == Failure(RuntimeError, 'Cannot find sources (*.c).')
         
     | 
| 
       22 
21 
     | 
    
         
             
                      end
         
     | 
| 
       23 
22 
     | 
    
         
             
                    end
         
     | 
| 
       24 
23 
     | 
    
         
             
                  end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                  context 'when StaticLibraryTask named :libtest is not defined' do
         
     | 
| 
       27 
     | 
    
         
            -
                    it { expect { subject }.to raise_error }
         
     | 
| 
       28 
     | 
    
         
            -
                  end
         
     | 
| 
       29 
24 
     | 
    
         
             
                end
         
     | 
| 
       30 
25 
     | 
    
         
             
              end
         
     | 
| 
       31 
26 
     | 
    
         
             
            end
         
     | 
| 
       32 
27 
     | 
    
         | 
| 
       33 
28 
     | 
    
         
             
            describe PaperHouse::StaticLibraryTask do
         
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              describe '.find_named' do
         
     | 
| 
       37 
     | 
    
         
            -
                subject { PaperHouse::StaticLibraryTask.find_named name }
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                context 'with :libtest' do
         
     | 
| 
       40 
     | 
    
         
            -
                  let(:name) { :libtest }
         
     | 
| 
      
 29 
     | 
    
         
            +
              context 'when no tasks are defined' do
         
     | 
| 
      
 30 
     | 
    
         
            +
                Given { Rake::Task.clear }
         
     | 
| 
       41 
31 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                     
     | 
| 
       46 
     | 
    
         
            -
                  end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                  context 'when StaticLibraryTask named :libtest is not defined' do
         
     | 
| 
       49 
     | 
    
         
            -
                    it { expect(subject).to be_nil }
         
     | 
| 
      
 32 
     | 
    
         
            +
                describe '.find_by_name' do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  context "with 'libtest'" do
         
     | 
| 
      
 34 
     | 
    
         
            +
                    When(:result) { PaperHouse::StaticLibraryTask.find_by_name('libtest') }
         
     | 
| 
      
 35 
     | 
    
         
            +
                    Then { result.nil? }
         
     | 
| 
       50 
36 
     | 
    
         
             
                  end
         
     | 
| 
       51 
37 
     | 
    
         
             
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
       52 
39 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                  context 'when StaticLibraryTask named :libtest is defined' do
         
     | 
| 
       57 
     | 
    
         
            -
                    before { PaperHouse::StaticLibraryTask.new :libtest }
         
     | 
| 
      
 40 
     | 
    
         
            +
              context 'when StaticLibraryTask (name = :libtest) is defined' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                Given { Rake::Task.clear }
         
     | 
| 
      
 42 
     | 
    
         
            +
                Given { PaperHouse::StaticLibraryTask.new :libtest }
         
     | 
| 
       58 
43 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
      
 44 
     | 
    
         
            +
                describe '.find_by_name' do
         
     | 
| 
      
 45 
     | 
    
         
            +
                  context "with 'libtest'" do
         
     | 
| 
      
 46 
     | 
    
         
            +
                    When(:result) { PaperHouse::StaticLibraryTask.find_by_name('libtest') }
         
     | 
| 
      
 47 
     | 
    
         
            +
                    Then { result.is_a? PaperHouse::StaticLibraryTask }
         
     | 
| 
       60 
48 
     | 
    
         
             
                  end
         
     | 
| 
       61 
49 
     | 
    
         
             
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
       62 
51 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
      
 52 
     | 
    
         
            +
              context "when StaticLibraryTask (name = 'libtest') is defined" do
         
     | 
| 
      
 53 
     | 
    
         
            +
                Given { Rake::Task.clear }
         
     | 
| 
      
 54 
     | 
    
         
            +
                Given { PaperHouse::StaticLibraryTask.new 'libtest' }
         
     | 
| 
       65 
55 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
                describe '.find_by_name' do
         
     | 
| 
      
 57 
     | 
    
         
            +
                  context "with 'libtest'" do
         
     | 
| 
      
 58 
     | 
    
         
            +
                    When(:result) { PaperHouse::StaticLibraryTask.find_by_name('libtest') }
         
     | 
| 
      
 59 
     | 
    
         
            +
                    Then { result.is_a? PaperHouse::StaticLibraryTask }
         
     | 
| 
      
 60 
     | 
    
         
            +
                  end
         
     | 
| 
       67 
61 
     | 
    
         
             
                end
         
     | 
| 
       68 
62 
     | 
    
         
             
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
            end
         
     | 
| 
       69 
64 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 65 
     | 
    
         
            +
            describe PaperHouse::StaticLibraryTask, '.new' do
         
     | 
| 
      
 66 
     | 
    
         
            +
              context 'with :libtest' do
         
     | 
| 
      
 67 
     | 
    
         
            +
                When(:task) { PaperHouse::StaticLibraryTask.new(:libtest) }
         
     | 
| 
      
 68 
     | 
    
         
            +
                Then { task.name == 'libtest' }
         
     | 
| 
      
 69 
     | 
    
         
            +
                Then { task.library_name == 'libtest' }
         
     | 
| 
      
 70 
     | 
    
         
            +
                Then { task.cc == 'gcc' }
         
     | 
| 
      
 71 
     | 
    
         
            +
                Then { task.cflags.empty? }
         
     | 
| 
      
 72 
     | 
    
         
            +
                Then { task.includes.empty? }
         
     | 
| 
      
 73 
     | 
    
         
            +
                Then { task.sources == '*.c'  }
         
     | 
| 
      
 74 
     | 
    
         
            +
                Then { task.target_directory == '.' }
         
     | 
| 
      
 75 
     | 
    
         
            +
                Then { task.lname == 'test' }
         
     | 
| 
      
 76 
     | 
    
         
            +
                Then { task.target_file_name == 'libtest.a' }
         
     | 
| 
      
 77 
     | 
    
         
            +
                Then { task.target_path == './libtest.a' }
         
     | 
| 
      
 78 
     | 
    
         
            +
              end
         
     | 
| 
       72 
79 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 80 
     | 
    
         
            +
              context "with :test and a block setting :library_name = 'libfoo'" do
         
     | 
| 
      
 81 
     | 
    
         
            +
                When(:task) do
         
     | 
| 
      
 82 
     | 
    
         
            +
                  PaperHouse::StaticLibraryTask.new(:test) do |task|
         
     | 
| 
      
 83 
     | 
    
         
            +
                    task.library_name = 'libfoo'
         
     | 
| 
      
 84 
     | 
    
         
            +
                  end
         
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
                Then { task.library_name == 'libfoo' }
         
     | 
| 
      
 87 
     | 
    
         
            +
              end
         
     | 
| 
       75 
88 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                   
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                   
     | 
| 
       81 
     | 
    
         
            -
                  its(:target_directory) { should eq '.' }
         
     | 
| 
       82 
     | 
    
         
            -
                  its(:library_name) { should eq 'libtest' }
         
     | 
| 
       83 
     | 
    
         
            -
                  its(:lname) { should eq 'test' }
         
     | 
| 
       84 
     | 
    
         
            -
                  its(:target_file_name) { should eq 'libtest.a' }
         
     | 
| 
       85 
     | 
    
         
            -
                  its(:target_path) { should eq './libtest.a' }
         
     | 
| 
      
 89 
     | 
    
         
            +
              context 'with :test and a block setting :library_name = :libfoo' do
         
     | 
| 
      
 90 
     | 
    
         
            +
                When(:task) do
         
     | 
| 
      
 91 
     | 
    
         
            +
                  PaperHouse::StaticLibraryTask.new(:test) do |task|
         
     | 
| 
      
 92 
     | 
    
         
            +
                    task.library_name = :libfoo
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
       86 
94 
     | 
    
         
             
                end
         
     | 
| 
      
 95 
     | 
    
         
            +
                Then { task.library_name == 'libfoo' }
         
     | 
| 
       87 
96 
     | 
    
         
             
              end
         
     | 
| 
       88 
97 
     | 
    
         
             
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        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.6. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.6.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Yasuhito Takamiya
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2014- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-05-26 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: POpen4
         
     | 
| 
         @@ -28,16 +28,16 @@ dependencies: 
     | 
|
| 
       28 
28 
     | 
    
         
             
              name: rake
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
     | 
    
         
            -
                - -  
     | 
| 
      
 31 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version:  
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
     | 
    
         
            -
                - -  
     | 
| 
      
 38 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version:  
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       41 
41 
     | 
    
         
             
            description: Rake tasks for compiling C projects.
         
     | 
| 
       42 
42 
     | 
    
         
             
            email:
         
     | 
| 
       43 
43 
     | 
    
         
             
            - yasuhito@gmail.com
         
     | 
| 
         @@ -48,8 +48,47 @@ extra_rdoc_files: 
     | 
|
| 
       48 
48 
     | 
    
         
             
            files:
         
     | 
| 
       49 
49 
     | 
    
         
             
            - CONTRIBUTING.md
         
     | 
| 
       50 
50 
     | 
    
         
             
            - LICENSE
         
     | 
| 
      
 51 
     | 
    
         
            +
            - README.md
         
     | 
| 
       51 
52 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       52 
     | 
    
         
            -
            -  
     | 
| 
      
 53 
     | 
    
         
            +
            - examples/executable/Rakefile
         
     | 
| 
      
 54 
     | 
    
         
            +
            - examples/executable/Rakefile.llvm
         
     | 
| 
      
 55 
     | 
    
         
            +
            - examples/executable/hello.c
         
     | 
| 
      
 56 
     | 
    
         
            +
            - examples/executable_subdirs/Rakefile
         
     | 
| 
      
 57 
     | 
    
         
            +
            - examples/executable_subdirs/includes/hello.h
         
     | 
| 
      
 58 
     | 
    
         
            +
            - examples/executable_subdirs/sources/hello.c
         
     | 
| 
      
 59 
     | 
    
         
            +
            - examples/executable_subdirs/sources/main.c
         
     | 
| 
      
 60 
     | 
    
         
            +
            - examples/fail/Rakefile
         
     | 
| 
      
 61 
     | 
    
         
            +
            - examples/fail/hello
         
     | 
| 
      
 62 
     | 
    
         
            +
            - examples/fail/hello.c
         
     | 
| 
      
 63 
     | 
    
         
            +
            - examples/ruby_extension/Rakefile
         
     | 
| 
      
 64 
     | 
    
         
            +
            - examples/ruby_extension/Rakefile.llvm
         
     | 
| 
      
 65 
     | 
    
         
            +
            - examples/ruby_extension/hello.c
         
     | 
| 
      
 66 
     | 
    
         
            +
            - examples/shared_library/Rakefile
         
     | 
| 
      
 67 
     | 
    
         
            +
            - examples/shared_library/Rakefile.llvm
         
     | 
| 
      
 68 
     | 
    
         
            +
            - examples/shared_library/hello.c
         
     | 
| 
      
 69 
     | 
    
         
            +
            - examples/shared_library/hello.h
         
     | 
| 
      
 70 
     | 
    
         
            +
            - examples/shared_library/main.c
         
     | 
| 
      
 71 
     | 
    
         
            +
            - examples/shared_library_subdirs/Rakefile
         
     | 
| 
      
 72 
     | 
    
         
            +
            - examples/shared_library_subdirs/includes/hello.h
         
     | 
| 
      
 73 
     | 
    
         
            +
            - examples/shared_library_subdirs/sources/hello.c
         
     | 
| 
      
 74 
     | 
    
         
            +
            - examples/shared_library_subdirs/sources/main.c
         
     | 
| 
      
 75 
     | 
    
         
            +
            - examples/static_library/Rakefile
         
     | 
| 
      
 76 
     | 
    
         
            +
            - examples/static_library/Rakefile.llvm
         
     | 
| 
      
 77 
     | 
    
         
            +
            - examples/static_library/hello.c
         
     | 
| 
      
 78 
     | 
    
         
            +
            - examples/static_library/hello.h
         
     | 
| 
      
 79 
     | 
    
         
            +
            - examples/static_library/main.c
         
     | 
| 
      
 80 
     | 
    
         
            +
            - examples/static_library_subdirs/Rakefile
         
     | 
| 
      
 81 
     | 
    
         
            +
            - examples/static_library_subdirs/includes/hello.h
         
     | 
| 
      
 82 
     | 
    
         
            +
            - examples/static_library_subdirs/sources/hello.c
         
     | 
| 
      
 83 
     | 
    
         
            +
            - examples/static_library_subdirs/sources/main.c
         
     | 
| 
      
 84 
     | 
    
         
            +
            - features/executable_task.feature
         
     | 
| 
      
 85 
     | 
    
         
            +
            - features/ruby_extension_task.feature
         
     | 
| 
      
 86 
     | 
    
         
            +
            - features/shared_library_task.feature
         
     | 
| 
      
 87 
     | 
    
         
            +
            - features/static_library_task.feature
         
     | 
| 
      
 88 
     | 
    
         
            +
            - features/step_definitions/paper_house_steps.rb
         
     | 
| 
      
 89 
     | 
    
         
            +
            - features/support/env.rb
         
     | 
| 
      
 90 
     | 
    
         
            +
            - features/support/hooks.rb
         
     | 
| 
      
 91 
     | 
    
         
            +
            - lib/paper_house.rb
         
     | 
| 
       53 
92 
     | 
    
         
             
            - lib/paper_house/auto_depends.rb
         
     | 
| 
       54 
93 
     | 
    
         
             
            - lib/paper_house/build_failed.rb
         
     | 
| 
       55 
94 
     | 
    
         
             
            - lib/paper_house/build_task.rb
         
     | 
| 
         @@ -60,25 +99,16 @@ files: 
     | 
|
| 
       60 
99 
     | 
    
         
             
            - lib/paper_house/linker_options.rb
         
     | 
| 
       61 
100 
     | 
    
         
             
            - lib/paper_house/platform.rb
         
     | 
| 
       62 
101 
     | 
    
         
             
            - lib/paper_house/ruby_extension_task.rb
         
     | 
| 
       63 
     | 
    
         
            -
            - lib/paper_house/safe_popen.rb
         
     | 
| 
       64 
102 
     | 
    
         
             
            - lib/paper_house/shared_library_task.rb
         
     | 
| 
       65 
103 
     | 
    
         
             
            - lib/paper_house/static_library_task.rb
         
     | 
| 
       66 
104 
     | 
    
         
             
            - lib/paper_house/version.rb
         
     | 
| 
       67 
     | 
    
         
            -
            -  
     | 
| 
      
 105 
     | 
    
         
            +
            - paper_house.gemspec
         
     | 
| 
       68 
106 
     | 
    
         
             
            - spec/paper_house/executable_task_spec.rb
         
     | 
| 
       69 
107 
     | 
    
         
             
            - spec/paper_house/ruby_extension_task_spec.rb
         
     | 
| 
       70 
108 
     | 
    
         
             
            - spec/paper_house/shared_library_task_spec.rb
         
     | 
| 
       71 
109 
     | 
    
         
             
            - spec/paper_house/static_library_task_spec.rb
         
     | 
| 
       72 
110 
     | 
    
         
             
            - spec/paper_house/version_spec.rb
         
     | 
| 
       73 
111 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       74 
     | 
    
         
            -
            - features/executable_task.feature
         
     | 
| 
       75 
     | 
    
         
            -
            - features/ruby_extension_task.feature
         
     | 
| 
       76 
     | 
    
         
            -
            - features/shared_library_task.feature
         
     | 
| 
       77 
     | 
    
         
            -
            - features/static_library_task.feature
         
     | 
| 
       78 
     | 
    
         
            -
            - features/step_definitions/paper_house_steps.rb
         
     | 
| 
       79 
     | 
    
         
            -
            - features/support/env.rb
         
     | 
| 
       80 
     | 
    
         
            -
            - features/support/hooks.rb
         
     | 
| 
       81 
     | 
    
         
            -
            - README.md
         
     | 
| 
       82 
112 
     | 
    
         
             
            homepage: http://github.com/trema/paper-house
         
     | 
| 
       83 
113 
     | 
    
         
             
            licenses:
         
     | 
| 
       84 
114 
     | 
    
         
             
            - GPL3
         
     | 
| 
         @@ -99,22 +129,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       99 
129 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       100 
130 
     | 
    
         
             
            requirements: []
         
     | 
| 
       101 
131 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       102 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 132 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
       103 
133 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       104 
134 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       105 
135 
     | 
    
         
             
            summary: Rake for C projects.
         
     | 
| 
       106 
136 
     | 
    
         
             
            test_files:
         
     | 
| 
       107 
137 
     | 
    
         
             
            - spec/paper_house/executable_task_spec.rb
         
     | 
| 
       108 
138 
     | 
    
         
             
            - spec/paper_house/ruby_extension_task_spec.rb
         
     | 
| 
       109 
     | 
    
         
            -
            - spec/paper_house/shared_library_task_spec.rb
         
     | 
| 
       110 
     | 
    
         
            -
            - spec/paper_house/static_library_task_spec.rb
         
     | 
| 
       111 
139 
     | 
    
         
             
            - spec/paper_house/version_spec.rb
         
     | 
| 
      
 140 
     | 
    
         
            +
            - spec/paper_house/static_library_task_spec.rb
         
     | 
| 
      
 141 
     | 
    
         
            +
            - spec/paper_house/shared_library_task_spec.rb
         
     | 
| 
       112 
142 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
      
 143 
     | 
    
         
            +
            - features/support/hooks.rb
         
     | 
| 
      
 144 
     | 
    
         
            +
            - features/support/env.rb
         
     | 
| 
      
 145 
     | 
    
         
            +
            - features/static_library_task.feature
         
     | 
| 
       113 
146 
     | 
    
         
             
            - features/executable_task.feature
         
     | 
| 
      
 147 
     | 
    
         
            +
            - features/step_definitions/paper_house_steps.rb
         
     | 
| 
       114 
148 
     | 
    
         
             
            - features/ruby_extension_task.feature
         
     | 
| 
       115 
149 
     | 
    
         
             
            - features/shared_library_task.feature
         
     | 
| 
       116 
     | 
    
         
            -
            - features/static_library_task.feature
         
     | 
| 
       117 
     | 
    
         
            -
            - features/step_definitions/paper_house_steps.rb
         
     | 
| 
       118 
     | 
    
         
            -
            - features/support/env.rb
         
     | 
| 
       119 
     | 
    
         
            -
            - features/support/hooks.rb
         
     | 
| 
       120 
150 
     | 
    
         
             
            has_rdoc: 
         
     |