erebus 0.0.3 → 0.1.0

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.
@@ -21,5 +21,6 @@ Gem::Specification.new do |gem|
21
21
  gem.add_dependency 'activesupport', "~> 3.2.11"
22
22
  gem.add_dependency 'i18n',"~> 0.6.1"
23
23
  gem.add_dependency "multi_json", "~> 1.5.0"
24
+ gem.add_dependency "rubyzip", "~> 0.9.9"
24
25
  gem.add_development_dependency "pry"
25
26
  end
@@ -3,6 +3,8 @@ require "erebus/generator"
3
3
  require "thor"
4
4
  require "fileutils"
5
5
  require 'active_support/core_ext'
6
+ require "erebus/core_ext/net_http_patch"
7
+
6
8
  module Erebus
7
9
  # Your code goes here...
8
10
  class App < Thor
@@ -0,0 +1,18 @@
1
+ require "zip/zip"
2
+ module Erebus
3
+ module Actions
4
+ module ZipFile
5
+
6
+ def extract source_file, destination
7
+ Zip::ZipFile.open(source_file) do |zip_file|
8
+ zip_file.each do |f|
9
+ f_path=File.join(destination, f.name)
10
+ FileUtils.mkdir_p(File.dirname(f_path))
11
+ zip_file.extract(f, f_path) unless File.exist?(f_path)
12
+ end
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ require 'net/http'
2
+ require 'openssl'
3
+
4
+ class Net::HTTP
5
+ alias_method :origConnect, :connect
6
+ def connect
7
+ self.verify_mode = OpenSSL::SSL::VERIFY_NONE
8
+ origConnect
9
+ end
10
+ end
@@ -7,6 +7,8 @@ class CppClass < Erebus::NamedGenerator
7
7
 
8
8
  #class_option :ext,:type => :string ,:default => "cpp", :desc => "Extention used for the source file"
9
9
 
10
+ class_option :testing, :type => :boolean, :default => true
11
+
10
12
  def self.source_root
11
13
  File.dirname(__FILE__)
12
14
  end
@@ -19,6 +21,12 @@ class CppClass < Erebus::NamedGenerator
19
21
  template "templates/class.cpp.erb", "src/#{file_name}.cpp"
20
22
  end
21
23
 
24
+ def add_testing_framework
25
+ if options[:testing]
26
+ invoke "spec", ["#{class_name}"]
27
+ end
28
+ end
29
+
22
30
  private
23
31
  # def ext
24
32
  # options[:ext]
@@ -1,12 +1,13 @@
1
1
  require "erebus/generator"
2
-
2
+ require 'fileutils'
3
3
  class Project < Erebus::NamedGenerator
4
4
  desc "Create a C/C++ Project"
5
5
 
6
+ class_option :testing, :type => :boolean, :default => true
6
7
  def self.source_root
7
8
  File.dirname(__FILE__)
8
9
  end
9
-
10
+
10
11
  def create_rake_file
11
12
  template "templates/rake.erb", "#{class_name}/Rakefile"
12
13
  end
@@ -24,5 +25,10 @@ class Project < Erebus::NamedGenerator
24
25
  template "templates/project.erebus.erb", "#{class_name}/.erebus"
25
26
  end
26
27
 
28
+ def add_testing_framework
29
+ if options[:testing]
30
+ invoke "setup_test", ["#{class_name}"]
31
+ end
32
+ end
27
33
  end
28
34
 
@@ -0,0 +1,30 @@
1
+ require "erebus/generator"
2
+ require "erebus/actions/zip_file"
3
+ class SetupTest < Erebus::NamedGenerator
4
+ desc "Add testing framework Igloo to project"
5
+
6
+ include Erebus::Actions::ZipFile
7
+
8
+ def self.source_root
9
+ File.dirname(__FILE__)
10
+ end
11
+
12
+ def get_test_framework
13
+ #SetupTest.validate_project
14
+ get "https://github.com/joakimkarlsson/igloo/archive/master.zip", "#{class_name}/lib/igloo.zip"
15
+ say_status :extracting, "#{class_name}/lib/igloo.zip"
16
+ extract "#{class_name}/lib/igloo.zip", "#{class_name}/lib"
17
+ remove_file "#{class_name}/lib/igloo.zip"
18
+ end
19
+
20
+ def create_test_runner
21
+ template "templates/spec_runner.cpp.erb", "#{class_name}/spec/runner.cpp"
22
+ end
23
+
24
+ def append_rake_command
25
+ if !File.exist?("#{class_name}/test.rake")
26
+ template "templates/rake_test.erb", "#{class_name}/test.rake"
27
+ append_file "#{class_name}/Rakefile", 'import "test.rake"'
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ require "erebus/generator"
2
+
3
+ class Spec < Erebus::NamedGenerator
4
+ desc "Create a Igloo testing source file"
5
+
6
+ #class_option :ext,:type => :string ,:default => "cpp", :desc => "Extention used for the source file"
7
+
8
+ class_option :use_alt, :type => :boolean, :default => true, :desc => "Use the alt syntax for igloo"
9
+
10
+ def self.source_root
11
+ File.dirname(__FILE__)
12
+ end
13
+
14
+ def create_source_file
15
+ Spec.validate_project
16
+ if(options[:use_alt])
17
+ template "templates/spec_alt.erb", "spec/#{file_name}_spec.#{ext}"
18
+ else
19
+ template "templates/spec.erb", "spec/#{file_name}_spec.#{ext}"
20
+ end
21
+ end
22
+
23
+ private
24
+ def ext
25
+ "cpp"
26
+ # options[:ext]
27
+ end
28
+ end
@@ -1,3 +1,4 @@
1
1
  build
