paper_house 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/Rakefile +3 -10
  4. data/examples/executable/Rakefile +5 -0
  5. data/examples/executable/Rakefile.llvm +5 -0
  6. data/examples/executable/hello.c +7 -0
  7. data/examples/executable_subdirs/Rakefile +11 -0
  8. data/examples/executable_subdirs/includes/hello.h +1 -0
  9. data/examples/executable_subdirs/sources/hello.c +6 -0
  10. data/examples/executable_subdirs/sources/main.c +8 -0
  11. data/examples/fail/Rakefile +5 -0
  12. data/examples/fail/hello +0 -0
  13. data/examples/fail/hello.c +1 -0
  14. data/examples/ruby_extension/Rakefile +5 -0
  15. data/examples/ruby_extension/Rakefile.llvm +5 -0
  16. data/examples/ruby_extension/hello.c +6 -0
  17. data/examples/shared_library/Rakefile +23 -0
  18. data/examples/shared_library/Rakefile.llvm +25 -0
  19. data/examples/shared_library/hello.c +6 -0
  20. data/examples/shared_library/hello.h +1 -0
  21. data/examples/shared_library/main.c +7 -0
  22. data/examples/shared_library_subdirs/Rakefile +28 -0
  23. data/examples/shared_library_subdirs/includes/hello.h +1 -0
  24. data/examples/shared_library_subdirs/sources/hello.c +6 -0
  25. data/examples/shared_library_subdirs/sources/main.c +8 -0
  26. data/examples/static_library/Rakefile +14 -0
  27. data/examples/static_library/Rakefile.llvm +14 -0
  28. data/examples/static_library/hello.c +6 -0
  29. data/examples/static_library/hello.h +1 -0
  30. data/examples/static_library/main.c +7 -0
  31. data/examples/static_library_subdirs/Rakefile +19 -0
  32. data/examples/static_library_subdirs/includes/hello.h +1 -0
  33. data/examples/static_library_subdirs/sources/hello.c +6 -0
  34. data/examples/static_library_subdirs/sources/main.c +8 -0
  35. data/features/step_definitions/paper_house_steps.rb +1 -1
  36. data/features/support/hooks.rb +2 -2
  37. data/lib/paper_house/auto_depends.rb +3 -8
  38. data/lib/paper_house/build_failed.rb +3 -1
  39. data/lib/paper_house/build_task.rb +7 -4
  40. data/lib/paper_house/dependency.rb +9 -7
  41. data/lib/paper_house/executable_task.rb +13 -1
  42. data/lib/paper_house/library_task.rb +7 -6
  43. data/lib/paper_house/linker_options.rb +1 -1
  44. data/lib/paper_house/platform.rb +7 -8
  45. data/lib/paper_house/ruby_extension_task.rb +0 -4
  46. data/lib/paper_house/shared_library_task.rb +11 -0
  47. data/lib/paper_house/version.rb +1 -1
  48. data/paper_house.gemspec +2 -1
  49. data/spec/paper_house/executable_task_spec.rb +35 -42
  50. data/spec/paper_house/ruby_extension_task_spec.rb +38 -76
  51. data/spec/paper_house/shared_library_task_spec.rb +71 -105
  52. data/spec/paper_house/static_library_task_spec.rb +63 -54
  53. data/spec/paper_house/version_spec.rb +2 -4
  54. data/spec/spec_helper.rb +2 -1
  55. metadata +54 -24
  56. data/lib/paper_house/safe_popen.rb +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f136b551f1a42ed0442a992f00f4adcc43473184
4
- data.tar.gz: dbef226b57e740d2ced2c17f0aec3de1fc616ab0
3
+ metadata.gz: 0bab1467136c21345f1bc369341770ccf7638175
4
+ data.tar.gz: 4a64697683c52a69f51f279ff8907f7865c18b43
5
5
  SHA512:
