crun 0.0.1 → 0.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.
@@ -1,3 +1,7 @@
1
1
  = Version history
2
2
 
3
+ [0.0.2] Option prepend feature.
4
+ Small update on option priority.
5
+ Testcases.
6
+
3
7
  [0.0.1] Initial version.
@@ -126,6 +126,7 @@ program would be given as:
126
126
  * Options for crun:
127
127
  * -crun-compopts:=-O2
128
128
  * crun-compopts:+-lm
129
+ * crun-compopts:.-std=c99
129
130
  * crun-progopts:=-c 12
130
131
  */
131
132
 
@@ -171,10 +172,10 @@ Summary of option setting from first to last:
171
172
  * Defaults (from crun program).
172
173
  * ".crun" from home directory.
173
174
  * ".crun" from current directory.
175
+ * Options embedded to C source file (main file).
174
176
  * "-c" options from files.
175
177
  * "-o" options from Crun CLI.
176
178
  * "-p" options for program (only).
177
- * Options embedded to C source file (main file).
178
179
 
179
180
 
180
181
  = Issues
data/bin/crun CHANGED
@@ -41,6 +41,9 @@ def apply_opt( opt )
41
41
  elsif opt.split(':+').length == 2
42
42
  parts = opt.split(':+')
43
43
  @crun[parts[0]].push parts[1]
44
+ elsif opt.split(':.').length == 2
45
+ parts = opt.split(':.')
46
+ @crun[parts[0]].unshift parts[1]
44
47
  end
45
48
  end
46
49
 
@@ -48,6 +51,7 @@ if Opt['template'].given
48
51
  puts "\
49
52
  /*
50
53
  * crun-compopts:+-O2
54
+ * crun-progopts:+-f file.txt
51
55
  */
52
56
 
53
57
  #include <stdio.h>
@@ -115,13 +119,6 @@ if Opt['debug'].given
115
119
  @crun['crunopts'].push '-g'
116
120
  end
117
121
 
118
- # Read in selected user confs.
119
- if Opt['conf'].given
120
- Opt['conf'].value.each do |userconf|
121
- load userconf if File.exist? userconf
122
- end
123
- end
124
-
125
122
 
126
123
  # ------------------------------------------------------------
127
124
  # Collect compilation options from c-file.
@@ -138,6 +135,15 @@ File.readlines( cfiles[0] ).each do |line|
138
135
  end
139
136
 
140
137
 
138
+ # ------------------------------------------------------------
139
+ # Read in selected user confs.
140
+ if Opt['conf'].given
141
+ Opt['conf'].value.each do |userconf|
142
+ load userconf if File.exist? userconf
143
+ end
144
+ end
145
+
146
+
141
147
  # ------------------------------------------------------------
142
148
  # Collect compilation options from CLI.
143
149
 
@@ -1,2 +1,2 @@
1
1
  @crun['compopts'].push "-O2"
2
- @crun['progopts'].push "-c 4"
2
+ @crun['progopts'].unshift "-c 4"
@@ -2,6 +2,7 @@
2
2
  * Options for crun:
3
3
  * -crun-compopts:=-O2
4
4
  * crun-compopts:+-lm
5
+ * crun-compopts:.-std=c99
5
6
  * crun-progopts:=-c 12
6
7
  */
7
8
 
@@ -1,5 +1,5 @@
1
1
  module Crun
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  def Crun.version
4
4
  Crun::VERSION
5
5
  end