2
2
  dist
3
- *.o
3
+ *.o
4
+ lib
@@ -32,4 +32,5 @@ end
32
32
  desc "Run the app"
33
33
  task :run => [:clean, :build] do
34
34
  system "#{File.join(PROJECT_DIR, "build")}/#{APP_NAME}"
35
- end
35
+ end
36
+
@@ -0,0 +1,29 @@
1
+ INCLUDES = [HEADERS_DIR]
2
+ TEST_DIR = "spec"
3
+
4
+
5
+ desc "Build the Test Application"
6
+ task :build_test do
7
+ FileUtils.mkdir File.join(PROJECT_DIR, "build") if !Dir.exist?(File.join(PROJECT_DIR, "build"))
8
+ flags = FLAGS.join(" ")
9
+ INCLUDES << "lib/igloo-master"
10
+ headers = INCLUDES.collect{|x| "-I#{File.join(PROJECT_DIR, x)}" }.join(" ")
11
+ lib_paths = LIB_PATHS.collect{|x| "-L#{x}"}.join(" ")
12
+ libs = LIBRARIES.collect{|x| "-l#{x}"}.join(" ")
13
+ source_path = File.join(PROJECT_DIR, SOURCE_DIR)
14
+ files_array = Dir.glob(File.join(SOURCE_DIR,"**", "*.{c,cpp}"))
15
+ files_array.delete "src/main.cpp"
16
+ files_array += Dir.glob(File.join(TEST_DIR,"**", "*.{c,cpp}"))
17
+ files = files_array.join(" ")
18
+
19
+ puts files
20
+ output = "-o #{File.join(PROJECT_DIR, "build")}/#{APP_NAME}_test"
21
+ command = "#{CC} #{flags} #{headers} #{lib_paths} #{libs} #{files} #{output}"
22
+ puts command
23
+ system command
24
+ end
25
+
26
+ desc "Run the test"
27
+ task :test => [:clean, :build_test] do
28
+ system "#{File.join(PROJECT_DIR, "build")}/#{APP_NAME}_test"
29
+ end
@@ -0,0 +1,15 @@
1
+ #include <igloo/igloo.h>
2
+ #include "<%= "#{file_name}.h" %>"
3
+
4
+ using namespace igloo;
5
+
6
+
7
+ Context(<%= class_name %>){
8
+ void SetUp(){
9
+ // Setup test
10
+ }
11
+
12
+ Spec(should_really_do_something){
13
+ // define task here
14
+ }
15
+ };
@@ -0,0 +1,16 @@
1
+ #include <igloo/igloo_alt.h>
2
+ #include "<%= "#{file_name}.h" %>"
3
+ using namespace igloo;
4
+
5
+ Describe(<%= class_name %>)
6
+ {
7
+ bool its_true;
8
+
9
+ An_entity() : its_true(true) {}
10
+
11
+ It(should_do_something)
12
+ {
13
+ Assert::That(its_true, IsTrue());
14
+ }
15
+
16
+ };
@@ -0,0 +1,7 @@
1
+ #include <igloo/igloo.h>
2
+ using namespace igloo;
3
+
4
+ int main()
5
+ {
6
+ return TestRunner::RunAllTests();
7
+ }
@@ -1,3 +1,3 @@
1
1
  module Erebus
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erebus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-07 00:00:00.000000000 Z
12
+ date: 2013-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -75,6 +75,22 @@ dependencies:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
77
  version: 1.5.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: rubyzip
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 0.9.9
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.9.9
78
94
  - !ruby/object:Gem::Dependency
79
95
  name: pry
80
96
  requirement: !ruby/object:Gem::Requirement
@@ -108,11 +124,15 @@ files:
108
124
  - bin/erebus
109
125
  - erebus.gemspec
110
126
  - lib/erebus.rb
127
+ - lib/erebus/actions/zip_file.rb
128
+ - lib/erebus/core_ext/net_http_patch.rb
111
129
  - lib/erebus/generator.rb
112
130
  - lib/erebus/generators/cpp_class.rb
113
131
  - lib/erebus/generators/header.rb
114
132
  - lib/erebus/generators/project.rb
133
+ - lib/erebus/generators/setup_test.rb
115
134
  - lib/erebus/generators/source.rb
135
+ - lib/erebus/generators/spec.rb
116
136
  - lib/erebus/generators/templates/blank.erb
117
137
  - lib/erebus/generators/templates/class.cpp.erb
118
138
  - lib/erebus/generators/templates/class.h.erb
@@ -120,6 +140,10 @@ files:
120
140
  - lib/erebus/generators/templates/main.cpp.erb
121
141
  - lib/erebus/generators/templates/project.erebus.erb
122
142
  - lib/erebus/generators/templates/rake.erb
143
+ - lib/erebus/generators/templates/rake_test.erb
144
+ - lib/erebus/generators/templates/spec.erb
145
+ - lib/erebus/generators/templates/spec_alt.erb
146
+ - lib/erebus/generators/templates/spec_runner.cpp.erb
123
147
  - lib/erebus/version.rb
124
148
  homepage: https://github.com/cajun-code/erebus
125
149
  licenses: []