mkduino 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/mkduino +51 -1
- data/lib/mkduino.rb +3 -3
- data/lib/mkduino/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d2ade613b46584cd90dbd376faef4987aa974ef
|
4
|
+
data.tar.gz: e89abc2128f6b7f86a395e3f4b68450aab1488d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 254bc74e8c603664cc0c66967d6dc6019bbd1358ccec8891892dab4a5c1ac47a2ce55d9e0bbd6db096f2eee7d9d4633fe43c2adb503cbc2cd4c3a5a16929046b
|
7
|
+
data.tar.gz: 79dbe0352efcd1c1857d4debc989ef80b5e0792a52a14b9ce388ee660a9880d3a2dac98b14d8f3c5dc77111cfe4c013312c7cab98f23547d6495ace741ae8580
|
data/bin/mkduino
CHANGED
@@ -24,6 +24,54 @@
|
|
24
24
|
#
|
25
25
|
|
26
26
|
require "mkduino"
|
27
|
+
require 'optparse'
|
28
|
+
|
29
|
+
options = {}
|
30
|
+
OptionParser.new do |opts|
|
31
|
+
options[:verbose] = false
|
32
|
+
options[:git] = false
|
33
|
+
options[:update] = false
|
34
|
+
options[:overwrite] = false
|
35
|
+
options[:num_args] = ARGV.length
|
36
|
+
|
37
|
+
opts.banner = "Usage: #{opts.program_name} [options]"
|
38
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
39
|
+
options[:verbose] = v
|
40
|
+
end
|
41
|
+
# opts.on("-g","--[no-]git","Create / update git repo") do |v|
|
42
|
+
# options[:git] = v
|
43
|
+
# end
|
44
|
+
# opts.on("-u","--[no-]update","Update current project files") do |v|
|
45
|
+
# options[:update] = v
|
46
|
+
# end
|
47
|
+
opts.on("-o","--[no-]overwrite","Overwrite current project files") do |v|
|
48
|
+
options[:overwrite] = v
|
49
|
+
end
|
50
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
51
|
+
puts opts
|
52
|
+
exit
|
53
|
+
end
|
54
|
+
|
55
|
+
if options[:num_args] < 1
|
56
|
+
puts opts
|
57
|
+
exit
|
58
|
+
end
|
59
|
+
|
60
|
+
end.parse!
|
61
|
+
|
62
|
+
if((Pathname.new("Makefile.am").exist? ||
|
63
|
+
Pathname.new("configure.ac").exist? ||
|
64
|
+
Pathname.new("autogen.sh").exist? ||
|
65
|
+
Pathname.new("config/config.h").exist? ||
|
66
|
+
Pathname.new("NEWS").exist? ||
|
67
|
+
Pathname.new("README").exist? ||
|
68
|
+
Pathname.new("AUTHORS").exist? ||
|
69
|
+
Pathname.new("ChangeLog").exist?) && !options[:overwrite])
|
70
|
+
puts "Please supply --overwrite to ovewrite existing files"
|
71
|
+
exit
|
72
|
+
end
|
73
|
+
|
74
|
+
|
27
75
|
|
28
76
|
ma = Mkduino::MakefileAm.new
|
29
77
|
ma.find_arduino_libraries '/usr/share/arduino/libraries'
|
@@ -31,7 +79,9 @@ ma.find_arduino_libraries '/usr/share/arduino/hardware/arduino/cores'
|
|
31
79
|
ma.find_source_files
|
32
80
|
ca = Mkduino::ConfigureAc.new ma
|
33
81
|
as = Mkduino::AutogenSh.new
|
34
|
-
|
82
|
+
if options[:verbose]
|
83
|
+
puts ma.to_yaml
|
84
|
+
end
|
35
85
|
|
36
86
|
##
|
37
87
|
# Output the Makefile.am file withe the needed variable replacements
|
data/lib/mkduino.rb
CHANGED
@@ -30,7 +30,6 @@ module Mkduino
|
|
30
30
|
pn = Pathname.new(file)
|
31
31
|
puts "!! ******** File #{file} not found ******** " unless pn.exist?
|
32
32
|
include_dir = pn.file? ? pn.dirname : file
|
33
|
-
puts "Add include for #{file} = #{include_dir}"
|
34
33
|
|
35
34
|
@library_includes << include_dir.to_s unless @library_includes.include? include_dir.to_s
|
36
35
|
end
|
@@ -111,8 +110,6 @@ LIBRARY_OUTPUT
|
|
111
110
|
pn = Pathname.new(file)
|
112
111
|
puts "!! ******** File #{file} not found ******** " unless pn.exist?
|
113
112
|
include_dir = pn.file? ? pn.dirname : file
|
114
|
-
puts "Add include for #{file} = #{include_dir}"
|
115
|
-
|
116
113
|
@project_includes << include_dir.to_s unless @project_includes.include? include_dir.to_s
|
117
114
|
end
|
118
115
|
|
@@ -283,6 +280,7 @@ MAIN_CPP
|
|
283
280
|
|
284
281
|
|
285
282
|
def write_makefile_am
|
283
|
+
puts "Writing Makefile.am"
|
286
284
|
File.open('Makefile.am',"w") do |f|
|
287
285
|
f.puts <<-MAKEFILE_AM
|
288
286
|
## Process this file with automake to produce Makefile.in
|
@@ -345,6 +343,7 @@ MAKEFILE_AM
|
|
345
343
|
##
|
346
344
|
# Output the configure.ac file
|
347
345
|
##
|
346
|
+
puts "Writing configure.ac"
|
348
347
|
File.open('configure.ac',"w") do |f|
|
349
348
|
f.puts <<-CONFIGURE_AC
|
350
349
|
dnl Process this file with autoconf to produce a configure script.")
|
@@ -383,6 +382,7 @@ CONFIGURE_AC
|
|
383
382
|
|
384
383
|
class AutogenSh
|
385
384
|
def write_autogen_sh
|
385
|
+
puts("Writing autogen.sh")
|
386
386
|
File.open('autogen.sh',"w") do |f|
|
387
387
|
f.puts <<-AUTOGEN_SH
|
388
388
|
#!/bin/sh
|
data/lib/mkduino/version.rb
CHANGED