yesman 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/bin/yesman +47 -12
- data/lib/yesman/class_generator.rb +80 -0
- data/lib/yesman/class_type.rb +53 -0
- data/lib/yesman/config_proxy.rb +42 -0
- data/lib/yesman/cpp_creator.rb +4 -29
- data/lib/yesman/file_util.rb +12 -3
- data/lib/yesman/global_config.rb +42 -0
- data/lib/yesman/gtest_installer.rb +4 -7
- data/lib/yesman/templater.rb +22 -0
- data/lib/yesman/templates/class.cxx.erb +14 -0
- data/lib/yesman/templates/gtest_main.cxx.erb +6 -0
- data/lib/yesman/templates/header.cxx.erb +17 -0
- data/lib/yesman/templates/main.cxx.erb +6 -0
- data/lib/yesman/templates/test.cxx.erb +27 -0
- data/lib/yesman/version.rb +1 -1
- data/lib/yesman.rb +4 -0
- data/spec/class_type_spec.rb +58 -0
- data/spec/helper.rb +2 -0
- metadata +17 -3
data/README.md
CHANGED
@@ -26,7 +26,7 @@ There are several optional parameters you can use that will adjust the following
|
|
26
26
|
|
27
27
|
-o Output Directory Name (defaults to "bin")
|
28
28
|
|
29
|
-
-
|
29
|
+
-e C++ extension to use for generated files (defaults to "cpp")
|
30
30
|
|
31
31
|
## Requirements
|
32
32
|
|
data/bin/yesman
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
require 'yesman'
|
4
4
|
require 'yesman/cli_parser'
|
5
|
+
require 'yesman/config_proxy'
|
6
|
+
require 'yesman/global_config'
|
7
|
+
require 'yesman/class_type'
|
8
|
+
require 'yesman/templater'
|
5
9
|
|
6
|
-
options = {}
|
7
|
-
|
8
|
-
command = ARGV.shift
|
9
10
|
|
10
11
|
def new_project
|
11
12
|
project_name = ARGV.shift
|
@@ -13,11 +14,14 @@ def new_project
|
|
13
14
|
parser.run ARGV
|
14
15
|
parser.config[:project_name] = project_name
|
15
16
|
puts "Generating new project: #{parser.config[:project_name]}"
|
17
|
+
|
16
18
|
y = Yesman.new parser.config
|
17
19
|
end
|
18
20
|
|
19
21
|
def run_project
|
20
22
|
flag = ARGV.shift
|
23
|
+
#cp = ConfigProxy.new
|
24
|
+
#puts cp.params
|
21
25
|
if flag == '-d'
|
22
26
|
debug_project
|
23
27
|
else
|
@@ -33,17 +37,48 @@ def test_project
|
|
33
37
|
puts "test not yet supported"
|
34
38
|
end
|
35
39
|
|
40
|
+
def generate
|
41
|
+
c = ConfigProxy.new
|
42
|
+
if (c.config_exists?)
|
43
|
+
info = ARGV.shift
|
44
|
+
g = ClassGenerator.new
|
45
|
+
puts "Creating #{info}"
|
46
|
+
g.create_class_files info
|
47
|
+
else
|
48
|
+
puts "Da Da Dunn... you are not in a yesman project ABORTING..."
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def init
|
53
|
+
load_global_config
|
54
|
+
run_commands
|
55
|
+
end
|
56
|
+
|
57
|
+
def load_global_config
|
58
|
+
gc = GlobalConfig.new.load
|
59
|
+
end
|
36
60
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
when '
|
41
|
-
|
42
|
-
when '
|
43
|
-
|
44
|
-
|
45
|
-
|
61
|
+
def run_commands
|
62
|
+
command = ARGV.shift
|
63
|
+
case command
|
64
|
+
when 'new'
|
65
|
+
new_project
|
66
|
+
when 'run'
|
67
|
+
run_project
|
68
|
+
when 'test'
|
69
|
+
test_project
|
70
|
+
when 'generate'
|
71
|
+
generate
|
72
|
+
when 'g'
|
73
|
+
generate
|
74
|
+
else
|
75
|
+
puts "command: #{command} not recognized"
|
76
|
+
end
|
46
77
|
end
|
47
78
|
|
48
79
|
|
80
|
+
init
|
81
|
+
|
82
|
+
|
83
|
+
|
49
84
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'yesman/class_type'
|
2
|
+
require 'yesman/templater'
|
3
|
+
require 'yesman/file_util'
|
4
|
+
require 'yesman/config_proxy'
|
5
|
+
|
6
|
+
class ClassGenerator
|
7
|
+
|
8
|
+
attr_reader :templates_path
|
9
|
+
attr_reader :header_path
|
10
|
+
attr_reader :class_path
|
11
|
+
attr_reader :test_path
|
12
|
+
attr_reader :main_path
|
13
|
+
attr_reader :gtest_main_path
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@templates_path = "#{Dir.home}/.yesman/templates/"
|
17
|
+
@header_path = create_path "header.cxx.erb"
|
18
|
+
@class_path = create_path "class.cxx.erb"
|
19
|
+
@test_path = create_path "test.cxx.erb"
|
20
|
+
@main_path = create_path "main.cxx.erb"
|
21
|
+
@gtest_main_path = create_path "gtest_main.cxx.erb"
|
22
|
+
|
23
|
+
@templater = Templater.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_class_files input
|
27
|
+
c = create_class_type input
|
28
|
+
files = [header_path, class_path, test_path]
|
29
|
+
files.each do |path|
|
30
|
+
file_contents = @templater.merge c, path
|
31
|
+
FileUtil.write_to_file create_file_name( c, path ), file_contents
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_main
|
37
|
+
c = create_class_type "Main"
|
38
|
+
output_file_path = "#{params[:source]}/#{params[:project_name]}.#{params[:extension]}"
|
39
|
+
FileUtil.write_to_file( output_file_path, ( @templater.merge c, main_path) )
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_gtest_main
|
43
|
+
c = create_class_type "GTestMain"
|
44
|
+
file_contents = @templater.merge c, gtest_main_path
|
45
|
+
FileUtil.write_to_file "#{params[:tests]}/#{params[:project_name]}Tests.#{params[:extension]}", file_contents
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
|
51
|
+
def create_file_name class_type, path
|
52
|
+
file_name = ""
|
53
|
+
case path
|
54
|
+
when header_path
|
55
|
+
file_name << "#{params[:source]}/" << class_type.class_name << ".h"
|
56
|
+
when class_path
|
57
|
+
file_name << "#{params[:source]}/" << class_type.class_name << ".#{params[:extension]}"
|
58
|
+
when test_path
|
59
|
+
file_name << "#{params[:tests]}/" << class_type.class_name << "Test.#{params[:extension]}"
|
60
|
+
else
|
61
|
+
file_name << "undefined"
|
62
|
+
end
|
63
|
+
file_name
|
64
|
+
end
|
65
|
+
|
66
|
+
def create_class_type input
|
67
|
+
c = ClassType.new
|
68
|
+
c.parse_from_string input
|
69
|
+
c
|
70
|
+
end
|
71
|
+
|
72
|
+
def create_path filename
|
73
|
+
"#{templates_path}#{filename}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def params
|
77
|
+
cp = ConfigProxy.new
|
78
|
+
cp.params
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'yesman/config_proxy'
|
3
|
+
|
4
|
+
class ClassType
|
5
|
+
attr_reader :class_name
|
6
|
+
attr_reader :namespace
|
7
|
+
attr_reader :super_class
|
8
|
+
attr_reader :source
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@class_name = nil
|
12
|
+
@namespace = nil
|
13
|
+
@super_class = nil
|
14
|
+
@source = ConfigProxy.new.params[:source]
|
15
|
+
end
|
16
|
+
|
17
|
+
def parse_from_string input
|
18
|
+
input = input.to_s
|
19
|
+
st = input.split("<")
|
20
|
+
st.each {|s| s.strip!}
|
21
|
+
|
22
|
+
create_name_namespace st[0]
|
23
|
+
|
24
|
+
if st[1] || st[1] != ""
|
25
|
+
create_super st[1]
|
26
|
+
else
|
27
|
+
@super_class = nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_binding
|
32
|
+
binding
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def create_name_namespace input
|
38
|
+
if input.index( "::" )
|
39
|
+
@namespace, @class_name = input.split "::"
|
40
|
+
else
|
41
|
+
@class_name = input
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_super input
|
46
|
+
@super_class = nil
|
47
|
+
if input
|
48
|
+
@super_class = ClassType.new
|
49
|
+
@super_class.parse_from_string input
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class ConfigProxy
|
4
|
+
|
5
|
+
attr_reader :params
|
6
|
+
attr_reader :config_path
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@params = nil
|
10
|
+
@config_path = ".yesman/config"
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_config params
|
14
|
+
verify_config_exists
|
15
|
+
File.open( config_path, "w" ) do |file|
|
16
|
+
file.write params.to_yaml
|
17
|
+
end
|
18
|
+
@params = params;
|
19
|
+
end
|
20
|
+
|
21
|
+
def load_config
|
22
|
+
verify_config_exists
|
23
|
+
@params = YAML::load_file config_path
|
24
|
+
end
|
25
|
+
|
26
|
+
def params
|
27
|
+
if @params == nil
|
28
|
+
load_config
|
29
|
+
end
|
30
|
+
@params
|
31
|
+
end
|
32
|
+
|
33
|
+
def config_exists?
|
34
|
+
return File.exists? config_path
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
def verify_config_exists
|
39
|
+
FileUtil.ensure_file config_path
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
data/lib/yesman/cpp_creator.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yesman/file_util'
|
2
|
+
require 'yesman/class_generator'
|
2
3
|
|
3
4
|
class CppCreator
|
4
5
|
attr_reader :source
|
@@ -9,6 +10,7 @@ class CppCreator
|
|
9
10
|
|
10
11
|
def initialize(params = {})
|
11
12
|
set_defaults params
|
13
|
+
@gen = ClassGenerator.new
|
12
14
|
end
|
13
15
|
|
14
16
|
def create_project
|
@@ -34,37 +36,10 @@ private
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def create_source_main
|
37
|
-
|
38
|
-
FileUtil.ensure_file filename
|
39
|
-
FileUtil.write_to_file filename, get_source_main
|
39
|
+
@gen.create_main
|
40
40
|
end
|
41
41
|
|
42
42
|
def create_test_main
|
43
|
-
|
44
|
-
FileUtil.ensure_file filename
|
45
|
-
FileUtil.write_to_file filename, get_test_main
|
46
|
-
end
|
47
|
-
|
48
|
-
def get_test_main
|
49
|
-
main = <<END
|
50
|
-
#include "gtest/gtest.h"
|
51
|
-
|
52
|
-
GTEST_API_ int main(int argc, char **argv) {
|
53
|
-
testing::InitGoogleTest(&argc, argv);
|
54
|
-
return RUN_ALL_TESTS();
|
55
|
-
}
|
56
|
-
END
|
57
|
-
end
|
58
|
-
|
59
|
-
def get_source_main
|
60
|
-
main = <<END
|
61
|
-
#include <iostream>
|
62
|
-
|
63
|
-
int main() {
|
64
|
-
std::cout << "What up world!" << std::endl;
|
65
|
-
return 0;
|
66
|
-
}
|
67
|
-
|
68
|
-
END
|
43
|
+
@gen.create_gtest_main
|
69
44
|
end
|
70
45
|
end
|
data/lib/yesman/file_util.rb
CHANGED
@@ -30,16 +30,19 @@ class FileUtil
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def self.write_to_file filename, contents
|
33
|
+
self.ensure_file filename
|
33
34
|
File.open( filename, "w" ) { |f| f.write( contents ) }
|
34
35
|
end
|
35
36
|
private
|
36
37
|
|
37
38
|
def self.create_directories dirs
|
38
39
|
next_path = ""
|
40
|
+
exists = false
|
39
41
|
dirs.each do |dirname|
|
40
42
|
next_path << dirname << "/"
|
41
|
-
self.verify_or_make_dir next_path
|
43
|
+
exists = self.verify_or_make_dir next_path
|
42
44
|
end
|
45
|
+
exists
|
43
46
|
end
|
44
47
|
|
45
48
|
def self.determine_path path
|
@@ -48,11 +51,17 @@ private
|
|
48
51
|
end
|
49
52
|
|
50
53
|
def self.verify_or_make_dir dirname
|
51
|
-
|
54
|
+
pre_existing = (File.exists? dirname) && (File.directory? dirname)
|
55
|
+
`mkdir #{dirname}` unless pre_existing
|
56
|
+
pre_existing
|
52
57
|
end
|
53
58
|
|
54
59
|
def self.verify_or_make_file filename
|
55
|
-
|
60
|
+
pre_existing = (File.exists? filename)
|
61
|
+
unless pre_existing
|
62
|
+
`touch #{filename}`
|
63
|
+
end
|
64
|
+
pre_existing
|
56
65
|
end
|
57
66
|
|
58
67
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class GlobalConfig
|
2
|
+
attr_reader :pre_existing
|
3
|
+
attr_reader :global_config_path
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@pre_existing = false
|
7
|
+
@global_config_path = "#{Dir.home}/.yesman"
|
8
|
+
end
|
9
|
+
|
10
|
+
def load
|
11
|
+
ensure_config_dir
|
12
|
+
|
13
|
+
if !pre_existing
|
14
|
+
puts "Copying file templates to #{global_config_path}"
|
15
|
+
copy_templates
|
16
|
+
create_global_config
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def copy_templates
|
23
|
+
FileUtil.ensure_path "#{global_config_path}/templates"
|
24
|
+
templates = File.join(File.dirname(File.expand_path(__FILE__)), 'templates');
|
25
|
+
FileUtil.recursive_copy(templates, global_config_path)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_global_config
|
29
|
+
params = {};
|
30
|
+
params[:source] = "src"
|
31
|
+
params[:output] = "bin"
|
32
|
+
params[:tests] = "tests"
|
33
|
+
params[:ext] = "cpp"
|
34
|
+
#TODO Write these to a config file in global_config_path
|
35
|
+
#I'm not sold that you need them at this point
|
36
|
+
end
|
37
|
+
|
38
|
+
def ensure_config_dir
|
39
|
+
@pre_existing = FileUtil.ensure_path global_config_path
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -6,8 +6,7 @@ class GTestInstaller
|
|
6
6
|
attr_reader :gtest_dir
|
7
7
|
attr_reader :gtest_path
|
8
8
|
attr_reader :attr_names
|
9
|
-
attr_reader :params
|
10
|
-
|
9
|
+
attr_reader :params
|
11
10
|
def initialize options
|
12
11
|
@params = options
|
13
12
|
@gtest_dir = "gtest"
|
@@ -29,13 +28,11 @@ class GTestInstaller
|
|
29
28
|
private
|
30
29
|
|
31
30
|
def print_start
|
32
|
-
puts "
|
33
|
-
puts "** Google Test Setup **"
|
34
|
-
puts "********************************"
|
31
|
+
puts "Google Test Setup"
|
35
32
|
end
|
36
33
|
|
37
34
|
def pull_source
|
38
|
-
puts "checkout
|
35
|
+
puts "svn checkout of GTest source code..."
|
39
36
|
`svn checkout #{gtest_path} #{repo_path}`
|
40
37
|
end
|
41
38
|
|
@@ -45,7 +42,6 @@ private
|
|
45
42
|
end
|
46
43
|
|
47
44
|
def create_static_lib
|
48
|
-
puts "creating GTest static lib: 'libgtest.a'"
|
49
45
|
`ar -rv #{params[:tests]}/gtest/libgtest.a #{params[:tests]}/gtest/gtest-all.o`
|
50
46
|
end
|
51
47
|
|
@@ -65,6 +61,7 @@ private
|
|
65
61
|
FileUtil.kill_directory gtest_dir
|
66
62
|
FileUtil.kill_file "#{params[:tests]}/gtest/gtest-all.o"
|
67
63
|
FileUtil.kill_directory "#{params[:tests]}/gtest/include/gtest/.svn"
|
64
|
+
FileUtil.kill_directory "#{params[:tests]}/gtest/include/gtest/internal/.svn"
|
68
65
|
end
|
69
66
|
|
70
67
|
def repo_path
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
class Templater
|
4
|
+
|
5
|
+
def merge class_type, template_path
|
6
|
+
@class_type = class_type
|
7
|
+
@template_path = template_path
|
8
|
+
|
9
|
+
load_template
|
10
|
+
apply_class_to_template
|
11
|
+
@output
|
12
|
+
end
|
13
|
+
|
14
|
+
def load_template
|
15
|
+
@loaded_template = ERB.new File.read( @template_path )
|
16
|
+
end
|
17
|
+
|
18
|
+
def apply_class_to_template
|
19
|
+
@output = @loaded_template.result( @class_type.get_binding )
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#include "<%=class_name%>.h"
|
2
|
+
<% if namespace %>
|
3
|
+
namespace <%=namespace%> {
|
4
|
+
<%end%>
|
5
|
+
<%=class_name%>::<%=class_name%>() {
|
6
|
+
// TODO Auto-generated constructor stub
|
7
|
+
}
|
8
|
+
|
9
|
+
<%=class_name%>::~<%=class_name%>() {
|
10
|
+
// TODO Auto-generated destructor stub
|
11
|
+
}
|
12
|
+
<% if namespace %>
|
13
|
+
} /* namespace <%=namespace%> */
|
14
|
+
<%end%>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#ifndef <%=@class_name.upcase%>_H_
|
2
|
+
#define <%=@class_name.upcase%>_H_
|
3
|
+
<% if @super_class%>#include "<%=@super_class.class_name%>.h"<%end%>
|
4
|
+
<% if @namespace %>
|
5
|
+
namespace <%=@namespace%> {
|
6
|
+
<%end%>
|
7
|
+
class <%=@class_name%><%if @super_class%>: public <%if @super_class.namespace%><%=@super_class.namespace%>::<%end%><%=@super_class.class_name%><%end%> {
|
8
|
+
public:
|
9
|
+
<%=@class_name%>();
|
10
|
+
virtual ~<%=@class_name%>();
|
11
|
+
|
12
|
+
|
13
|
+
};
|
14
|
+
<% if @namespace %>
|
15
|
+
} /* namespace <%=@namespace%> */
|
16
|
+
<%end%>
|
17
|
+
#endif /* <%=@class_name.upcase%>_H_ */
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#include "gtest/gtest.h"
|
2
|
+
#include "../<%=source%>/<%=@class_name%>.h"
|
3
|
+
|
4
|
+
<%if @namespace%>using namespace <%=@namespace%>;<%end%>
|
5
|
+
|
6
|
+
class <%=class_name%>Test : public testing::Test {
|
7
|
+
protected:
|
8
|
+
|
9
|
+
virtual void SetUp() {
|
10
|
+
// Called before each test, dump if not necessary
|
11
|
+
}
|
12
|
+
|
13
|
+
virtual void TearDown() {
|
14
|
+
// Called after each test is run, dump if not necesary
|
15
|
+
}
|
16
|
+
|
17
|
+
// Declare any needed helper methods
|
18
|
+
|
19
|
+
|
20
|
+
// Declare variables your tests want to use
|
21
|
+
|
22
|
+
|
23
|
+
};
|
24
|
+
|
25
|
+
TEST_F(<%=class_name%>Test, Method) {
|
26
|
+
EXPECT_EQ( 1, 1 );
|
27
|
+
}
|
data/lib/yesman/version.rb
CHANGED
data/lib/yesman.rb
CHANGED
@@ -7,6 +7,7 @@ class Yesman
|
|
7
7
|
|
8
8
|
def initialize options = {}
|
9
9
|
create_defaults options
|
10
|
+
@cp = ConfigProxy.new
|
10
11
|
init
|
11
12
|
end
|
12
13
|
|
@@ -26,11 +27,14 @@ class Yesman
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def create_all
|
30
|
+
@cp.create_config params
|
29
31
|
p = CppCreator.new params
|
30
32
|
p.create_project
|
33
|
+
puts "Project directories created"
|
31
34
|
|
32
35
|
g = GTestInstaller.new params
|
33
36
|
g.download_and_install
|
37
|
+
|
34
38
|
end
|
35
39
|
|
36
40
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
def create_class string
|
4
|
+
ex = ClassType.new
|
5
|
+
ex.parse_from_string string
|
6
|
+
ex
|
7
|
+
end
|
8
|
+
describe ClassType do
|
9
|
+
|
10
|
+
it "handles namespaced inheritance for both itself and parent" do
|
11
|
+
ct = ClassType.new
|
12
|
+
ct.parse_from_string "jsk::Testing < std::Parent"
|
13
|
+
ct.class_name.should eql "Testing"
|
14
|
+
ct.namespace.should eql "jsk"
|
15
|
+
ct.super_class.class_name.should eq "Parent"
|
16
|
+
ct.super_class.namespace.should eq "std"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should handle namespaced non inheritance" do
|
20
|
+
ct = create_class "jsk::Testing"
|
21
|
+
ct.class_name.should eq "Testing"
|
22
|
+
ct.namespace.should eq "jsk"
|
23
|
+
ct.super_class.should eq nil
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should handle single class name with ns inheritance" do
|
27
|
+
cb = create_class "SingleTesting < jsk::Parent"
|
28
|
+
cb.class_name.should eq "SingleTesting"
|
29
|
+
cb.namespace.should eq nil
|
30
|
+
cb.super_class.namespace.should eq "jsk"
|
31
|
+
cb.super_class.class_name.should eq "Parent"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should handle non-ns for both self and super" do
|
35
|
+
cx = create_class "SingleTest < ParentTest"
|
36
|
+
cx.class_name.should eq "SingleTest"
|
37
|
+
cx.namespace.should eq nil
|
38
|
+
cx.super_class.namespace.should eq nil
|
39
|
+
cx.super_class.class_name.should eq "ParentTest"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should handle non-ns inherited" do
|
43
|
+
cj = create_class "jsk::BaseClass < Map"
|
44
|
+
cj.class_name.should eq "BaseClass"
|
45
|
+
cj.namespace.should eq "jsk"
|
46
|
+
cj.super_class.class_name.should eq "Map"
|
47
|
+
cj.super_class.namespace.should eq nil
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should handle non inheritance, non ns" do
|
51
|
+
cp = create_class "FooBar"
|
52
|
+
cp.class_name.should eq "FooBar"
|
53
|
+
cp.namespace.should eq nil
|
54
|
+
cp.super_class.should eq nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
data/spec/helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yesman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
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: 2012-11-
|
12
|
+
date: 2012-11-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mixlib-cli
|
@@ -42,11 +42,23 @@ files:
|
|
42
42
|
- Rakefile
|
43
43
|
- bin/yesman
|
44
44
|
- lib/yesman.rb
|
45
|
+
- lib/yesman/class_generator.rb
|
46
|
+
- lib/yesman/class_type.rb
|
45
47
|
- lib/yesman/cli_parser.rb
|
48
|
+
- lib/yesman/config_proxy.rb
|
46
49
|
- lib/yesman/cpp_creator.rb
|
47
50
|
- lib/yesman/file_util.rb
|
51
|
+
- lib/yesman/global_config.rb
|
48
52
|
- lib/yesman/gtest_installer.rb
|
53
|
+
- lib/yesman/templater.rb
|
54
|
+
- lib/yesman/templates/class.cxx.erb
|
55
|
+
- lib/yesman/templates/gtest_main.cxx.erb
|
56
|
+
- lib/yesman/templates/header.cxx.erb
|
57
|
+
- lib/yesman/templates/main.cxx.erb
|
58
|
+
- lib/yesman/templates/test.cxx.erb
|
49
59
|
- lib/yesman/version.rb
|
60
|
+
- spec/class_type_spec.rb
|
61
|
+
- spec/helper.rb
|
50
62
|
- yesman.gemspec
|
51
63
|
homepage: ''
|
52
64
|
licenses: []
|
@@ -73,4 +85,6 @@ signing_key:
|
|
73
85
|
specification_version: 3
|
74
86
|
summary: Yesman creates project directory structures, downloads and builds GTest for
|
75
87
|
C++ development projects
|
76
|
-
test_files:
|
88
|
+
test_files:
|
89
|
+
- spec/class_type_spec.rb
|
90
|
+
- spec/helper.rb
|