cxxproject 0.6.14 → 0.6.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/.gitignore +18 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +4 -0
  4. data/Gemfile.lock +31 -0
  5. data/LICENSE +22 -0
  6. data/README.md +868 -0
  7. data/Rakefile.rb +25 -24
  8. data/cxx.gemspec +22 -0
  9. data/example/.gitignore +1 -0
  10. data/example/Rakefile.rb +35 -0
  11. data/example/big_project/.gitignore +2 -0
  12. data/example/big_project/Rakefile_generator.rb +80 -0
  13. data/example/big_project/fak.h +9 -0
  14. data/example/ckLayout/cxxproject/Rakefile.rb +4 -0
  15. data/example/ckLayout/io/Io.cpp +7 -0
  16. data/example/ckLayout/io/Io.h +6 -0
  17. data/example/ckLayout/io/project.rb +5 -0
  18. data/example/ckLayout/lang/Lang.cpp +7 -0
  19. data/example/ckLayout/lang/Lang.h +6 -0
  20. data/example/ckLayout/lang/project.rb +3 -0
  21. data/example/ckLayout/projects/test/main.cpp +8 -0
  22. data/example/ckLayout/projects/test/project.rb +6 -0
  23. data/example/custom/.gitignore +1 -0
  24. data/example/custom/Rakefile.rb +12 -0
  25. data/example/custom/foo.cpp +5 -0
  26. data/example/custom/project.rb +27 -0
  27. data/example/dependency_tests/Rakefile.rb +3 -0
  28. data/example/dependency_tests/help1.h +12 -0
  29. data/example/dependency_tests/help2.h +10 -0
  30. data/example/dependency_tests/main.cpp +6 -0
  31. data/example/dependency_tests/project.rb +3 -0
  32. data/example/generator/Rakefile.rb +12 -0
  33. data/example/generator/main/main.cpp +3 -0
  34. data/example/generator/main/project/project.rb +3 -0
  35. data/example/oneFileOnly/Rakefile.rb +3 -0
  36. data/example/oneFileOnly/config.h +2 -0
  37. data/example/oneFileOnly/main.cpp +8 -0
  38. data/example/oneFileOnly/project_compile.rb +3 -0
  39. data/example/protobuf/.gitignore +4 -0
  40. data/example/protobuf/Rakefile.rb +70 -0
  41. data/example/protobuf/addressbook/addressbook.proto +24 -0
  42. data/example/protobuf/addressbook/addressbook_read.cc +67 -0
  43. data/example/protobuf/addressbook/addressbook_write.cc +93 -0
  44. data/example/protobuf/addressbook/project.rb +16 -0
  45. data/example/protobuf/protobuf.files +37 -0
  46. data/example/protobuf/protobuf_project.rb +9 -0
  47. data/example/simpleUnitTest/Rakefile.rb +4 -0
  48. data/example/simpleUnitTest/atest.cpp +16 -0
  49. data/example/simpleUnitTest/atest.h +11 -0
  50. data/example/simpleUnitTest/project.rb +5 -0
  51. data/example/simpleUnitTest/test.cpp +13 -0
  52. data/example/strange_dirs/Rakefile.rb +4 -0
  53. data/example/strange_dirs/lazyLib/project.rb +5 -0
  54. data/example/strange_dirs/main/main.cpp +5 -0
  55. data/example/strange_dirs/main/project.rb +5 -0
  56. data/example/strange_dirs/src/test.cpp +4 -0
  57. data/example/test.rb +10 -0
  58. data/example/three_tests/Rakefile.rb +5 -0
  59. data/example/three_tests/allsuites/project.rb +4 -0
  60. data/example/three_tests/main/main.cpp +13 -0
  61. data/example/three_tests/main/project.rb +5 -0
  62. data/example/three_tests/suite1/project.rb +6 -0
  63. data/example/three_tests/suite1/suite1.cpp +3 -0
  64. data/example/three_tests/suite1/suite1.h +28 -0
  65. data/example/three_tests/suite2/project.rb +6 -0
  66. data/example/three_tests/suite2/suite2.cpp +3 -0
  67. data/example/three_tests/suite2/suite2.h +29 -0
  68. data/lib/cxxproject/version.rb +4 -1
  69. data/plugins/tmp/.rvmrc +1 -0
  70. data/plugins/tmp/BuildDir/objects/testme/test.o +0 -0
  71. data/plugins/tmp/BuildDir/objects/testme/test.o.d +1 -0
  72. data/plugins/tmp/BuildDir/testme.exe +0 -0
  73. data/plugins/tmp/Rakefile.rb +6 -0
  74. data/plugins/tmp/project.rb +6 -0
  75. data/plugins/tmp/reinstall/Rakefile.rb +15 -0
  76. data/plugins/tmp/test.cpp +7 -0
  77. data/rake_helper/perftools.rb +34 -0
  78. data/rake_helper/spec.rb +80 -0
  79. data/roodi.yml +8 -0
  80. data/spec/testdata/basic/exe12/help.cpp +5 -0
  81. data/spec/testdata/basic/exe12/help.h +6 -0
  82. data/spec/testdata/basic/exe12/main.cpp +10 -0
  83. data/spec/testdata/basic/lib1/lib1.cpp +7 -0
  84. data/spec/testdata/basic/lib1/lib1.h +8 -0
  85. data/spec/testdata/basic/lib2/lib2.cpp +17 -0
  86. data/spec/testdata/basic/lib2/lib2.h +6 -0
  87. data/spec/testdata/multiple_levels/libs/lib1/lib1.cpp +7 -0
  88. data/spec/testdata/multiple_levels/libs/lib1/lib1.h +8 -0
  89. data/spec/testdata/multiple_levels/libs/lib2/lib2.cpp +21 -0
  90. data/spec/testdata/multiple_levels/libs/lib2/lib2.h +6 -0
  91. data/spec/testdata/multiple_levels/mainproject/basic/help.cpp +5 -0
  92. data/spec/testdata/multiple_levels/mainproject/basic/help.h +6 -0
  93. data/spec/testdata/multiple_levels/mainproject/basic/main.cpp +10 -0
  94. data/spec/testdata/onlyOneHeader/.gitignore +1 -0
  95. data/spec/testdata/onlyOneHeader/help.cpp +5 -0
  96. data/spec/testdata/onlyOneHeader/help.h +7 -0
  97. data/spec/testdata/onlyOneHeader/main.cpp +8 -0
  98. data/spec/testdata/onlyOneHeader/testin.c +0 -0
  99. metadata +191 -91
