demake 0.2.2 → 0.2.3
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/bin/demake +98 -21
- data/lib/apps/example/Makefile +0 -0
- data/lib/apps/example/src/goodbye.c +0 -0
- data/lib/apps/example/src/hello.c +0 -0
- data/lib/apps/example/src/string/string.c +0 -0
- data/lib/apps/example/src/string/string.h +0 -0
- data/lib/apps/oreo/Makefile +0 -0
- data/lib/apps/oreo/oreo_test.txt +0 -0
- data/lib/apps/oreo/src/defines.h +0 -0
- data/lib/apps/oreo/src/fast_read_file.h +0 -0
- data/lib/apps/oreo/src/oreo.c +0 -0
- data/lib/apps/oreo/src/typedefs.h +0 -0
- data/lib/data/libsrc/auto_bits.h +0 -0
- data/lib/data/libsrc/base.h +0 -0
- data/lib/data/libsrc/cpu_mark_check.h +0 -0
- data/lib/data/libsrc/defines.h +0 -0
- data/lib/data/libsrc/fast_read_file.h +0 -0
- data/lib/data/libsrc/fast_sha2.h +0 -0
- data/lib/data/libsrc/parse_arguments.h +0 -0
- data/lib/data/libsrc/rb_library.c +0 -0
- data/lib/data/libsrc/simple_linked_list.c +0 -0
- data/lib/data/libsrc/simple_linked_list.h +0 -0
- data/lib/data/libsrc/smart_alloc.h +0 -0
- data/lib/data/libsrc/typedefs.h +0 -0
- metadata +26 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c2a824e423f1590b984cd455c1cc798423b7739d2f2d6136c8cd5d2027e5504
|
|
4
|
+
data.tar.gz: a45262cbd164127e71c834a185dc133298de0c5b5916cac8a266d80df8d0786e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9428832c08f525f34bb06e1a050311ddbf9a5188da8bc7d383b5c95728c9650a4babe3bb45d2aaf59c9a552485dd30c77882b103a5ecac756c5c268306d6664d
|
|
7
|
+
data.tar.gz: f8de83f44ec206fb9d6cec6e3735c36c7e10337a945e13f7be5266b986a052f8e8989e5147fefea33adc852caeba24236e74d2cc11dc63110a221ac631196383
|
data/bin/demake
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
require 'rbconfig' # Needed by older versions of Ruby
|
|
7
7
|
require 'pipetext'
|
|
8
8
|
|
|
9
|
-
demake_version = "0.2.
|
|
9
|
+
demake_version = "0.2.3"
|
|
10
10
|
|
|
11
11
|
@silent = false
|
|
12
12
|
@compiler = "gcc"
|
|
@@ -123,7 +123,6 @@ end
|
|
|
123
123
|
@lib_apps = File.join(File.expand_path("../..", __FILE__), "lib", "apps")
|
|
124
124
|
@lib_dir = File.join(File.expand_path("../..", __FILE__), "lib")
|
|
125
125
|
@available_apps = Array.new
|
|
126
|
-
|
|
127
126
|
Dir.entries(@lib_apps).each do |e|
|
|
128
127
|
if(e != '.' && e != '..')
|
|
129
128
|
@available_apps << e
|
|
@@ -151,7 +150,7 @@ def file_open_read_close(filename, notify_warning=true)
|
|
|
151
150
|
notify("|YWARNING|n: #{$!.to_s.sub(/@ rb_[a-zA-Z_]* /, '')}")
|
|
152
151
|
end
|
|
153
152
|
end
|
|
154
|
-
return
|
|
153
|
+
return data
|
|
155
154
|
end
|
|
156
155
|
|
|
157
156
|
def copy_template(filename)
|
|
@@ -175,32 +174,102 @@ def copy_template(filename)
|
|
|
175
174
|
exit!
|
|
176
175
|
end
|
|
177
176
|
else
|
|
178
|
-
data = file_open_read_close(filename)
|
|
177
|
+
# data = file_open_read_close(filename)
|
|
179
178
|
new_name = filename.sub(/^#{@lib_apps}./, '')
|
|
180
179
|
file_open_write_close(new_name, file_open_read_close(filename))
|
|
181
180
|
notify("#{@emoji_success} Created file: |y#{new_name}|n |[page facing up]\n")
|
|
182
181
|
end
|
|
183
182
|
end
|
|
184
183
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
def create_new_application(new_name)
|
|
185
|
+
begin
|
|
186
|
+
if(File.directory?(new_name) != true)
|
|
187
|
+
Dir.mkdir(new_name)
|
|
188
|
+
notify("#{@emoji_success} Created directory: |g#{new_name}|n |[open file folder]\n")
|
|
189
|
+
end
|
|
190
|
+
if(File.directory?(new_name + "/demake") != true)
|
|
191
|
+
Dir.mkdir(new_name + "/demake")
|
|
192
|
+
notify("#{@emoji_success} Created directory: |g#{new_name}/demake|n |[open file folder]\n")
|
|
193
|
+
end
|
|
194
|
+
begin
|
|
195
|
+
File.open("#{new_name}/demake/applications", 'w') do |f|
|
|
196
|
+
f.write("#{new_name}\n")
|
|
197
|
+
end
|
|
198
|
+
notify("#{@emoji_success} Created file: |y#{new_name}/demake/applications|n |[page facing up]\n")
|
|
199
|
+
rescue
|
|
200
|
+
notify("|RError|n: #{$!}")
|
|
193
201
|
end
|
|
194
|
-
@
|
|
195
|
-
|
|
202
|
+
file_open_write_close(new_name + "/demake/settings.rb", file_open_read_close(@lib_apps + "/example/demake/settings.rb"))
|
|
203
|
+
notify("#{@emoji_success} Created file: |y#{new_name}/demake/settings.rb|n |[page facing up]\n")
|
|
204
|
+
file_open_write_close(new_name + "/demake/license", file_open_read_close(@lib_apps + "/example/demake/license"))
|
|
205
|
+
notify("#{@emoji_success} Created file: |y#{new_name}/demake/license|n |[page facing up]\n")
|
|
196
206
|
begin
|
|
197
|
-
File.open(
|
|
198
|
-
|
|
207
|
+
File.open("#{new_name}/demake/test-target.rb", 'w') do |f|
|
|
208
|
+
f.write("test_targets = <<-END_OF_STRING\n")
|
|
209
|
+
f.write("\t@echo\n\t@echo \"|YTesting command:|n\"\n\tbin/#{new_name}\n")
|
|
210
|
+
f.write("END_OF_STRING\n")
|
|
211
|
+
f.write("test_target << test_targets\n")
|
|
199
212
|
end
|
|
213
|
+
notify("#{@emoji_success} Created file: |y#{new_name}/demake/test-target.rb|n |[page facing up]\n")
|
|
200
214
|
rescue
|
|
215
|
+
notify("|RError|n: #{$!}")
|
|
216
|
+
end
|
|
217
|
+
if(File.directory?(new_name + "/src") != true)
|
|
218
|
+
Dir.mkdir(new_name + "/src")
|
|
219
|
+
notify("#{@emoji_success} Created directory: |g#{new_name}/src|n |[open file folder]\n")
|
|
220
|
+
end
|
|
221
|
+
file_open_write_close(new_name + "/src/typedefs.h", file_open_read_close(@lib_data + "/libsrc/typedefs.h"))
|
|
222
|
+
file_open_write_close(new_name + "/src/defines.h", file_open_read_close(@lib_data + "/libsrc/defines.h"))
|
|
223
|
+
file_open_write_close(new_name + "/src/base.h", file_open_read_close(@lib_data + "/libsrc/base.h"))
|
|
224
|
+
begin
|
|
225
|
+
File.open("#{new_name}/src/#{new_name}.c", 'w') do |f|
|
|
226
|
+
f.write("/*\n\n #{new_name}.c - #{new_name} main application entry point\n\n*/\n\n" +
|
|
227
|
+
"#include <stdio.h>\n\n#include \"base.h\"\n\n" +
|
|
228
|
+
"i32 main(i32 argc, c8 *argv[]) {\n printf(\"Hello, world!\\n\");\n return 0;\n}\n")
|
|
229
|
+
end
|
|
230
|
+
notify("#{@emoji_success} Created file: |y#{new_name}/src/#{new_name}.c|n |[page facing up]\n")
|
|
231
|
+
rescue
|
|
232
|
+
notify("|RError|n: #{$!}")
|
|
233
|
+
end
|
|
234
|
+
rescue Errno::EACCES
|
|
235
|
+
notify("|RError|n: #{$!.to_s.sub(/@ dir_s_mkdir /, '')}")
|
|
236
|
+
exit!
|
|
237
|
+
rescue
|
|
238
|
+
notify("|RError|n: #{$!}")
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
@found_application = nil
|
|
243
|
+
@suggestion = String.new
|
|
244
|
+
|
|
245
|
+
if(ARGV[0] =~ /^new/)
|
|
246
|
+
if(ARGV[1] == nil || ARGV[1] == "")
|
|
247
|
+
notify("\n#{@emoji_fail}|RError|n: |Ynew application name |Rrequired|n.\n\n");
|
|
248
|
+
exit!
|
|
249
|
+
end
|
|
250
|
+
@found_application = "new"
|
|
251
|
+
create_new_application(ARGV[1])
|
|
252
|
+
Dir.chdir(ARGV[1])
|
|
253
|
+
@working_directory = Dir.pwd
|
|
254
|
+
else
|
|
255
|
+
@available_apps.sort.each do |app|
|
|
256
|
+
if(ARGV[0] =~ /^#{app}$/)
|
|
257
|
+
if(File.directory?(app) == true)
|
|
258
|
+
notify("\n#{@emoji_fail}|RError|n: |Ydirectory #{app} |Ralready exists, aborting creation|n\n\n" +
|
|
259
|
+
"Delete the directory and try again if you wish to recreate it.\n\n")
|
|
260
|
+
exit!
|
|
261
|
+
end
|
|
262
|
+
@found_application = app
|
|
263
|
+
copy_template(File.join(@lib_apps, app))
|
|
264
|
+
begin
|
|
265
|
+
File.open(File.join(@lib_apps, app, 'demake', 'suggestion'), 'r') do |f|
|
|
266
|
+
@suggestion = f.read.chomp
|
|
267
|
+
end
|
|
268
|
+
rescue
|
|
269
|
+
end
|
|
270
|
+
Dir.chdir(app)
|
|
271
|
+
@working_directory = Dir.pwd
|
|
201
272
|
end
|
|
202
|
-
Dir.chdir(app)
|
|
203
|
-
@working_directory = Dir.pwd
|
|
204
273
|
end
|
|
205
274
|
end
|
|
206
275
|
|
|
@@ -217,6 +286,8 @@ if(need_help == true)
|
|
|
217
286
|
program = File.basename($0)
|
|
218
287
|
COLUMN_WIDTH = 20
|
|
219
288
|
syntax = "|]#{COLUMN_WIDTH}Command syntax:\n\n" + "|y#{program}|n|; - Create or update Makefile\n"
|
|
289
|
+
syntax << "|y#{program} ?|n|; - View this help information\n"
|
|
290
|
+
syntax << "|y#{program} new <name>|n|; - Create new application\n"
|
|
220
291
|
@available_apps.sort.each do |app|
|
|
221
292
|
data = String.new
|
|
222
293
|
begin
|
|
@@ -231,6 +302,7 @@ if(need_help == true)
|
|
|
231
302
|
syntax << "|y#{program} #{app}|n\n"
|
|
232
303
|
end
|
|
233
304
|
end
|
|
305
|
+
syntax << "\nVersion: |c#{demake_version}|n\n"
|
|
234
306
|
notify(syntax + "\n")
|
|
235
307
|
exit!
|
|
236
308
|
end
|
|
@@ -965,9 +1037,14 @@ end
|
|
|
965
1037
|
|
|
966
1038
|
if(@found_application != nil)
|
|
967
1039
|
File.open('Makefile', 'w').write(@output)
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
notify("Suggestion: |
|
|
1040
|
+
if(@found_application == "new")
|
|
1041
|
+
notify("#{@emoji_success} Created file: |y#{ARGV[1]}/Makefile|n |[page facing up]\n\n")
|
|
1042
|
+
notify("Suggestion: |Ccd #{ARGV[1]} ; make ; make build ; make test|n\n")
|
|
1043
|
+
else
|
|
1044
|
+
notify("#{@emoji_success} Created file: |y#{@found_application}/Makefile|n |[page facing up]\n\n")
|
|
1045
|
+
if(@suggestion != "")
|
|
1046
|
+
notify("Suggestion: |C#{@suggestion}|n\n")
|
|
1047
|
+
end
|
|
971
1048
|
end
|
|
972
1049
|
Dir.chdir('..')
|
|
973
1050
|
else
|
data/lib/apps/example/Makefile
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/apps/oreo/Makefile
CHANGED
|
File without changes
|
data/lib/apps/oreo/oreo_test.txt
CHANGED
|
File without changes
|
data/lib/apps/oreo/src/defines.h
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/apps/oreo/src/oreo.c
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/data/libsrc/auto_bits.h
CHANGED
|
File without changes
|
data/lib/data/libsrc/base.h
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/data/libsrc/defines.h
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/data/libsrc/fast_sha2.h
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/data/libsrc/typedefs.h
CHANGED
|
File without changes
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: demake
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Minaswan Nakamoto
|
|
@@ -36,6 +36,31 @@ description: |
|
|
|
36
36
|
|
|
37
37
|
> gem install demake
|
|
38
38
|
|
|
39
|
+
To see command syntax:
|
|
40
|
+
|
|
41
|
+
> demake ?
|
|
42
|
+
|
|
43
|
+
Command syntax:
|
|
44
|
+
|
|
45
|
+
demake - Create or update Makefile
|
|
46
|
+
demake ? - View this help information
|
|
47
|
+
demake new <name> - Create new application
|
|
48
|
+
demake example - Create an example application
|
|
49
|
+
demake oreo - Create a different sample application
|
|
50
|
+
|
|
51
|
+
Version: 0.2.3
|
|
52
|
+
|
|
53
|
+
To create a new application:
|
|
54
|
+
|
|
55
|
+
> demake new <name>
|
|
56
|
+
|
|
57
|
+
This will create a new directory and basic files for a new C application.
|
|
58
|
+
|
|
59
|
+
To create or update a GNU Makefile on an existing demake application,
|
|
60
|
+
execute without arguments:
|
|
61
|
+
|
|
62
|
+
> demake
|
|
63
|
+
|
|
39
64
|
To create an example with multiple sample applications:
|
|
40
65
|
|
|
41
66
|
> demake example
|
|
@@ -61,10 +86,6 @@ description: |
|
|
|
61
86
|
demake/settings.rb, demake/test-target.rb, demake/install-target.rb,
|
|
62
87
|
demake/license
|
|
63
88
|
|
|
64
|
-
The output of the command by itself is a (GNU style) file named Makefile:
|
|
65
|
-
|
|
66
|
-
> demake
|
|
67
|
-
|
|
68
89
|
You can also clone from git:
|
|
69
90
|
|
|
70
91
|
> git clone https://github.com/MinaswanNakamoto/demake.git
|