6
- metadata.gz: 53928119735fd5c66b4d579f0b6038b39cce24b0200374efda2bcf68448ff763173bb08a920862418fb7f67f17fe8504f9cb00a42b50327dc52eaad9d7491a78
7
- data.tar.gz: d88e671a4914651c212095b875b24baee85523b706853207ea668c9e6d59b6dfe06b111cbe3decb2ae0e6bfb1c58a4be70d661aacace103d7bdb8ab97f581772
6
+ metadata.gz: 5ae7a0333bc6795fbffdbf7354b453419d7986adfbc0bbb9d94ebe3926455b88d2e87a9e3cfc9482bf3bf6695c0861ce72d1b8f9d5a751653829d2d23830edff
7
+ data.tar.gz: 5037c3261c207278620e969bcfbed9be1c68bb357faf5f81f808591a2aecafbcfc09bd3098ed0cb5c82bf34f39dcf963b284d9916cac7332f41e5f7870858278
data/README.md CHANGED
@@ -5,12 +5,14 @@ Paper House
5
5
  [![Code Climate](http://img.shields.io/codeclimate/github/trema/paper-house.svg)][codeclimate]
6
6
  [![Coverage Status](http://img.shields.io/coveralls/trema/paper-house/develop.svg)][coveralls]
7
7
  [![Dependency Status](http://img.shields.io/gemnasium/trema/paper-house.svg)][gemnasium]
8
+ [![Inline docs](http://inch-pages.github.io/github/trema/paper-house.svg)][inchpages]
8
9
 
9
10
  [gem]: https://rubygems.org/gems/paper_house
10
11
  [travis]: http://travis-ci.org/trema/paper-house
11
12
  [codeclimate]: https://codeclimate.com/github/trema/paper-house
12
13
  [coveralls]: https://coveralls.io/r/trema/paper-house?branch=develop
13
14
  [gemnasium]: https://gemnasium.com/trema/paper-house
15
+ [inchpages]: http://inch-pages.github.io/github/trema/paper-house
14
16
 
15
17
  <a href="http://www.flickr.com/photos/studiobeerhorst/8221979536/" title="paper houses - 3d woodcut prints by Rick&Brenda Beerhorst, on Flickr"><img src="http://farm9.staticflickr.com/8202/8221979536_60404c309d_n.jpg" width="320" height="240" alt="paper houses - 3d woodcut prints" align="right"></a>
16
18
 
@@ -31,7 +33,7 @@ Features Overview
31
33
  ([makedepend](http://linux.die.net/man/1/makedepend) etc.) to
32
34
  resolve file dependencies.
33
35
  * Multi-Platform. Runs on both Linux and MacOSX, and supports all
34
- major version of Ruby (1.9.3, 2.0.0).
36
+ major version of Ruby (1.9.3, 2.0.0, 2.1.0).
35
37
 
36
38
 
37
39
  Example
data/Rakefile CHANGED
@@ -1,16 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'bundler/gem_tasks'
4
-
5
- # rubocop:disable HashSyntax
6
-
7
- task :default => :travis
8
-
9
- task :travis => [:spec, :cucumber, :quality, 'coveralls:push']
3
+ task default: :travis
4
+ task travis: [:spec, :cucumber, :quality, 'coveralls:push']
10
5
 
11
6
  desc 'Check for code quality'
12
- task :quality => [:reek, :flog, :flay, :rubocop]
13
-
14
- # rubocop:enable HashSyntax
7
+ task quality: [:reek, :flog, :flay, :rubocop]
15
8
 
16
9
  Dir.glob('tasks/*.rake').each { |each| import each }
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ require 'paper_house'
4
+
5
+ PaperHouse::ExecutableTask.new :hello
@@ -0,0 +1,5 @@
1
+ require "paper_house"
2
+
3
+ PaperHouse::ExecutableTask.new :hello do | task |
4
+ task.cc = "llvm-gcc"
5
+ end
@@ -0,0 +1,7 @@
1
+ #include <stdio.h>
2
+
3
+ int
4
+ main() {
5
+ printf( "Hello, PaperHouse!\n");
6
+ return 0;
7
+ }
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ require 'paper_house'
4
+
5
+ PaperHouse::ExecutableTask.new :hello do | task |
6
+ task.executable_name = 'hello'
7
+ task.target_directory = 'objects'
8
+ task.sources = 'sources/*.c'
9
+ task.includes = 'includes'
10
+ task.cflags = %w(-Wall -Wextra)
11
+ end
@@ -0,0 +1 @@
1
+ void print_hello();
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void
4
+ print_hello() {
5
+ printf( "Hello, PaperHouse!\n");
6
+ }
@@ -0,0 +1,8 @@
1
+ #include <stdlib.h>
2
+ #include "hello.h"
3
+
4
+ int
5
+ main() {
6
+ print_hello();
7
+ return 0;
8
+ }
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ require 'paper_house'
4
+
5
+ PaperHouse::ExecutableTask.new :hello
Binary file
@@ -0,0 +1 @@
1
+ error
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ require 'paper_house'
4
+
5
+ PaperHouse::RubyExtensionTask.new :hello
@@ -0,0 +1,5 @@
1
+ require "paper_house"
2
+
3
+ PaperHouse::RubyExtensionTask.new :hello do |task|
4
+ task.cc = "llvm-gcc"
5
+ end
@@ -0,0 +1,6 @@
1
+ #include "ruby.h"
2
+
3
+ void
4
+ Init_hello() {
5
+ VALUE cHelloPaperHouse = rb_define_class( "HelloPaperHouse", rb_cObject );
6
+ }
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ require 'paper_house'
4
+
5
+ libhello = PaperHouse::SharedLibraryTask.new :libhello do |task|
6
+ task.version = '0.1.0'
7
+ task.sources = 'hello.c'
8
+ task.library_dependencies = 'm' # not used.
9
+ end
10
+
11
+ [libhello.linker_name, libhello.soname].each do |each|
12
+ file each do |task|
13
+ symlink libhello.target_file_name, task.name
14
+ end
15
+ CLOBBER.include each if FileTest.exists?(each)
16
+ end
17
+
18
+ task hello: [:libhello, libhello.linker_name, libhello.soname]
19
+
20
+ PaperHouse::ExecutableTask.new :hello do |task|
21
+ task.sources = 'main.c'
22
+ task.ldflags = '-L.'
23
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ require "paper_house"
4
+
5
+ libhello = PaperHouse::SharedLibraryTask.new :libhello do |task|
6
+ task.version = "0.1.0"
7
+ task.sources = "hello.c"
8
+ task.cc = "llvm-gcc"
9
+ task.library_dependencies = "m" # not used.
10
+ end
11
+
12
+ [libhello.linker_name, libhello.soname].each do |each|
13
+ file each do |task|
14
+ symlink libhello.target_file_name, task.name
15
+ end
16
+ CLOBBER.include each if FileTest.exists?(each)
17
+ end
18
+
19
+ task :hello => [:libhello, libhello.linker_name, libhello.soname]
20
+
21
+ PaperHouse::ExecutableTask.new :hello do |task|
22
+ task.sources = "main.c"
23
+ task.cc = "llvm-gcc"
24
+ task.ldflags = "-L."
25
+ end
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void
4
+ hello() {
5
+ printf( "Hello, PaperHouse!\n");
6
+ }
@@ -0,0 +1 @@
1
+ void hello();
@@ -0,0 +1,7 @@
1
+ #include "hello.h"
2
+
3
+ int
4
+ main() {
5
+ hello();
6
+ return 0;
7
+ }
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ require 'paper_house'
4
+
5
+ libhello = PaperHouse::SharedLibraryTask.new :libhello do | task |
6
+ task.library_name = 'hello'
7
+ task.version = '0.1.0'
8
+ task.target_directory = 'objects'
9
+ task.sources = 'sources/hello.c'
10
+ task.includes = 'includes'
11
+ task.cflags = %w(-Werror -Wall -Wextra)
12
+ end
13
+
14
+ task hello: [:libhello, libhello.linker_name, libhello.soname]
15
+
16
+ PaperHouse::ExecutableTask.new :hello do | task |
17
+ task.sources = 'sources/main.c'
18
+ task.includes = 'includes'
19
+ task.ldflags = '-L.'
20
+ end
21
+
22
+ [libhello.linker_name, libhello.soname].each do | each |
23
+ file each do | task |
24
+ symlink File.join('objects', libhello.target_file_name), task.name
25
+ end
26
+
27
+ CLOBBER.include each if FileTest.exists?(each)
28
+ end
@@ -0,0 +1 @@
1
+ void print_hello();
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void
4
+ print_hello() {
5
+ printf( "Hello, PaperHouse!\n" );
6
+ }
@@ -0,0 +1,8 @@
1
+ #include <stdlib.h>
2
+ #include "hello.h"
3
+
4
+ int
5
+ main() {
6
+ print_hello();
7
+ return 0;
8
+ }
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ require 'paper_house'
4
+
5
+ task hello: :libhello
6
+
7
+ PaperHouse::StaticLibraryTask.new :libhello do | task |
8
+ task.sources = 'hello.c'
9
+ end
10
+
11
+ PaperHouse::ExecutableTask.new :hello do | task |
12
+ task.ldflags = '-L.'
13
+ task.sources = 'main.c'
14
+ end
@@ -0,0 +1,14 @@
1
+ require "paper_house"
2
+
3
+ task :hello => :libhello
4
+
5
+ PaperHouse::StaticLibraryTask.new :libhello do | task |
6
+ task.cc = "llvm-gcc"
7
+ task.sources = "hello.c"
8
+ end
9
+
10
+ PaperHouse::ExecutableTask.new :hello do | task |
11
+ task.cc = "llvm-gcc"
12
+ task.ldflags = "-L."
13
+ task.sources = "main.c"
14
+ end
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void
4
+ hello() {
5
+ printf( "Hello, PaperHouse!\n");
6
+ }
@@ -0,0 +1 @@
1
+ void hello();
@@ -0,0 +1,7 @@
1
+ #include "hello.h"
2
+
3
+ int
4
+ main() {
5
+ hello();
6
+ return 0;
7
+ }
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ require 'paper_house'
4
+
5
+ task hello: :libhello
6
+
7
+ PaperHouse::StaticLibraryTask.new :libhello do | task |
8
+ task.library_name = 'hello'
9
+ task.target_directory = 'objects'
10
+ task.sources = 'sources/hello.c'
11
+ task.includes = 'includes'
12
+ task.cflags = %w(-Werror -Wall -Wextra)
13
+ end
14
+
15
+ PaperHouse::ExecutableTask.new :hello do | task |
16
+ task.sources = 'sources/main.c'
17
+ task.includes = 'includes'
18
+ task.ldflags = '-Lobjects'
19
+ end
@@ -0,0 +1 @@
1
+ void print_hello();
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void
4
+ print_hello() {
5
+ printf( "Hello, PaperHouse!\n" );
6
+ }
@@ -0,0 +1,8 @@
1
+ #include <stdlib.h>
2
+ #include "hello.h"
3
+
4
+ int
5
+ main() {
6
+ print_hello();
7
+ return 0;
8
+ }
@@ -1,4 +1,4 @@
1
- # -*- coding: utf-8 -*-
1
+ # encoding: utf-8
2
2
 
3
3
  Given(/^the current project directory is "(.*?)"$/) do | dir |
4
4
  example_name = File.basename(dir)
@@ -1,6 +1,6 @@
1
- # -*- coding: utf-8 -*-
1
+ # encoding: utf-8
2
2
 
3
- AfterConfiguration do |config|
3
+ AfterConfiguration do |_config|
4
4
  FileUtils.rm_f Dir.glob('tmp/.*_id')
5
5
  end
6
6
 
@@ -1,17 +1,14 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
1
  # encoding: utf-8
4
2
 
5
3
  require 'paper_house/build_failed'
6
- require 'paper_house/safe_popen'
4
+ require 'popen4'
7
5
 
8
6
  module PaperHouse
9
- #
10
7
  # Automatically detects compilation dependencies.
11
- #
12
8
  class AutoDepends
13
9
  attr_reader :data
14
10
 
11
+ # @private
15
12
  def initialize(c_file, o_file, cc, cc_options)
16
13
  @cc = cc
17
14
  @command = "#{@cc} -H #{cc_options} -c #{c_file} -o #{o_file}"
@@ -19,9 +16,7 @@ module PaperHouse
19
16
  @out = STDERR
20
17
  end
21
18
 
22
- #
23
19
  # Runs dependency detection.
24
- #
25
20
  def run
26
21
  @out.puts @command
27
22
  exit_status = popen_command
@@ -31,7 +26,7 @@ module PaperHouse
31
26
  private
32
27
 
33
28
  def popen_command
34
- SafePopen.popen(@command) do |stdout, stderr, stdin, |
29
+ POpen4.popen4(@command) do |_stdout, stderr, stdin, |
35
30
  stdin.close
36
31
  parse_cc_h_stderr stderr
37
32
  end
@@ -1,4 +1,4 @@
1
- # -*- coding: utf-8 -*-
1
+ # encoding: utf-8
2
2
 
3
3
  module PaperHouse
4
4
  # Exception raised if a build task fails
@@ -6,11 +6,13 @@ module PaperHouse
6
6
  attr_reader :command
7
7
  attr_reader :status
8
8
 
9
+ # @private
9
10
  def initialize(command, status)
10
11
  @command = command
11
12
  @status = status
12
13
  end
13
14
 
15
+ # Error message
14
16
  def message
15
17
  "Command `#{command}' failed with status #{status.exitstatus}"
16
18
  end