erebus 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@cpp_gem --create
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cpp_dev_tool.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Allan Davis
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ Erebus
2
+ ==============
3
+
4
+ C++ Development can be a pain. Project setup is dependent on the tools used in the project and the developer. This tool is a command line tool for generating project and files independent of any ide or editor.
5
+
6
+ Installation
7
+ ---------------
8
+
9
+ Install it yourself as:
10
+
11
+ $ gem install erebus
12
+
13
+ Usage
14
+ -----------
15
+
16
+ ..:: Todo: Write usage instructions here
17
+
18
+
19
+ Contributing
20
+ --------------
21
+
22
+ 1. Fork it
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
24
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
25
+ 4. Push to the branch (`git push origin my-new-feature`)
26
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,11 @@
1
+ #! /usr/bin/env ruby
2
+ require "bundler/setup"
3
+
4
+ path = File.absolute_path(File.join(File.dirname(__FILE__), "..", "lib"))
5
+
6
+ $LOAD_PATH << path
7
+
8
+ require "erebus"
9
+
10
+ Erebus::App.load_generators
11
+ Erebus::App.start(ARGV)
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'erebus/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "erebus"
8
+ gem.version = Erebus::VERSION
9
+ gem.authors = ["Allan Davis"]
10
+ gem.email = ["cajun.code@gmail.com"]
11
+ gem.description = %q{C++ Project and File generators}
12
+ gem.summary = %q{C++ Development can be a pain. Project setup is dependent on the tools used in the project and the developer. This tool is a command line tool for generating project and files independent of any ide or editor.}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency "thor", "~> 0.17.0"
21
+ gem.add_dependency 'activesupport', "~> 3.2.11"
22
+ gem.add_dependency 'i18n',"~> 0.6.1"
23
+ gem.add_dependency "multi_json", "~> 1.5.0"
24
+ gem.add_development_dependency "pry"
25
+ end
@@ -0,0 +1,29 @@
1
+ require "erebus/version"
2
+ require "erebus/generator"
3
+ require "thor"
4
+ require "fileutils"
5
+ require 'active_support/core_ext'
6
+ module Erebus
7
+ # Your code goes here...
8
+ class App < Thor
9
+ def self.load_generators
10
+ lib_dir = File.absolute_path(File.join(File.dirname(__FILE__), "erebus", "generators"))
11
+ # puts "Lib Directory #{lib_dir}"
12
+ Dir.foreach(lib_dir) do |file|
13
+ # puts "Testing File: #{file}"
14
+ if File.file?("#{lib_dir}/#{file}")
15
+ base_name = File.basename(file, File.extname(file))
16
+ # puts "Loading generator: #{base_name}"
17
+ require File.join("erebus", "generators", base_name)
18
+ clazz = Object.const_get(base_name.camelize)
19
+ # puts clazz.desc
20
+ # subcommand base_name, clazz
21
+ #App.subcommand base_name, clazz
22
+ App.register(clazz, base_name, clazz.usuage, clazz.desc)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+
@@ -0,0 +1,31 @@
1
+ require "thor"
2
+
3
+ module Erebus
4
+ class Generator < Thor::Group
5
+ include Thor::Actions
6
+
7
+ def self.usuage
8
+ "#{self_task.formatted_usage(self, false)}"
9
+ end
10
+
11
+ protected
12
+ def date_time
13
+ DateTime.now.strftime("%m/%d/%Y %H:%M")
14
+ end
15
+ def user
16
+ ENV["USER"]
17
+ end
18
+ end
19
+
20
+ class NamedGenerator < Generator
21
+ argument :name
22
+
23
+ protected
24
+ def class_name
25
+ name.camelize
26
+ end
27
+ def file_name
28
+ name.underscore
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ require "erebus/generator"
2
+
3
+ class CppClass < Erebus::NamedGenerator
4
+ desc "Create a C/C++ Class"
5
+
6
+ #class_option :ext,:type => :string ,:default => "cpp", :desc => "Extention used for the source file"
7
+
8
+ def self.source_root
9
+ File.dirname(__FILE__)
10
+ end
11
+
12
+ def create_header_file
13
+ template "templates/class.h.erb", "include/#{file_name}.h"
14
+ end
15
+ def create_source_file
16
+ template "templates/class.cpp.erb", "src/#{file_name}.cpp"
17
+ end
18
+
19
+ private
20
+ # def ext
21
+ # options[:ext]
22
+ # end
23
+ end
@@ -0,0 +1,20 @@
1
+ require "erebus/generator"
2
+
3
+ class Header < Erebus::NamedGenerator
4
+ desc "Create a C/C++ header file"
5
+
6
+ class_option :ext,:type => :string ,:default => "h", :desc => "Extention used for the header"
7
+
8
+ def self.source_root
9
+ File.dirname(__FILE__)
10
+ end
11
+
12
+ def create_header_file
13
+ template "templates/blank.erb", "include/#{file_name}.#{ext}"
14
+ end
15
+
16
+ private
17
+ def ext
18
+ options[:ext]
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+ require "erebus/generator"
2
+
3
+ class Project < Erebus::NamedGenerator
4
+ desc "Create a C/C++ Project"
5
+
6
+ def self.source_root
7
+ File.dirname(__FILE__)
8
+ end
9
+
10
+ def create_rake_file
11
+ template "templates/rake.erb", "#{class_name}/Rakefile"
12
+ end
13
+ def create_git_ignore
14
+ template "templates/ignore.erb", "#{class_name}/.gitignore"
15
+ end
16
+ def create_include_dir
17
+ create_file "#{class_name}/include/.gitkeep"
18
+ end
19
+ def create_main_file
20
+ template "templates/main.cpp.erb", "#{class_name}/src/main.cpp"
21
+ end
22
+
23
+ end
24
+
@@ -0,0 +1,20 @@
1
+ require "erebus/generator"
2
+
3
+ class Source < Erebus::NamedGenerator
4
+ desc "Create a C/C++ Source file"
5
+
6
+ class_option :ext,:type => :string ,:default => "cpp", :desc => "Extention used for the source file"
7
+
8
+ def self.source_root
9
+ File.dirname(__FILE__)
10
+ end
11
+
12
+ def create_source_file
13
+ template "templates/blank.erb", "src/#{file_name}.#{ext}"
14
+ end
15
+
16
+ private
17
+ def ext
18
+ options[:ext]
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ /*
2
+ * <%= "#{file_name}.#{ext}" %>.
3
+ *
4
+ * Created on: <%= date_time%>
5
+ * Author: <%= user %>
6
+ */
@@ -0,0 +1,18 @@
1
+ /*
2
+ * <%= file_name%>.cpp
3
+ *
4
+ * Created on: <%= date_time%>
5
+ * Author: <%= user %>
6
+ */
7
+
8
+ #include "<%= file_name%>.h"
9
+
10
+ <%= class_name %>::<%= class_name %>() {
11
+ // TODO Auto-generated constructor stub
12
+
13
+ }
14
+
15
+ <%= class_name %>::~<%= class_name %>() {
16
+ // TODO Auto-generated destructor stub
17
+ }
18
+
@@ -0,0 +1,18 @@
1
+ /*
2
+ * <%= file_name%>.h
3
+ *
4
+ * Created on: <%= date_time%>
5
+ * Author: <%= user %>
6
+ */
7
+
8
+
9
+ #ifndef <%= file_name.upcase %>_H_
10
+ #define <%= file_name.upcase %>_H_
11
+
12
+ class <%= class_name %> {
13
+ public:
14
+ <%= class_name %>();
15
+ virtual ~<%= class_name %>();
16
+ };
17
+
18
+ #endif /* <%= file_name.upcase %>_H_ */
@@ -0,0 +1,3 @@
1
+ build
2
+ dist
3
+ *.o
@@ -0,0 +1,8 @@
1
+ #include <iostream>
2
+
3
+ // <%= class_name %>
4
+
5
+ int main(){
6
+ // Code goes here
7
+ return 0;
8
+ }
@@ -0,0 +1,35 @@
1
+ require "fileutils"
2
+
3
+ APP_NAME = "<%=class_name %>"
4
+ LIB_PATHS = []
5
+ LIBRARIES = []
6
+ FLAGS = []
7
+ CC = "g++"
8
+ HEADERS_DIR = "include"
9
+ SOURCE_DIR = "src"
10
+ PROJECT_DIR = File.absolute_path(File.dirname(__FILE__))
11
+ desc "Clean the Application"
12
+ task :clean do
13
+ FileUtils.rm_rf File.join(PROJECT_DIR, "build")
14
+ end
15
+
16
+ desc "Build the Application"
17
+ task :build do
18
+ FileUtils.mkdir File.join(PROJECT_DIR, "build") if !Dir.exist?(File.join(PROJECT_DIR, "build"))
19
+ flags = FLAGS.join(" ")
20
+ headers = "-I#{File.join(PROJECT_DIR, HEADERS_DIR)}"
21
+ lib_paths = LIB_PATHS.collect{|x| "-L#{x}"}.join(" ")
22
+ libs = LIBRARIES.collect{|x| "-l#{x}"}.join(" ")
23
+ source_path = File.join(PROJECT_DIR, SOURCE_DIR)
24
+ files = Dir.glob(File.join(SOURCE_DIR,"**", "*.{c,cpp}")).join(" ")
25
+ #puts files
26
+ output = "-o #{File.join(PROJECT_DIR, "build")}/#{APP_NAME}"
27
+ command = "#{CC} #{flags} #{headers} #{lib_paths} #{libs} #{files} #{output}"
28
+ puts command
29
+ system command
30
+ end
31
+
32
+ desc "Run the app"
33
+ task :run => [:clean, :build] do
34
+ system "#{File.join(PROJECT_DIR, "build")}/#{APP_NAME}"
35
+ end
@@ -0,0 +1,3 @@
1
+ module Erebus
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: erebus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Allan Davis
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.17.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.17.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: activesupport
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 3.2.11
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 3.2.11
46
+ - !ruby/object:Gem::Dependency
47
+ name: i18n
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 0.6.1
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.1
62
+ - !ruby/object:Gem::Dependency
63
+ name: multi_json
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.5.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.5.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: pry
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: C++ Project and File generators
95
+ email:
96
+ - cajun.code@gmail.com
97
+ executables:
98
+ - erebus
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - .gitignore
103
+ - .rvmrc
104
+ - Gemfile
105
+ - LICENSE.txt
106
+ - README.rst
107
+ - Rakefile
108
+ - bin/erebus
109
+ - erebus.gemspec
110
+ - lib/erebus.rb
111
+ - lib/erebus/generator.rb
112
+ - lib/erebus/generators/cpp_class.rb
113
+ - lib/erebus/generators/header.rb
114
+ - lib/erebus/generators/project.rb
115
+ - lib/erebus/generators/source.rb
116
+ - lib/erebus/generators/templates/blank.erb
117
+ - lib/erebus/generators/templates/class.cpp.erb
118
+ - lib/erebus/generators/templates/class.h.erb
119
+ - lib/erebus/generators/templates/ignore.erb
120
+ - lib/erebus/generators/templates/main.cpp.erb
121
+ - lib/erebus/generators/templates/rake.erb
122
+ - lib/erebus/version.rb
123
+ homepage: ''
124
+ licenses: []
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 1.8.24
144
+ signing_key:
145
+ specification_version: 3
146
+ summary: C++ Development can be a pain. Project setup is dependent on the tools used
147
+ in the project and the developer. This tool is a command line tool for generating
148
+ project and files independent of any ide or editor.
149
+ test_files: []