@@ -0,0 +1,93 @@
1
+ #include <iostream>
2
+ #include <fstream>
3
+ #include <string>
4
+ #include "addressbook/addressbook.pb.h"
5
+ using namespace std;
6
+
7
+ // This function fills in a Person message based on user input.
8
+ void PromptForAddress(tutorial::Person* person) {
9
+ cout << "Enter person ID number: ";
10
+ int id;
11
+ cin >> id;
12
+ person->set_id(id);
13
+ cin.ignore(256, '\n');
14
+
15
+ cout << "Enter name: ";
16
+ getline(cin, *person->mutable_name());
17
+
18
+ cout << "Enter email address (blank for none): ";
19
+ string email;
20
+ getline(cin, email);
21
+ if (!email.empty()) {
22
+ person->set_email(email);
23
+ }
24
+
25
+ while (true) {
26
+ cout << "Enter a phone number (or leave blank to finish): ";
27
+ string number;
28
+ getline(cin, number);
29
+ if (number.empty()) {
30
+ break;
31
+ }
32
+
33
+ tutorial::Person::PhoneNumber* phone_number = person->add_phone();
34
+ phone_number->set_number(number);
35
+
36
+ cout << "Is this a mobile, home, or work phone? ";
37
+ string type;
38
+ getline(cin, type);
39
+ if (type == "mobile") {
40
+ phone_number->set_type(tutorial::Person::MOBILE);
41
+ } else if (type == "home") {
42
+ phone_number->set_type(tutorial::Person::HOME);
43
+ } else if (type == "work") {
44
+ phone_number->set_type(tutorial::Person::WORK);
45
+ } else {
46
+ cout << "Unknown phone type. Using default." << endl;
47
+ }
48
+ }
49
+ }
50
+
51
+ // Main function: Reads the entire address book from a file,
52
+ // adds one person based on user input, then writes it back out to the same
53
+ // file.
54
+ int main(int argc, char* argv[]) {
55
+ // Verify that the version of the library that we linked against is
56
+ // compatible with the version of the headers we compiled against.
57
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
58
+
59
+ if (argc != 2) {
60
+ cerr << "Usage: " << argv[0] << " ADDRESS_BOOK_FILE" << endl;
61
+ return -1;
62
+ }
63
+
64
+ tutorial::AddressBook address_book;
65
+
66
+ {
67
+ // Read the existing address book.
68
+ fstream input(argv[1], ios::in | ios::binary);
69
+ if (!input) {
70
+ cout << argv[1] << ": File not found. Creating a new file." << endl;
71
+ } else if (!address_book.ParseFromIstream(&input)) {
72
+ cerr << "Failed to parse address book." << endl;
73
+ return -1;
74
+ }
75
+ }
76
+
77
+ // Add an address.
78
+ PromptForAddress(address_book.add_person());
79
+
80
+ {
81
+ // Write the new address book back to disk.
82
+ fstream output(argv[1], ios::out | ios::trunc | ios::binary);
83
+ if (!address_book.SerializeToOstream(&output)) {
84
+ cerr << "Failed to write address book." << endl;
85
+ return -1;
86
+ }
87
+ }
88
+
89
+ // Optional: Delete all global objects allocated by libprotobuf.
90
+ google::protobuf::ShutdownProtobufLibrary();
91
+
92
+ return 0;
93
+ }
@@ -0,0 +1,16 @@
1
+ cxx_configuration do
2
+
3
+ source_lib 'addressbook_pb_api',
4
+ :sources => ['gen/addressbook/addressbook.pb.cc'],
5
+ :includes => ['gen'],
6
+ :dependencies => ['protobuf']
7
+
8
+ exe 'addressbook_write',
9
+ :sources => ['addressbook_write.cc'],
10
+ :dependencies => ['addressbook_pb_api']
11
+
12
+ exe 'addressbook_read',
13
+ :sources => ['addressbook_read.cc'],
14
+ :dependencies => ['addressbook_pb_api']
15
+
16
+ end
@@ -0,0 +1,37 @@
1
+ - google/protobuf/stubs/common.cc
2
+ - google/protobuf/stubs/once.cc
3
+ - google/protobuf/stubs/hash.h
4
+ - google/protobuf/stubs/map-util.h
5
+ - google/protobuf/stubs/stl_util-inl.h
6
+ - google/protobuf/extension_set.cc
7
+ - google/protobuf/generated_message_util.cc
8
+ - google/protobuf/message_lite.cc
9
+ - google/protobuf/repeated_field.cc
10
+ - google/protobuf/wire_format_lite.cc
11
+ - google/protobuf/io/coded_stream.cc
12
+ - google/protobuf/io/coded_stream_inl.h
13
+ - google/protobuf/io/zero_copy_stream.cc
14
+ - google/protobuf/io/zero_copy_stream_impl_lite.cc
15
+ - google/protobuf/stubs/strutil.cc
16
+ - google/protobuf/stubs/strutil.h
17
+ - google/protobuf/stubs/substitute.cc
18
+ - google/protobuf/stubs/substitute.h
19
+ - google/protobuf/stubs/structurally_valid.cc
20
+ - google/protobuf/descriptor.cc
21
+ - google/protobuf/descriptor.pb.cc
22
+ - google/protobuf/descriptor_database.cc
23
+ - google/protobuf/dynamic_message.cc
24
+ - google/protobuf/extension_set_heavy.cc
25
+ - google/protobuf/generated_message_reflection.cc
26
+ - google/protobuf/message.cc
27
+ - google/protobuf/reflection_ops.cc
28
+ - google/protobuf/service.cc
29
+ - google/protobuf/text_format.cc
30
+ - google/protobuf/unknown_field_set.cc
31
+ - google/protobuf/wire_format.cc
32
+ - google/protobuf/io/gzip_stream.cc
33
+ - google/protobuf/io/printer.cc
34
+ - google/protobuf/io/tokenizer.cc
35
+ - google/protobuf/io/zero_copy_stream_impl.cc
36
+ - google/protobuf/compiler/importer.cc
37
+ - google/protobuf/compiler/parser.cc
@@ -0,0 +1,9 @@
1
+ cxx_configuration do
2
+ deps = [BinaryLibrary.new('z'), BinaryLibrary.new('pthread')]
3
+
4
+ source_lib 'protobuf',
5
+ :sources => PROTOBUF_LITE_SOURCES.delete_if{ |i| i.index('.h') },
6
+ :includes => [File.join(PROTOBUF_BASE, 'src'), File.join(PROTOBUF_BASE, 'tmp')],
7
+ :dependencies => deps,
8
+ :file_dependencies => [PROTOBUF_CONFIG_H]
9
+ end
@@ -0,0 +1,4 @@
1
+ $:.unshift File.join(File.dirname(__FILE__),"..","..","lib")
2
+ require 'cxxproject'
3
+ BuildDir='build'
4
+ CxxProject2Rake.new(Dir.glob('**/project.rb'), BuildDir, "gcc")
@@ -0,0 +1,16 @@
1
+ #include "atest.h"
2
+
3
+ CPPUNIT_TEST_SUITE_REGISTRATION(ATest);
4
+
5
+ void ATest::test1() {
6
+ CPPUNIT_ASSERT(1 == 1);
7
+ }
8
+ int f1() {
9
+ return 1;
10
+ }
11
+ int f2() {
12
+ return 2;
13
+ }
14
+ void ATest::test2() {
15
+ CPPUNIT_ASSERT_EQUAL(f1(), f2());
16
+ }
@@ -0,0 +1,11 @@
1
+ #include "cppunit/extensions/HelperMacros.h"
2
+
3
+ class ATest : public CppUnit::TestFixture {
4
+ CPPUNIT_TEST_SUITE( ATest );
5
+ CPPUNIT_TEST( test1 );
6
+ CPPUNIT_TEST( test2 );
7
+ CPPUNIT_TEST_SUITE_END();
8
+ public:
9
+ void test1();
10
+ void test2();
11
+ };
@@ -0,0 +1,5 @@
1
+ cxx_configuration do
2
+ exe "dependency_test",
3
+ :sources => FileList['**/*.cpp'],
4
+ :dependencies => [BinaryLibrary.new('cppunit')]
5
+ end
@@ -0,0 +1,13 @@
1
+ #include <cassert>
2
+
3
+ #include <cppunit/TestCase.h>
4
+ #include <cppunit/ui/text/TestRunner.h>
5
+ #include <cppunit/extensions/TestFactoryRegistry.h>
6
+
7
+ int main( int argc, char **argv) {
8
+ CppUnit::TextUi::TestRunner runner;
9
+ CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
10
+ runner.addTest( registry.makeTest() );
11
+ bool wasSuccessful = runner.run( );
12
+ return wasSuccessful ? 0 : 1;
13
+ }
@@ -0,0 +1,4 @@
1
+ $:.unshift File.join(File.dirname(__FILE__),"..","..","lib")
2
+
3
+ require 'cxxproject'
4
+ CxxProject2Rake.new(Dir.glob('**/*project.rb'), "build", "gcc", ".")
@@ -0,0 +1,5 @@
1
+ cxx_configuration do
2
+ source_lib "lazy",
3
+ :sources => FileList['../src/*.cpp'],
4
+ :includes => ['.']
5
+ end
@@ -0,0 +1,5 @@
1
+ extern void print();
2
+ int main(int argc, char** args) {
3
+ print();
4
+ return 0;
5
+ }
@@ -0,0 +1,5 @@
1
+ cxx_configuration do
2
+ exe 'main',
3
+ :sources => Dir.glob('*.cpp'),
4
+ :dependencies => 'lazy'
5
+ end
@@ -0,0 +1,4 @@
1
+ #include <stdio.h>
2
+ void print() {
3
+ printf("super\n");
4
+ }
data/example/test.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'logger'
2
+
3
+ log = Logger.new(STDOUT)
4
+ log.level = Logger::DEBUG
5
+
6
+ log.debug("Created logger")
7
+ log.info("Program started")
8
+ log.warn("Nothing to do!")
9
+
10
+
@@ -0,0 +1,5 @@
1
+ $:.unshift File.join(File.dirname(__FILE__),"..","..","lib")
2
+ require 'cxxproject'
3
+ BuildDir='build'
4
+ CxxProject2Rake.new(Dir.glob('**/*project.rb'), BuildDir, "gcc")
5
+
@@ -0,0 +1,4 @@
1
+ cxx_configuration do
2
+ exe "allsuites",
3
+ :dependencies => ['suite1_lib', 'suite2_lib', 'main']
4
+ end
@@ -0,0 +1,13 @@
1
+ #include <cassert>
2
+
3
+ #include <cppunit/TestCase.h>
4
+ #include <cppunit/ui/text/TestRunner.h>
5
+ #include <cppunit/extensions/TestFactoryRegistry.h>
6
+
7
+ int main( int argc, char **argv) {
8
+ CppUnit::TextUi::TestRunner runner;
9
+ CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
10
+ runner.addTest( registry.makeTest() );
11
+ bool wasSuccessful = runner.run( );
12
+ return wasSuccessful ? 0 : 1;
13
+ }
@@ -0,0 +1,5 @@
1
+ cxx_configuration do
2
+ source_lib "main",
3
+ :sources => ['main.cpp'],
4
+ :dependencies => [BinaryLibrary.new('cppunit')]
5
+ end
@@ -0,0 +1,6 @@
1
+ cxx_configuration do
2
+ exe "suite1",
3
+ :dependencies => ['suite1_lib', 'main']
4
+ source_lib "suite1_lib",
5
+ :sources => FileList.new('**/*.cpp')
6
+ end
@@ -0,0 +1,3 @@
1
+ #include "suite1.h"
2
+
3
+ CPPUNIT_TEST_SUITE_REGISTRATION( Suite1 );
@@ -0,0 +1,28 @@
1
+ #ifndef suite1_h_
2
+ #define suite1_h_
3
+
4
+ #include <cppunit/TestCase.h>
5
+ #include <cppunit/extensions/HelperMacros.h>
6
+
7
+ class Suite1 : public CppUnit::TestFixture {
8
+
9
+ public:
10
+
11
+ void setUp() {
12
+ }
13
+
14
+
15
+ void tearDown() {
16
+ }
17
+
18
+ void test1() {
19
+ CPPUNIT_ASSERT_MESSAGE( "hat geklappt", true );
20
+ }
21
+
22
+ CPPUNIT_TEST_SUITE( Suite1 );
23
+ CPPUNIT_TEST( test1 );
24
+ CPPUNIT_TEST_SUITE_END();
25
+
26
+ };
27
+
28
+ #endif
@@ -0,0 +1,6 @@
1
+ cxx_configuration do
2
+ exe "suite2",
3
+ :dependencies => ['suite2_lib', 'main']
4
+ source_lib "suite2_lib",
5
+ :sources => FileList.new('**/*.cpp')
6
+ end
@@ -0,0 +1,3 @@
1
+ #include "suite2.h"
2
+
3
+ CPPUNIT_TEST_SUITE_REGISTRATION( Suite2 );
@@ -0,0 +1,29 @@
1
+ #ifndef suite2_h_
2
+ #define suite2_h_
3
+
4
+ #include <cppunit/TestCase.h>
5
+ #include <cppunit/extensions/HelperMacros.h>
6
+
7
+ class Suite2 : public CppUnit::TestFixture {
8
+
9
+ public:
10
+
11
+ void setUp() {
12
+ }
13
+
14
+
15
+ void tearDown() {
16
+ }
17
+
18
+ void test2() {
19
+ printf("inside test2\n");
20
+ CPPUNIT_ASSERT_MESSAGE( "hat auch geklappt", true );
21
+ }
22
+
23
+ CPPUNIT_TEST_SUITE( Suite2 );
24
+ CPPUNIT_TEST( test2 );
25
+ CPPUNIT_TEST_SUITE_END();
26
+
27
+ };
28
+
29
+ #endif
@@ -1,7 +1,10 @@
1
1
  module Cxxproject
