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.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bab1467136c21345f1bc369341770ccf7638175
|
4
|
+
data.tar.gz: 4a64697683c52a69f51f279ff8907f7865c18b43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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 :
|
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,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();
|
data/examples/fail/hello
ADDED
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
error
|
@@ -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 @@
|
|
1
|
+
void hello();
|
@@ -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,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 @@
|
|
1
|
+
void hello();
|
@@ -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();
|
data/features/support/hooks.rb
CHANGED
@@ -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 '
|
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
|
-
|
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
|
-
#
|
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
|