roject 1.0.1 → 1.0.2
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.
- checksums.yaml +4 -4
- data/exp/project/_templates/main.general +22 -0
- data/exp/project/_templates/makefile.general +55 -0
- data/exp/project/output/main.cpp +22 -0
- data/exp/project/output/testheader.h +3 -3
- data/exp/project/output/testsource.cpp +4 -4
- data/lib/project.rb +1 -1
- data/lib/roject.rb +1 -1
- data/spec/project_spec.rb +228 -233
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08bd9ebfc4cf93c5b28cbef2ec86690f62589d92
|
4
|
+
data.tar.gz: f87d74bc4a8fae6c85103bf5d859ac58790d5d33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffdcacbc7fe089cbd09a4b1a23eefdfa1f29a2f8b9db770d04e10e99504fc4c4052dbf1522f3bf6264b8f97c0e73ed373ce3c96a8561d66f1f85f7ebe435d3c8
|
7
|
+
data.tar.gz: 15fd4b18682878fd2ef4d54e6ea745611938ff48962f5dd032d81e8d7c1e3067aa025cde6b8e9f25bcd2934f6cb09035c7b1161ede9072f41f077f0250f9d342
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// Include libraries
|
2
|
+
#include <iostream>
|
3
|
+
|
4
|
+
// Namespaces
|
5
|
+
using namespace std;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* The main function of the program
|
9
|
+
*
|
10
|
+
* @at;param argc the number of command line arguments
|
11
|
+
* @at;param argv the array of command line arguments
|
12
|
+
*
|
13
|
+
* @at;return exit status
|
14
|
+
*/
|
15
|
+
int main(int argc, const char **argv)
|
16
|
+
{
|
17
|
+
// Code
|
18
|
+
cout << "Hello World!" << endl;
|
19
|
+
|
20
|
+
// System Exit
|
21
|
+
return 0;
|
22
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -------------------------------- CONFIG --------------------------------
|
2
|
+
|
3
|
+
TARGET = @(project_name -> lowercase)
|
4
|
+
|
5
|
+
SHELL = /bin/bash -O globstar
|
6
|
+
CC = g++
|
7
|
+
|
8
|
+
COMPILE = $(CC) -c
|
9
|
+
LINK = $(CC)
|
10
|
+
|
11
|
+
CFLAGS = -Wall -std=c++14
|
12
|
+
LFLAGS = -Wall
|
13
|
+
INCLUD = -Iinclude
|
14
|
+
LIBRAR = -Llib
|
15
|
+
|
16
|
+
# -------------------------------- FOLDER --------------------------------
|
17
|
+
|
18
|
+
INCDIR = include
|
19
|
+
SRCDIR = src
|
20
|
+
OBJDIR = obj
|
21
|
+
BINDIR = bin
|
22
|
+
INSDIR = /usr/bin
|
23
|
+
|
24
|
+
# -------------------------------- FILES --------------------------------
|
25
|
+
|
26
|
+
INCLUDS = $(shell ls $(INCDIR)/**/*.h)
|
27
|
+
SOURCES = $(shell ls $(SRCDIR)/**/*.cpp)
|
28
|
+
OBJECTS = $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SOURCES))
|
29
|
+
BINARY = $(BINDIR)/$(TARGET)
|
30
|
+
|
31
|
+
# -------------------------------- TASKS --------------------------------
|
32
|
+
|
33
|
+
$(BINARY): $(OBJECTS)
|
34
|
+
@at;echo $(SOURCES)
|
35
|
+
@at;test -d $(@at;D) || mkdir $(@at;D)
|
36
|
+
@at;echo building $@at;
|
37
|
+
@at;$(LINK) $^ -o $@at; $(LFLAGS) $(LIBRAR)
|
38
|
+
|
39
|
+
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp $(INCLUDS)
|
40
|
+
@at;test -d $(@at;D) || mkdir $(@at;D)
|
41
|
+
@at;echo compiling $<
|
42
|
+
@at;$(COMPILE) $< -o $@at; $(CPPFLAGS) $(INCLUD)
|
43
|
+
|
44
|
+
clean:
|
45
|
+
@at;echo Cleaning up...
|
46
|
+
@at;rm -r $(OBJDIR) $(BINDIR)
|
47
|
+
|
48
|
+
install:
|
49
|
+
cp $(BINDIR)/$(TARGET) $(INSDIR)
|
50
|
+
|
51
|
+
uninstall:
|
52
|
+
rm $(INSDIR)/$(TARGET)
|
53
|
+
|
54
|
+
run:
|
55
|
+
$(BINARY)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// Include libraries
|
2
|
+
#include <iostream>
|
3
|
+
|
4
|
+
// Namespaces
|
5
|
+
using namespace std;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* The main function of the program
|
9
|
+
*
|
10
|
+
* @param argc the number of command line arguments
|
11
|
+
* @param argv the array of command line arguments
|
12
|
+
*
|
13
|
+
* @return exit status
|
14
|
+
*/
|
15
|
+
int main(int argc, const char **argv)
|
16
|
+
{
|
17
|
+
// Code
|
18
|
+
cout << "Hello World!" << endl;
|
19
|
+
|
20
|
+
// System Exit
|
21
|
+
return 0;
|
22
|
+
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
/*
|
2
2
|
|
3
|
-
Program:
|
3
|
+
Program: Foo
|
4
4
|
|
5
|
-
|
5
|
+
Foo bar baz joo jar jaz noo kar kaz
|
6
6
|
|
7
7
|
Author: Anshul Kharbanda
|
8
|
-
Created: 7 -
|
8
|
+
Created: 7 - 24 - 2016
|
9
9
|
|
10
10
|
*/
|
11
11
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
/*
|
2
2
|
|
3
|
-
Program:
|
3
|
+
Program: Foo
|
4
4
|
|
5
|
-
|
5
|
+
Foo bar baz joo jar jaz noo kar kaz
|
6
6
|
|
7
7
|
Author: Anshul Kharbanda
|
8
|
-
Created: 7 -
|
8
|
+
Created: 7 - 24 - 2016
|
9
9
|
|
10
10
|
*/
|
11
11
|
|
12
|
-
#include "
|
12
|
+
#include "Foo/path/to/file.h"
|
13
13
|
|
14
14
|
// Code
|
data/lib/project.rb
CHANGED
data/lib/roject.rb
CHANGED
data/spec/project_spec.rb
CHANGED
@@ -36,281 +36,276 @@ describe Roject::Project do
|
|
36
36
|
short_description: "Foo bar",
|
37
37
|
long_description: "Foo bar baz joo jar jaz noo kar kaz"
|
38
38
|
})
|
39
|
+
|
40
|
+
# Project info
|
41
|
+
@path = "path/to/file"
|
42
|
+
@config = @foocfg
|
43
|
+
|
44
|
+
# ----------------------FILE MAKERS----------------------
|
45
|
+
|
46
|
+
@header = {
|
47
|
+
name: :header,
|
48
|
+
path: "include/@(project_name)/@(path)",
|
49
|
+
template: "header.general",
|
50
|
+
extension: "h",
|
51
|
+
out: "include/#{@config[:project_name]}/#{@path}.h",
|
52
|
+
text: IO.read("output/testheader.h")
|
53
|
+
}
|
54
|
+
|
55
|
+
@source = {
|
56
|
+
name: :source,
|
57
|
+
path: "src/@(path)",
|
58
|
+
template: "source.general",
|
59
|
+
extension: "cpp",
|
60
|
+
out: "src/#{@path}.cpp",
|
61
|
+
text: IO.read("output/testsource.cpp")
|
62
|
+
}
|
63
|
+
|
64
|
+
@makefile = {
|
65
|
+
name: :makefile,
|
66
|
+
path: "Makefile",
|
67
|
+
template: "makefile.general",
|
68
|
+
extension: nil,
|
69
|
+
out: "Makefile",
|
70
|
+
text: IO.read("output/Makefile")
|
71
|
+
}
|
72
|
+
|
73
|
+
@main = {
|
74
|
+
name: :main,
|
75
|
+
path: "src/main",
|
76
|
+
template: "main.general",
|
77
|
+
extension: "cpp",
|
78
|
+
out: "src/main.cpp",
|
79
|
+
text: IO.read("output/main.cpp")
|
80
|
+
}
|
81
|
+
|
82
|
+
# ----------------------TASK MAKERS----------------------
|
83
|
+
|
84
|
+
@module = {
|
85
|
+
name: :module,
|
86
|
+
block: Proc.new do |args|
|
87
|
+
args[:header_id] = c_header_id(args[:path])
|
88
|
+
make :header, args
|
89
|
+
make :source, args
|
90
|
+
end
|
91
|
+
}
|
92
|
+
|
93
|
+
@init = {
|
94
|
+
name: :init,
|
95
|
+
block: Proc.new do |args|
|
96
|
+
make :makefile
|
97
|
+
make :main
|
98
|
+
end
|
99
|
+
}
|
39
100
|
end
|
40
101
|
|
41
|
-
# Describe Roject::Project
|
102
|
+
# Describe Roject::Project::exist?
|
42
103
|
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
104
|
+
# Check if a project file exists in the current directory
|
105
|
+
#
|
106
|
+
# Parameter: filename - the filename to check
|
107
|
+
# (defaults to the default filename)
|
47
108
|
#
|
48
|
-
#
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
109
|
+
# Returns: true if the project file exists in the current
|
110
|
+
# directory
|
111
|
+
describe '::exist?' do
|
112
|
+
it 'checks if the given project filename exists in the current directory' do
|
113
|
+
expect(Roject::Project).to be_exist(@foofle)
|
54
114
|
end
|
55
115
|
|
56
|
-
|
57
|
-
|
58
|
-
expect{@project.config(@foocfg)}.not_to raise_error
|
59
|
-
expect(@project.config).to eql @foocfg
|
60
|
-
end
|
116
|
+
it 'checks the default project filename if no filename is given' do
|
117
|
+
expect(Roject::Project).to be_exist
|
61
118
|
end
|
62
119
|
end
|
63
120
|
|
64
|
-
# Describe Roject::Project
|
121
|
+
# Describe Roject::Project::load
|
65
122
|
#
|
66
|
-
#
|
123
|
+
# Loads a Project from the project file with the given filename
|
124
|
+
#
|
125
|
+
# Parameter: filename - the name of the file to parse
|
67
126
|
#
|
68
|
-
#
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
#
|
78
|
-
# Returns: true if the project file exists in the current
|
79
|
-
# directory
|
80
|
-
describe '::exist?' do
|
81
|
-
context 'with a filename given' do
|
82
|
-
it 'checks if the given project filename exists in the current directory' do
|
83
|
-
expect(Roject::Project).to be_exist(@foofle)
|
84
|
-
end
|
85
|
-
end
|
127
|
+
# Return: Project loaded from the file
|
128
|
+
describe '::load' do
|
129
|
+
# Check when filename is given
|
130
|
+
it 'loads a project from the given filename' do
|
131
|
+
# Test loading foobar.rb file
|
132
|
+
expect{@project = Roject::Project.load(@foofle)}.not_to raise_error
|
133
|
+
expect(@project).to be_an_instance_of Roject::Project
|
134
|
+
expect(@project.config).to eql @foocfg
|
135
|
+
end
|
86
136
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
137
|
+
# Check when filename is not given
|
138
|
+
it 'loads a project from the default filename (if no filename is given)' do
|
139
|
+
# Test loading default file
|
140
|
+
expect{@project = Roject::Project.load}.not_to raise_error
|
141
|
+
expect(@project).to be_an_instance_of Roject::Project
|
92
142
|
end
|
93
143
|
|
94
|
-
#
|
95
|
-
|
96
|
-
|
97
|
-
#
|
98
|
-
# Parameter: filename - the name of the file to parse
|
99
|
-
#
|
100
|
-
# Return: Project loaded from the file
|
101
|
-
describe '::load' do
|
102
|
-
# Check when filename is given
|
103
|
-
context 'with a filename given' do
|
104
|
-
it 'loads a project from the given filename' do
|
105
|
-
# Test loading foobar.rb file
|
106
|
-
expect{@project = Roject::Project.load(@foofle)}.not_to raise_error
|
107
|
-
expect(@project).to be_an_instance_of Roject::Project
|
108
|
-
expect(@project.config).to eql @foocfg
|
109
|
-
end
|
110
|
-
end
|
144
|
+
# Delete makers
|
145
|
+
after :all do @project.instance_variable_set :@makers, {} end
|
146
|
+
end
|
111
147
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
148
|
+
# Describe Roject::Project::open
|
149
|
+
#
|
150
|
+
# Alias for load if no block is given. Evaluates the given
|
151
|
+
# block in the context of the project if block is given
|
152
|
+
#
|
153
|
+
# Parameter: filename - the name of the file to parse
|
154
|
+
# (defaults to the default filename)
|
155
|
+
# Parameter: block - the block to evaluate within the
|
156
|
+
# context of the project
|
157
|
+
#
|
158
|
+
# Return: Project loaded from the file
|
159
|
+
describe '::open' do
|
160
|
+
# Check for when no block is given
|
161
|
+
it 'loads the project and returns it with no block given' do
|
162
|
+
expect { @project = Roject::Project.open }.not_to raise_error
|
163
|
+
expect(@project).to be_an_instance_of Roject::Project
|
120
164
|
end
|
121
165
|
|
122
|
-
#
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
# Parameter: filename - the name of the file to parse
|
128
|
-
# (defaults to the default filename)
|
129
|
-
# Parameter: block - the block to evaluate within the
|
130
|
-
# context of the project
|
131
|
-
#
|
132
|
-
# Return: Project loaded from the file
|
133
|
-
describe '::open' do
|
134
|
-
# Check for when block is given
|
135
|
-
context 'with a block given' do
|
136
|
-
it 'loads the project and evaluates it within the given block' do
|
137
|
-
project = nil
|
138
|
-
expect { Roject::Project.open { project = self } }.not_to raise_error
|
139
|
-
expect(project).to be_an_instance_of Roject::Project
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
# Check for when no block is given
|
144
|
-
context 'with no block given' do
|
145
|
-
it 'loads the project' do
|
146
|
-
expect { @project = Roject::Project.open }.not_to raise_error
|
147
|
-
expect(@project).to be_an_instance_of Roject::Project
|
148
|
-
end
|
149
|
-
end
|
166
|
+
# Check for when block is given
|
167
|
+
it 'loads the project and evaluates in the context of the project (if block given)' do
|
168
|
+
project = nil
|
169
|
+
expect { Roject::Project.open { project = self } }.not_to raise_error
|
170
|
+
expect(project).to be_an_instance_of Roject::Project
|
150
171
|
end
|
151
172
|
|
152
|
-
#
|
153
|
-
|
154
|
-
|
155
|
-
#
|
156
|
-
# Parameter: filename - the name of the file to parse
|
157
|
-
# (defaults to the default filename)
|
158
|
-
describe '#reload' do
|
159
|
-
context 'with a filename given' do
|
160
|
-
it 'loads the given filename into the project' do
|
161
|
-
# Test loading foobar.rb file
|
162
|
-
expect{@project.reload("foobar.rb")}.not_to raise_error
|
163
|
-
expect(@project).to be_an_instance_of Roject::Project
|
164
|
-
expect(@project.config).to eql @foocfg
|
165
|
-
end
|
166
|
-
end
|
173
|
+
# Delete makers
|
174
|
+
after :all do @project.instance_variable_set :@makers, {} end
|
175
|
+
end
|
167
176
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
177
|
+
# Describe Roject::Project#reload
|
178
|
+
#
|
179
|
+
# Reloads the project with the file with the given filename
|
180
|
+
#
|
181
|
+
# Parameter: filename - the name of the file to parse
|
182
|
+
# (defaults to the default filename)
|
183
|
+
describe '#reload' do
|
184
|
+
# Test loading foobar.rb file
|
185
|
+
it 'loads the given filename into the project' do
|
186
|
+
expect{@project.reload("foobar.rb")}.not_to raise_error
|
187
|
+
expect(@project).to be_an_instance_of Roject::Project
|
188
|
+
expect(@project.config).to eql @foocfg
|
189
|
+
end
|
190
|
+
|
191
|
+
# Test loading default file
|
192
|
+
it 'loads the default filename (if no filename is given)' do
|
193
|
+
expect{@project.reload}.not_to raise_error
|
194
|
+
expect(@project).to be_an_instance_of Roject::Project
|
175
195
|
end
|
176
196
|
|
177
197
|
# Delete makers
|
178
198
|
after :all do @project.instance_variable_set :@makers, {} end
|
179
199
|
end
|
180
200
|
|
181
|
-
# Describe Roject::Project
|
182
|
-
#
|
183
|
-
# The system of automating tasks in Roject
|
201
|
+
# Describe Roject::Project#config
|
184
202
|
#
|
185
|
-
#
|
186
|
-
#
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
extension: "h",
|
200
|
-
out: "include/#{@config[:project_name]}/#{@path}.h",
|
201
|
-
text: IO.read("output/testheader.h")
|
202
|
-
}
|
203
|
-
|
204
|
-
@source = {
|
205
|
-
name: :source,
|
206
|
-
path: "src/@(path)",
|
207
|
-
template: "source.general",
|
208
|
-
extension: "cpp",
|
209
|
-
out: "src/#{@path}.cpp",
|
210
|
-
text: IO.read("output/testsource.cpp")
|
211
|
-
}
|
212
|
-
|
213
|
-
# ----------------------TASK INFO----------------------
|
214
|
-
|
215
|
-
@module = {
|
216
|
-
name: :module,
|
217
|
-
block: Proc.new do |args|
|
218
|
-
args[:header_id] = c_header_id(args[:path])
|
219
|
-
make :header, args
|
220
|
-
make :source, args
|
221
|
-
end
|
222
|
-
}
|
203
|
+
# If a hash is given, sets the Project configuration to the hash.
|
204
|
+
# Else, returns the configuration of the Project.
|
205
|
+
#
|
206
|
+
# Parameter: hash - the hash to configure the project with
|
207
|
+
#
|
208
|
+
# Return: the configuration of the Project
|
209
|
+
describe '#config' do
|
210
|
+
it 'returns the configuration of the Project with no arguments given' do
|
211
|
+
expect(@project.config).to eql Roject::Project::CONFIG_DEFAULT
|
212
|
+
end
|
213
|
+
|
214
|
+
it 'configures the Project if a configuration hash is given' do
|
215
|
+
expect{@project.config(@foocfg)}.not_to raise_error
|
216
|
+
expect(@project.config).to eql @foocfg
|
223
217
|
end
|
218
|
+
end
|
224
219
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
end
|
220
|
+
# Describe Roject::Project#file
|
221
|
+
#
|
222
|
+
# Creates a file maker with the given name and hash
|
223
|
+
#
|
224
|
+
# Parameter: name - the name of the maker
|
225
|
+
# Parameter: hash - the hash arguments of the maker
|
226
|
+
describe '#file' do
|
227
|
+
it 'creates a file maker with the given name and hash of arguments' do
|
228
|
+
# Each file type
|
229
|
+
[@header, @source, @makefile, @main].each do |ft|
|
230
|
+
# Create filemaker
|
231
|
+
@project.file ft[:name], ft
|
232
|
+
fmkr = @project.instance_variable_get(:@makers)[ft[:name]]
|
233
|
+
|
234
|
+
# Filemaker
|
235
|
+
expect(fmkr).to be_an_instance_of Roject::FileMaker
|
236
|
+
|
237
|
+
# Path
|
238
|
+
expect(fmkr.instance_variable_get(:@path)).to be_an_instance_of General::GTemplate
|
239
|
+
expect(fmkr.instance_variable_get(:@path).to_s).to eql ft[:path]
|
240
|
+
|
241
|
+
# Template
|
242
|
+
expect(fmkr.instance_variable_get(:@template)).to be_an_instance_of General::GIO
|
243
|
+
expect(fmkr.instance_variable_get(:@template).source).to eql "#{@config[:directory][:templates]}/#{ft[:template]}"
|
244
|
+
|
245
|
+
# Extension
|
246
|
+
expect(fmkr.instance_variable_get(:@extension)).to eql ft[:extension]
|
253
247
|
end
|
254
248
|
end
|
249
|
+
end
|
255
250
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
251
|
+
# Describe Roject::Project#task
|
252
|
+
#
|
253
|
+
# Creates a task maker with the given name and block
|
254
|
+
#
|
255
|
+
# Parameter: name - the name of the recipie
|
256
|
+
# Parameter: block - the recipie block
|
257
|
+
describe '#task' do
|
258
|
+
it 'creates a task maker with the given name and block' do
|
259
|
+
[@module, @init].each do |tk|
|
264
260
|
# Create taskmaker
|
265
|
-
@project.task
|
261
|
+
@project.task tk[:name], &tk[:block]
|
262
|
+
tmkr = @project.instance_variable_get(:@makers)[tk[:name]]
|
266
263
|
|
267
|
-
#
|
268
|
-
tmkr = @project.instance_variable_get(:@makers)[@module[:name]]
|
264
|
+
# Check taskmaker
|
269
265
|
expect(tmkr).to be_an_instance_of Roject::TaskMaker
|
270
266
|
end
|
271
267
|
end
|
268
|
+
end
|
272
269
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
expect(IO.read(ft[:out])).to eql ft[:text]
|
293
|
-
end
|
294
|
-
end
|
270
|
+
# Describe Roject::Project#make
|
271
|
+
#
|
272
|
+
# Runs the maker of the given name with the given args
|
273
|
+
#
|
274
|
+
# Parameter: name - the name of the maker to run
|
275
|
+
# Parameter: args - the args to pass to the file
|
276
|
+
describe '#make' do
|
277
|
+
# Creating filetype
|
278
|
+
it 'creates the given filetype with the given arguments if a file maker name is given' do
|
279
|
+
# Each file type
|
280
|
+
[@header, @source, @makefile, @main].each do |ft|
|
281
|
+
# Make Header
|
282
|
+
@project.make ft[:name],
|
283
|
+
path: @path,
|
284
|
+
header_id: @project.c_header_id(@path)
|
285
|
+
|
286
|
+
# Test output
|
287
|
+
expect(File).to be_file(ft[:out])
|
288
|
+
expect(IO.read(ft[:out])).to eql ft[:text]
|
295
289
|
end
|
290
|
+
end
|
291
|
+
|
292
|
+
# Performing task
|
293
|
+
it 'performs the given task with the given arguments if task maker name is given' do
|
294
|
+
# Do module tasks
|
295
|
+
@project.make @module[:name], path: @path
|
296
296
|
|
297
|
-
#
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
# Each header
|
304
|
-
[@header, @source].each do |file|
|
305
|
-
# Test output
|
306
|
-
expect(File).to be_file(file[:out])
|
307
|
-
expect(IO.read(file[:out])).to eql file[:text]
|
308
|
-
end
|
309
|
-
end
|
297
|
+
# Each header
|
298
|
+
[@header, @source].each do |file|
|
299
|
+
# Test output
|
300
|
+
expect(File).to be_file(file[:out])
|
301
|
+
expect(IO.read(file[:out])).to eql file[:text]
|
310
302
|
end
|
303
|
+
end
|
311
304
|
|
312
|
-
|
313
|
-
|
305
|
+
# Delete files
|
306
|
+
after :all do
|
307
|
+
FileUtils.rmtree ["include", "src"]
|
308
|
+
FileUtils.rm "Makefile"
|
314
309
|
end
|
315
310
|
end
|
316
311
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anshul Kharbanda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: general
|
@@ -80,8 +80,11 @@ files:
|
|
80
80
|
- Rakefile
|
81
81
|
- bin/roject
|
82
82
|
- exp/project/_templates/header.general
|
83
|
+
- exp/project/_templates/main.general
|
84
|
+
- exp/project/_templates/makefile.general
|
83
85
|
- exp/project/_templates/source.general
|
84
86
|
- exp/project/foobar.rb
|
87
|
+
- exp/project/output/main.cpp
|
85
88
|
- exp/project/output/testheader.h
|
86
89
|
- exp/project/output/testsource.cpp
|
87
90
|
- exp/project/project.rb
|