2
+ VERSION = "0.6.17"
3
+
2
4
  class Version
3
5
  def self.cxxproject
4
- '0.6.14'
6
+ return Cxxproject::VERSION
5
7
  end
6
8
  end
9
+
7
10
  end
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@cxxgcctoolchaintest --create
@@ -0,0 +1 @@
1
+ --- []
Binary file
@@ -0,0 +1,6 @@
1
+ $:.unshift File.join(File.dirname(__FILE__),"..","..","lib")
2
+ require 'cxxproject'
3
+ BuildDir = "BuildDir"
4
+
5
+ dependent_projects = ['./project.rb']
6
+ CxxProject2Rake.new(dependent_projects, BuildDir, "clang", './')
@@ -0,0 +1,6 @@
1
+ cxx_configuration do
2
+ exe "testme",
3
+ :sources => FileList['**/*.cpp'],
4
+ :includes => ['.'],
5
+ :dependencies => []
6
+ end
@@ -0,0 +1,15 @@
1
+ require 'rake/clean'
2
+
3
+ desc 'reinstall plugins'
4
+ task :reinstall do
5
+ toolchainpath="../../../plugins/"
6
+ plugins = ["gcc","clang","diab"]
7
+ plugins.each do |p|
8
+ plugin = "cxxproject_#{p}toolchain"
9
+ sh "gem uninstall #{plugin}"
10
+ cd "#{toolchainpath}toolchain#{p}" do
11
+ sh "gem build #{p}.gemspec"
12
+ sh "gem install #{plugin}"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ #include <stdio.h>
2
+
3
+ int main(int argc, const char *argv[])
4
+ {
5
+ printf("hello world\n");
6
+ return 0;
7
+ }
@@ -0,0 +1,34 @@
1
+ begin
2
+ require 'perftools'
3
+ namespace :perftools do
4
+ def my_cd
5
+ cd('example/big_project', :verbose => false) do
6
+ yield
7
+ end
8
+ end
9
+ task :clean_big_project do
10
+ my_cd do
11
+ require 'fileutils'
12
+ FileUtils.rm_rf('build')
13
+ FileUtils.rm_rf('gen')
14
+ end
15
+ end
16
+ task :generate_big_project => [:clean_big_project] do
17
+ my_cd do
18
+ sh 'rake -f Rakefile_generator.rb'
19
+ end
20
+ end
21
+ task :big_project => [:generate_big_project] do
22
+ my_cd do
23
+ sh 'CPUPROFILE=./test.profile RUBYOPT="-r`gem which perftools | tail -1`" ruby gen/Rakefile.rb'
24
+ end
25
+ end
26
+ desc 'Show perftools profile'
27
+ task :show_profile => [:big_project] do
28
+ my_cd do
29
+ sh 'pprof.rb --web profile'
30
+ end
31
+ end
32
+ end
33
+ rescue LoadError => e
34
+ end
@@ -0,0 +1,80 @@
1
+ SPEC_PATTERN ='spec/**/*_spec.rb'
2
+ require './lib/cxxproject/utils/optional'
3
+ def rcov_for_18
4
+ use_rcov = true
5
+ begin
6
+ gem "rcov"
7
+ rescue LoadError
8
+ warn "rcov not installed...code coverage will not be measured!"
9
+ use_rcov = false
10
+ end
11
+ use_rcov
12
+ end
13
+
14
+
15
+ def coverage
16
+ load_rcov = lambda do
17
+ require 'rcov'
18
+ RSpec::Core::RakeTask.new(:coverage) do |t|
19
+ t.pattern = SPEC_PATTERN
20
+ t.rcov = true
21
+ t.rcov_opts = ['--exclude', '.*/gems/.*']
22
+ end
23
+ end
24
+ simple_cov_or_nothing = lambda do
25
+ load_simplecov = lambda do
26
+ require 'simplecov'
27
+ task :coverage do
28
+ ENV['COVERAGE'] = 'yes'
29
+ Rake::Task['spec:spec'].invoke
30
+ end
31
+ end
32
+ could_not_define_rcov_or_simplecov = lambda do
33
+ task :coverage do
34
+ puts "Please install coverage tools with\n\"gem install simplecov\" for ruby 1.9 or\n\"gem install rcov\" for ruby 1.8"
35
+ end
36
+ end
37
+ Cxxproject::Utils::optional_package(load_simplecov, could_not_define_rcov_or_simplecov)
38
+ end
39
+ Cxxproject::Utils::optional_package(load_rcov, simple_cov_or_nothing)
40
+ end
41
+
42
+ def new_rspec
43
+ require 'rspec/core/rake_task'
44
+ desc "Run examples"
45
+ RSpec::Core::RakeTask.new() do |t|
46
+ t.pattern = SPEC_PATTERN
47
+ end
48
+
49
+ desc 'Run examples with coverage'
50
+ coverage
51
+ CLOBBER.include('coverage')
52
+ end
53
+
54
+ def old_rspec
55
+ require 'spec/rake/spectask'
56
+ desc "Run examples"
57
+ Spec::Rake::SpecTask.new() do |t|
58
+ t.spec_files = SPEC_PATTERN
59
+ end
60
+ end
61
+
62
+ namespace :spec do
63
+ begin
64
+ new_rspec
65
+ rescue LoadError
66
+ begin
67
+ old_rspec
68
+ rescue LoadError
69
+ desc "Run examples"
70
+ task 'spec' do
71
+ puts 'rspec not installed...! please install with "gem install rspec"'
72
+ end
73
+ end
74
+ end
75
+ end
76
+ task :spec do
77
+ puts 'Please use spec:spec or spec:coverage'
78
+ end
79
+ task :gem => [:spec]
80
+
data/roodi.yml ADDED
@@ -0,0 +1,8 @@
1
+ CaseMissingElseCheck: { }
2
+ CyclomaticComplexityBlockCheck: { complexity: 9 }
3
+ CyclomaticComplexityMethodCheck: { complexity: 10 }
4
+ #MethodLineCountCheck: { line_count: 100 }
5
+ MethodNameCheck: { pattern: !ruby/regexp /^[_a-z<>=\[\]|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/ }
6
+ ModuleLineCountCheck: { line_count: 300 }
7
+ ModuleNameCheck: { pattern: !ruby/regexp /^[A-Z][a-zA-Z0-9]*$/ }
8
+ ParameterNumberCheck: { parameter_count: 6 }
@@ -0,0 +1,5 @@
1
+ #include "help.h"
2
+ #include <iostream>
3
+ void helpMe() {
4
+ std::cout << "help me" << std::endl;
5
+ }
@@ -0,0 +1,6 @@
1
+ #ifndef help_h_
2
+ #define help_h_
3
+
4
+ void helpMe();
5
+
6
+ #endif
@@ -0,0 +1,10 @@
1
+ // #include "lib2.h"
2
+ #include <iostream>
3
+ #include "help.h"
4
+
5
+ int main(int argc, char** args) {
6
+ helpMe();
7
+ // lib2();
8
+ std::cout << "hello world" << std::endl;
9
+ return 0;
10
+ }
@@ -0,0 +1,7 @@
1
+ #include "lib1.h"
2
+
3
+ #include <iostream>
4
+
5
+ void lib1() {
6
+ std::cout << "lib1" << std::endl;
7
+ }
@@ -0,0 +1,8 @@
1
+ #ifndef lib1_h_
2
+ #define lib1_h_
3
+
4
+ void lib1();
5
+
6
+
7
+ #endif
8
+
@@ -0,0 +1,17 @@
1
+ #include "lib2.h"
2
+
3
+ #include <iostream>
4
+ #include <math.h>
5
+ #include "lib1.h"
6
+ #include <dlfcn.h>
7
+ #include <zlib.h>
8
+
9
+ void lib2() {
10
+ std::cout << "lib2" << std::endl;
11
+ lib1();
12
+ std::cout << sin(5) << std::endl;
13
+ void* help = dlopen("test", RTLD_LAZY);
14
+ std::cout << (long)help << std::endl;
15
+ Bytef b = 0;
16
+ uLong res = crc32(0, &b, 1);
17
+ }
@@ -0,0 +1,6 @@
1
+ #ifndef lib2_h_
2
+ #define lib2_h_
3
+
4
+ void lib2();
5
+
6
+ #endif
@@ -0,0 +1,7 @@
1
+ #include "lib1.h"
2
+
3
+ #include <iostream>
4
+
5
+ void lib1() {
6
+ std::cout << "lib1" << std::endl;
7
+ }
@@ -0,0 +1,8 @@
1
+ #ifndef lib1_h_
2
+ #define lib1_h_
3
+
4
+ void lib1();
5
+
6
+
7
+ #endif
8
+