@@ -0,0 +1,12 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
5
+ Greeting #5!
6
+ Greeting #6!
7
+ Greeting #7!
8
+ Greeting #8!
9
+ Greeting #9!
10
+ Greeting #10!
11
+ Greeting #11!
12
+ Greeting #12!
@@ -0,0 +1,4 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
@@ -0,0 +1,20 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
5
+ Greeting #5!
6
+ Greeting #6!
7
+ Greeting #7!
8
+ Greeting #8!
9
+ Greeting #9!
10
+ Greeting #10!
11
+ Greeting #11!
12
+ Greeting #12!
13
+ Greeting #13!
14
+ Greeting #14!
15
+ Greeting #15!
16
+ Greeting #16!
17
+ Greeting #17!
18
+ Greeting #18!
19
+ Greeting #19!
20
+ Greeting #20!
@@ -0,0 +1,13 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
5
+ Greeting #5!
6
+ Greeting #6!
7
+ Greeting #7!
8
+ Greeting #8!
9
+ Greeting #9!
10
+ Greeting #10!
11
+ Greeting #11!
12
+ Greeting #12!
13
+ Greeting #13!
@@ -0,0 +1,12 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
5
+ Greeting #5!
6
+ Greeting #6!
7
+ Greeting #7!
8
+ Greeting #8!
9
+ Greeting #9!
10
+ Greeting #10!
11
+ Greeting #11!
12
+ Greeting #12!
@@ -0,0 +1,12 @@
1
+ /*
2
+ * crun-compopts:+-O2
3
+ * crun-progopts:+-f file.txt
4
+ */
5
+
6
+ #include <stdio.h>
7
+
8
+ int main( int argc, char** argv )
9
+ {
10
+
11
+ return 0;
12
+ }
@@ -0,0 +1,12 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
5
+ Greeting #5!
6
+ Greeting #6!
7
+ Greeting #7!
8
+ Greeting #8!
9
+ Greeting #9!
10
+ Greeting #10!
11
+ Greeting #11!
12
+ Greeting #12!
@@ -0,0 +1,4 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
@@ -0,0 +1,20 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
5
+ Greeting #5!
6
+ Greeting #6!
7
+ Greeting #7!
8
+ Greeting #8!
9
+ Greeting #9!
10
+ Greeting #10!
11
+ Greeting #11!
12
+ Greeting #12!
13
+ Greeting #13!
14
+ Greeting #14!
15
+ Greeting #15!
16
+ Greeting #16!
17
+ Greeting #17!
18
+ Greeting #18!
19
+ Greeting #19!
20
+ Greeting #20!
@@ -0,0 +1,13 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
5
+ Greeting #5!
6
+ Greeting #6!
7
+ Greeting #7!
8
+ Greeting #8!
9
+ Greeting #9!
10
+ Greeting #10!
11
+ Greeting #11!
12
+ Greeting #12!
13
+ Greeting #13!
@@ -0,0 +1,12 @@
1
+ Greeting #1!
2
+ Greeting #2!
3
+ Greeting #3!
4
+ Greeting #4!
5
+ Greeting #5!
6
+ Greeting #6!
7
+ Greeting #7!
8
+ Greeting #8!
9
+ Greeting #9!
10
+ Greeting #10!
11
+ Greeting #11!
12
+ Greeting #12!
@@ -0,0 +1,12 @@
1
+ /*
2
+ * crun-compopts:+-O2
3
+ * crun-progopts:+-f file.txt
4
+ */
5
+
6
+ #include <stdio.h>
7
+
8
+ int main( int argc, char** argv )
9
+ {
10
+
11
+ return 0;
12
+ }
@@ -0,0 +1,43 @@
1
+ require 'test/unit'
2
+
3
+ # Select training if you want to renew golden files.
4
+ #TRAINING = true
5
+ TRAINING = false
6
+
7
+
8
+ # Test execution routine.
9
+ def runTest( test, cmdopts )
10
+ rf = "result/#{test}.txt"
11
+ gf = "golden/#{test}.txt"
12
+
13
+ system( "export RUBYLIB=../lib; ../bin/crun #{cmdopts} > #{rf}" )
14
+
15
+ if TRAINING
16
+ # Populate golden files after inspection.
17
+ system( "cp #{rf} #{gf}" )
18
+ end
19
+
20
+ assert( system( "diff #{rf} #{gf}" ), "FAILED: diff #{rf} #{gf}" )
21
+ end
22
+
23
+
24
+ # Tests.
25
+ class CrunTest < Test::Unit::TestCase
26
+
27
+ def setup
28
+ Dir.chdir( 'test' )
29
+ FileUtils.mkdir_p "result"
30
+ end
31
+
32
+ def teardown
33
+ Dir.chdir( '..' )
34
+ end
35
+
36
+ def test_basic() runTest( "basic", "-f ../examples/greeting.c" ); end
37
+ def test_conf() runTest( "conf", "-f ../examples/greeting.c -c ../examples/crun_conf.rb" ); end
38
+ def test_override() runTest( "override", "-f ../examples/greeting.c -c ../examples/crun_conf.rb -o \"progopts:.-c 20\"" ); end
39
+ def test_override2() runTest( "override2", "-f ../examples/greeting.c -o \"progopts:.-c 13\"" ); end
40
+ def test_override3() runTest( "override3", "-f ../examples/greeting.c -o \"progopts:+-c 13\"" ); end
41
+ def test_template() runTest( "template", "-f ../examples/greeting.c -o \"progopts:+-c 13\" -t" ); end
42
+
43
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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: 2016-12-25 00:00:00.000000000 Z
12
+ date: 2016-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: como
@@ -55,24 +55,19 @@ files:
55
55
  - examples/greeting.c
56
56
  - examples/sizeof.c
57
57
  - examples/crun_conf.rb
