ceedling 0.9.2 → 0.9.4
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.
data/lib/ceedling/version.rb
CHANGED
data/lib/ceedling/version.rb.erb
CHANGED
@@ -55,36 +55,6 @@ class ModuleGenerator < Plugin
|
|
55
55
|
|
56
56
|
#endif // <%=@context[:name]%>_H
|
57
57
|
EOS
|
58
|
-
|
59
|
-
|
60
|
-
#---- New function templates
|
61
|
-
|
62
|
-
@func_test_template = (<<-EOS).left_margin
|
63
|
-
|
64
|
-
/* ------ <%=@declaration[:name]%> ------ */
|
65
|
-
|
66
|
-
void test_<%=@declaration[:name]%>_needs_to_be_implemented(void)
|
67
|
-
{
|
68
|
-
TEST_IGNORE();
|
69
|
-
}
|
70
|
-
|
71
|
-
EOS
|
72
|
-
|
73
|
-
|
74
|
-
@func_decl_template = (<<-EOS).left_margin
|
75
|
-
|
76
|
-
<%=@declaration[:returns]%> <%=@declaration[:name]%>(<%=@declaration[:arguments]%>);
|
77
|
-
|
78
|
-
EOS
|
79
|
-
|
80
|
-
@func_impl_template = (<<-EOS).left_margin
|
81
|
-
|
82
|
-
<%=@declaration[:returns]%> <%=@declaration[:name]%>(<%=@declaration[:arguments]%>)
|
83
|
-
{
|
84
|
-
return;
|
85
|
-
}
|
86
|
-
|
87
|
-
EOS
|
88
58
|
end
|
89
59
|
|
90
60
|
def create(path, optz={})
|
@@ -128,45 +98,8 @@ class ModuleGenerator < Plugin
|
|
128
98
|
|
129
99
|
end
|
130
100
|
|
131
|
-
def add_function(path, optz={})
|
132
|
-
extract_context(path, optz)
|
133
|
-
|
134
|
-
parse_function_declaration(optz[:declaration])
|
135
|
-
|
136
|
-
@files[0][:template] = @func_test_template
|
137
|
-
@files[1][:template] = @func_impl_template
|
138
|
-
@files[2][:template] = @func_decl_template
|
139
|
-
|
140
|
-
@files.each do |file|
|
141
|
-
if File.exist?(file[:path])
|
142
|
-
puts "Appending content to " + file[:path] + "..."
|
143
|
-
File.open(file[:path], 'a+') do |cur_file|
|
144
|
-
cur_file << ERB.new(file[:template], 0, "<>").result(binding)
|
145
|
-
end
|
146
|
-
else
|
147
|
-
raise "Error: #{file[:path]} could not be opened!"
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
@ceedling[:streaminator].stdout_puts "Done generating new function goods!"
|
152
|
-
end
|
153
|
-
|
154
101
|
private
|
155
102
|
|
156
|
-
def parse_function_declaration(declaration)
|
157
|
-
p declaration
|
158
|
-
tokens = declaration.match(/^\\?\"?\s*([\w\s]+)\s+(\w+)\s*\((.*)\)\s*\"?$/)
|
159
|
-
p tokens
|
160
|
-
@declaration = {
|
161
|
-
:returns => tokens[1],
|
162
|
-
:name => tokens[2],
|
163
|
-
:arguments => tokens[3]
|
164
|
-
}
|
165
|
-
p "-"*10
|
166
|
-
p @declaration
|
167
|
-
p "-"*10
|
168
|
-
end
|
169
|
-
|
170
103
|
def extract_context(path, optz={})
|
171
104
|
if (!defined?(MODULE_GENERATOR_PROJECT_ROOT) ||
|
172
105
|
!defined?(MODULE_GENERATOR_SOURCE_ROOT) ||
|
@@ -200,9 +133,9 @@ class ModuleGenerator < Plugin
|
|
200
133
|
# p @context
|
201
134
|
|
202
135
|
@files = [
|
203
|
-
{:path => File.join(
|
204
|
-
{:path => File.join(
|
205
|
-
{:path => File.join(
|
136
|
+
{:path => File.join(MODULE_GENERATOR_PROJECT_ROOT, @context[:paths][:test], location, @context[:testname])},
|
137
|
+
{:path => File.join(MODULE_GENERATOR_PROJECT_ROOT, @context[:paths][:src], location, @context[:sourcename])},
|
138
|
+
{:path => File.join(MODULE_GENERATOR_PROJECT_ROOT, @context[:paths][:src], location, @context[:headername])}
|
206
139
|
]
|
207
140
|
|
208
141
|
# p @files
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
217
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ceedling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 4
|
10
|
+
version: 0.9.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mike Karlesky, Mark VanderVoord
|