58
- - doc/top-level-namespace.html
59
- - doc/js/full_list.js
60
- - doc/js/app.js
61
- - doc/js/jquery.js
62
- - doc/index.html
63
- - doc/css/common.css
64
- - doc/css/full_list.css
65
- - doc/css/style.css
66
- - doc/Array.html
67
- - doc/file.README.html
68
- - doc/method_list.html
69
- - doc/file_list.html
70
- - doc/Crun.html
71
- - doc/class_list.html
72
- - doc/_index.html
73
- - doc/file.CHANGELOG.html
74
- - doc/CrunMod.html
75
- - doc/frames.html
58
+ - test/golden/override.txt
59
+ - test/golden/override3.txt
60
+ - test/golden/basic.txt
61
+ - test/golden/override2.txt
62
+ - test/golden/conf.txt
63
+ - test/golden/template.txt
64
+ - test/test_crun.rb
65
+ - test/result/override.txt
66
+ - test/result/override3.txt
67
+ - test/result/basic.txt
68
+ - test/result/override2.txt
69
+ - test/result/conf.txt
70
+ - test/result/template.txt
76
71
  - bin/crun
77
72
  homepage:
78
73
  licenses:
@@ -98,5 +93,5 @@ rubyforge_project:
98
93
  rubygems_version: 1.8.23
99
94
  signing_key:
100
95
  specification_version: 3
101
- summary: Shell env variable management utility.
96
+ summary: C-program prototyping environment.
102
97
  test_files: []
@@ -1,202 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Class: Array
8
-
9
- &mdash; Documentation by YARD 0.8.7.6
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- hasFrames = window.top.frames.main ? true : false;
19
- relpath = '';
20
- framesUrl = "frames.html#!Array.html";
21
- </script>
22
-
23
-
24
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
-
26
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
-
28
-
29
- </head>
30
- <body>
31
- <div id="header">
32
- <div id="menu">
33
-
34
- <a href="_index.html">Index (A)</a> &raquo;
35
-
36
-
37
- <span class="title">Array</span>
38
-
39
-
40
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
- </div>
42
-
43
- <div id="search">
44
-
45
- <a class="full_list_link" id="class_list_link"
46
- href="class_list.html">
47
- Class List
48
- </a>
49
-
50
- <a class="full_list_link" id="method_list_link"
51
- href="method_list.html">
52
- Method List
53
- </a>
54
-
55
- <a class="full_list_link" id="file_list_link"
56
- href="file_list.html">
57
- File List
58
- </a>
59
-
60
- </div>
61
- <div class="clear"></div>
62
- </div>
63
-
64
- <iframe id="search_frame"></iframe>
65
-
66
- <div id="content"><h1>Class: Array
67
-
68
-
69
-
70
- </h1>
71
-
72
- <dl class="box">
73
-
74
- <dt class="r1">Inherits:</dt>
75
- <dd class="r1">
76
- <span class="inheritName">Object</span>
77
-
78
- <ul class="fullTree">
79
- <li>Object</li>
80
-
81
- <li class="next">Array</li>
82
-
83
- </ul>
84
- <a href="#" class="inheritanceTree">show all</a>
85
-
86
- </dd>
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
- <dt class="r2 last">Defined in:</dt>
97
- <dd class="r2 last">bin/crun</dd>
98
-
99
- </dl>
100
- <div class="clear"></div>
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
- <h2>
111
- Instance Method Summary
112
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
113
- </h2>
114
-
115
- <ul class="summary">
116
-
117
- <li class="public ">
118
- <span class="summary_signature">
119
-
120
- <a href="#crun-instance_method" title="#crun (instance method)">- (Object) <strong>crun</strong> </a>
121
-
122
-
123
-
124
- </span>
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
- <span class="summary_desc"><div class='inline'>
135
- <p>Join array elements with space.</p>
136
- </div></span>
137
-
138
- </li>
139
-
140
-
141
- </ul>
142
-
143
-
144
-
145
-
146
- <div id="instance_method_details" class="method_details_list">
147
- <h2>Instance Method Details</h2>
148
-
149
-
150
- <div class="method_details first">
151
- <h3 class="signature first" id="crun-instance_method">
152
-
153
- - (<tt>Object</tt>) <strong>crun</strong>
154
-
155
-
156
-
157
-
158
-
159
- </h3><div class="docstring">
160
- <div class="discussion">
161
-
162
- <p>Join array elements with space.</p>
163
-
164
-
165
- </div>
166
- </div>
167
- <div class="tags">
168
-
169
-
170
- </div><table class="source_code">
171
- <tr>
172
- <td>
173
- <pre class="lines">
174
-
175
-
176
- 169
177
- 170
178
- 171</pre>
179
- </td>
180
- <td>
181
- <pre class="code"><span class="info file"># File 'bin/crun', line 169</span>
182
-
183
- <span class='kw'>def</span> <span class='id identifier rubyid_crun'>crun</span>
184
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'> </span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
185
- <span class='kw'>end</span></pre>
186
- </td>
187
- </tr>
188
- </table>
189
- </div>
190
-
191
- </div>
192
-
193
- </div>
194
-
195
- <div id="footer">
196
- Generated on Sun Dec 25 20:31:45 2016 by
197
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
198
- 0.8.7.6 (ruby-2.3.1).
199
- </div>
200
-
201
- </body>
202
- </html>