falsework 0.2.8 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{lib/falsework/templates/naive/Gemfile.erb → Gemfile} +1 -1
- data/Gemfile.lock +12 -0
- data/README.rdoc +45 -21
- data/Rakefile +5 -5
- data/bin/falsework +64 -28
- data/doc/NEWS.rdoc +37 -10
- data/doc/README.rdoc +45 -21
- data/doc/TODO.org +13 -0
- data/doc/template-tutorial.rdoc +113 -0
- data/etc/falsework.yaml +1 -1
- data/lib/falsework/meta.rb +3 -2
- data/lib/falsework/mould.rb +267 -146
- data/lib/falsework/templates/c-glib/#config.yaml +18 -0
- data/lib/falsework/templates/c-glib/README +24 -0
- data/lib/falsework/templates/c-glib/doc/#doc.ascii +46 -0
- data/lib/falsework/templates/c-glib/doc/%%@project%%.1.asciidoc +46 -0
- data/lib/falsework/templates/{naive/doc/LICENSE.erb → c-glib/doc/LICENSE} +1 -1
- data/lib/falsework/templates/c-glib/doc/Makefile +17 -0
- data/lib/falsework/templates/c-glib/src/#exe.c +23 -0
- data/lib/falsework/templates/c-glib/src/#exe.h +8 -0
- data/lib/falsework/templates/c-glib/src/%%@project%%.c +23 -0
- data/lib/falsework/templates/c-glib/src/%%@project%%.h +26 -0
- data/lib/falsework/templates/c-glib/src/Makefile +28 -0
- data/lib/falsework/templates/c-glib/src/untest.c +9 -0
- data/lib/falsework/templates/c-glib/src/untest.h +14 -0
- data/lib/falsework/templates/c-glib/src/utils.c +232 -0
- data/lib/falsework/templates/c-glib/src/utils.h +45 -0
- data/lib/falsework/templates/c-glib/test/#test.c +48 -0
- data/lib/falsework/templates/c-glib/test/Makefile +78 -0
- data/lib/falsework/templates/c-glib/test/Makefile.test.mk +72 -0
- data/lib/falsework/templates/c-glib/test/mycat.c +8 -0
- data/{test/templates/.keep_me → lib/falsework/templates/c-glib/test/semis/text/empty.txt} +0 -0
- data/lib/falsework/templates/c-glib/test/test_utils.c +134 -0
- data/lib/falsework/templates/ruby-naive/#config.yaml +15 -0
- data/lib/falsework/templates/{naive/.gitignore.erb → ruby-naive/.gitignore.#erb} +0 -0
- data/lib/falsework/templates/ruby-naive/Gemfile +4 -0
- data/lib/falsework/templates/{naive/doc/README.rdoc.erb → ruby-naive/README.rdoc} +2 -2
- data/lib/falsework/templates/{naive/Rakefile.erb → ruby-naive/Rakefile} +1 -1
- data/lib/falsework/templates/{naive/bin/%%@project%%.erb → ruby-naive/bin/%%@project%%} +5 -5
- data/lib/falsework/templates/{naive/doc/#util.rdoc.erb → ruby-naive/doc/#doc.rdoc} +6 -6
- data/lib/falsework/templates/ruby-naive/doc/LICENSE +22 -0
- data/lib/falsework/templates/{naive/doc/NEWS.rdoc.erb → ruby-naive/doc/NEWS.rdoc} +0 -0
- data/lib/falsework/templates/{naive/README.rdoc.erb → ruby-naive/doc/README.rdoc} +2 -2
- data/lib/falsework/templates/{naive/etc/%%@project%%.yaml.erb → ruby-naive/etc/%%@project%%.yaml} +0 -0
- data/lib/falsework/templates/{naive/lib/%%@project%%/meta.rb.erb → ruby-naive/lib/%%@project%%/meta.rb} +3 -2
- data/lib/falsework/templates/{naive/lib/%%@project%%/trestle.rb.erb → ruby-naive/lib/%%@project%%/trestle.rb} +22 -14
- data/lib/falsework/templates/{naive/test/helper.rb.erb → ruby-naive/test/helper.rb} +0 -0
- data/lib/falsework/templates/{naive/test/helper_trestle.rb.erb → ruby-naive/test/helper_trestle.rb} +2 -2
- data/lib/falsework/templates/{naive/test/rake_git.rb.erb → ruby-naive/test/rake_git.rb} +1 -1
- data/lib/falsework/templates/{naive/test/test_%%@project%%.rb.erb → ruby-naive/test/test_%%@project%%.rb} +1 -1
- data/lib/falsework/trestle.rb +17 -9
- data/test/rake_erb_templates.rb +4 -4
- data/test/templates/config-01.yaml +2 -0
- data/test/test_cl.rb +29 -0
- data/test/test_exe.rb +61 -30
- data/test/test_mould.rb +80 -0
- metadata +86 -60
- data/doc/TODO.rdoc +0 -7
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
4
|
require_relative '../lib/<%= @project %>/trestle.rb'
|
5
5
|
|
6
|
-
include <%= @
|
6
|
+
include <%= @camelcase %>
|
7
7
|
|
8
8
|
$conf = Hash.new
|
9
|
-
|
9
|
+
$t = Trestle.new($conf)
|
10
10
|
|
11
11
|
$conf[:banner] = "Usage: #{File.basename($0)} [options] hren'"
|
12
12
|
$conf[:foobar] = ''
|
@@ -14,12 +14,12 @@ $conf[:foobar] = ''
|
|
14
14
|
|
15
15
|
# --[ main ]------------------------------------------------------------
|
16
16
|
|
17
|
-
|
18
|
-
o =
|
17
|
+
$t.config_parse(['foobar']) {|src|
|
18
|
+
o = $t.cl_parse(src) # create an OptionParser object
|
19
19
|
o.on('--foobar STR', 'An example of the option --foobar') {|i|
|
20
20
|
$conf[:foobar] = i
|
21
21
|
}
|
22
|
-
|
22
|
+
$t.cl_parse(src, o) # run cl parser
|
23
23
|
}
|
24
24
|
|
25
25
|
# print our env
|
@@ -1,16 +1,16 @@
|
|
1
1
|
=Name
|
2
2
|
|
3
|
-
<%=
|
3
|
+
<%= target %>--[TODO: write a summary here.]
|
4
4
|
|
5
5
|
|
6
6
|
==Synopsis
|
7
7
|
|
8
|
-
<%=
|
8
|
+
<%= target %> [options]
|
9
9
|
|
10
10
|
|
11
11
|
==Description
|
12
12
|
|
13
|
-
The <%=
|
13
|
+
The <%= target %> utility [TODO: write a description here.]
|
14
14
|
|
15
15
|
The options are as follows:
|
16
16
|
|
@@ -31,7 +31,7 @@ The options are as follows:
|
|
31
31
|
|
32
32
|
==Configuration
|
33
33
|
|
34
|
-
<%=
|
34
|
+
<%= target %> looks for its configuration at 3 places at start up.
|
35
35
|
|
36
36
|
1. At <tt><%= @project.upcase %>_CONF</tt> env variable.
|
37
37
|
(Its format is exactly similar to CL options.)
|
@@ -51,5 +51,5 @@ gemdir`/gems/<%= @project %>-x.y.z/etc/</tt> directory for samples.
|
|
51
51
|
|
52
52
|
==Examples
|
53
53
|
|
54
|
-
% <%=
|
55
|
-
% <%=
|
54
|
+
% <%= target %> --config-dirs
|
55
|
+
% <%= target %> -V
|
@@ -0,0 +1,22 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) <%= DateTime.now.year %> <%= @gecos %>.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
=Name
|
2
2
|
|
3
|
-
<%= @
|
3
|
+
<%= @classy %>--[TODO: write a summary here.]
|
4
4
|
|
5
5
|
|
6
6
|
==Synopsis
|
@@ -51,6 +51,6 @@ gemdir`/gems/<%= @project %>-x.y.z/etc/</tt> directory for samples.
|
|
51
51
|
|
52
52
|
==Examples
|
53
53
|
|
54
|
-
% ri <%= @
|
54
|
+
% ri <%= @camelcase %>
|
55
55
|
% <%= @project %> --config-dirs
|
56
56
|
% <%= @project %> -V
|
data/lib/falsework/templates/{naive/etc/%%@project%%.yaml.erb → ruby-naive/etc/%%@project%%.yaml}
RENAMED
File without changes
|
@@ -7,9 +7,8 @@ require 'open4'
|
|
7
7
|
|
8
8
|
require_relative 'meta'
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
module <%= @camelcase %>
|
11
|
+
# A common routines from <%= @project %> with love.
|
13
12
|
class Trestle
|
14
13
|
|
15
14
|
# Execute _cmd_ and return a list [exit_status, stderr,
|
@@ -25,9 +24,9 @@ module <%= @project.capitalize %>
|
|
25
24
|
|
26
25
|
# Return a directory with program libraries.
|
27
26
|
def self.gem_libdir
|
28
|
-
t = ["#{File.dirname(File.realpath($0))}/../lib/#{<%= @
|
29
|
-
"#{Gem.dir}/gems/#{<%= @
|
30
|
-
"lib/#{<%= @
|
27
|
+
t = ["#{File.dirname(File.realpath($0))}/../lib/#{<%= @camelcase %>::Meta::NAME}",
|
28
|
+
"#{Gem.dir}/gems/#{<%= @camelcase %>::Meta::NAME}-#{<%= @camelcase %>::Meta::VERSION}/lib/#{<%= @camelcase %>::Meta::NAME}",
|
29
|
+
"lib/#{<%= @camelcase %>::Meta::NAME}"]
|
31
30
|
t.each {|i| return i if File.readable?(i) }
|
32
31
|
fail "all paths are invalid: #{t}"
|
33
32
|
end
|
@@ -127,9 +126,9 @@ module <%= @project.capitalize %>
|
|
127
126
|
# puts "\n2 run"
|
128
127
|
r = config_flat_load(rvars)
|
129
128
|
rescue
|
130
|
-
Trestle.errx(1, "cannot load config: #{
|
129
|
+
Trestle.errx(1, "cannot load config: #{Trestle.get_backtrace}")
|
131
130
|
end
|
132
|
-
veputs(1, "
|
131
|
+
veputs(1, "OK") if r
|
133
132
|
cb.call(block_given?, ARGV)
|
134
133
|
end
|
135
134
|
|
@@ -141,7 +140,8 @@ module <%= @project.capitalize %>
|
|
141
140
|
# Return a loaded filename or nil on error.
|
142
141
|
def config_flat_load(rvars)
|
143
142
|
p = ->(f) {
|
144
|
-
|
143
|
+
veputs(1, "Loading #{f}... " + NNL_MARK)
|
144
|
+
if File.file?(f)
|
145
145
|
begin
|
146
146
|
myconf = YAML.load_file(f)
|
147
147
|
rescue
|
@@ -153,11 +153,13 @@ module <%= @project.capitalize %>
|
|
153
153
|
@conf.merge!(myconf)
|
154
154
|
return @conf[:config]
|
155
155
|
end
|
156
|
+
|
157
|
+
veputs(1, "FAILED")
|
156
158
|
return nil
|
157
159
|
}
|
158
160
|
|
159
161
|
if @conf[:config].index('/')
|
160
|
-
return p.call(@
|
162
|
+
return p.call(@conf[:config])
|
161
163
|
else
|
162
164
|
@conf[:config_dirs].each {|dir|
|
163
165
|
return dir+'/'+@conf[:config] if p.call(dir + '/' + @conf[:config])
|
@@ -192,9 +194,15 @@ module <%= @project.capitalize %>
|
|
192
194
|
@conf[:config] = i
|
193
195
|
}
|
194
196
|
o.on('--config-dirs', 'Show possible config locations.') {
|
195
|
-
|
196
|
-
|
197
|
-
|
197
|
+
mark = false
|
198
|
+
@conf[:config_dirs].each { |idx|
|
199
|
+
f = idx + '/' + @conf[:config]
|
200
|
+
if File.readable?(f) && !mark
|
201
|
+
puts "* " + f
|
202
|
+
mark = true
|
203
|
+
else
|
204
|
+
puts " " + f
|
205
|
+
end
|
198
206
|
}
|
199
207
|
exit 0
|
200
208
|
}
|
@@ -219,4 +227,4 @@ module <%= @project.capitalize %>
|
|
219
227
|
end # trestle
|
220
228
|
end
|
221
229
|
|
222
|
-
# Don't remove this: falsework/
|
230
|
+
# Don't remove this: falsework/1.3.0/ruby-naive/2012-01-27T02:39:48+02:00
|
File without changes
|
data/lib/falsework/templates/{naive/test/helper_trestle.rb.erb → ruby-naive/test/helper_trestle.rb}
RENAMED
@@ -5,7 +5,7 @@ require 'fileutils'
|
|
5
5
|
include FileUtils
|
6
6
|
|
7
7
|
require_relative '../lib/<%= @project %>/trestle'
|
8
|
-
include <%= @
|
8
|
+
include <%= @camelcase %>
|
9
9
|
|
10
10
|
require 'minitest/autorun'
|
11
11
|
|
@@ -31,4 +31,4 @@ def cmd(c)
|
|
31
31
|
File.absolute_path('../bin/' + c)
|
32
32
|
end
|
33
33
|
|
34
|
-
# Don't remove this: falsework/
|
34
|
+
# Don't remove this: falsework/1.3.0/ruby-naive/2012-01-27T02:39:48+02:00
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'helper'
|
2
2
|
|
3
|
-
class Test<%= @
|
3
|
+
class Test<%= @camelcase %>_<%= rand 2**32 %> < MiniTest::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
# this runs every time before test_*
|
6
6
|
@cmd = cmd('<%= @project %>') # get path to the exe & cd to tests directory
|
data/lib/falsework/trestle.rb
CHANGED
@@ -7,9 +7,8 @@ require 'open4'
|
|
7
7
|
|
8
8
|
require_relative 'meta'
|
9
9
|
|
10
|
-
# :include: ../../README.rdoc
|
11
10
|
module Falsework
|
12
|
-
|
11
|
+
# A common routines from falsework with love.
|
13
12
|
class Trestle
|
14
13
|
|
15
14
|
# Execute _cmd_ and return a list [exit_status, stderr,
|
@@ -127,9 +126,9 @@ module Falsework
|
|
127
126
|
# puts "\n2 run"
|
128
127
|
r = config_flat_load(rvars)
|
129
128
|
rescue
|
130
|
-
Trestle.errx(1, "cannot load config: #{
|
129
|
+
Trestle.errx(1, "cannot load config: #{Trestle.get_backtrace}")
|
131
130
|
end
|
132
|
-
veputs(1, "
|
131
|
+
veputs(1, "OK") if r
|
133
132
|
cb.call(block_given?, ARGV)
|
134
133
|
end
|
135
134
|
|
@@ -141,7 +140,8 @@ module Falsework
|
|
141
140
|
# Return a loaded filename or nil on error.
|
142
141
|
def config_flat_load(rvars)
|
143
142
|
p = ->(f) {
|
144
|
-
|
143
|
+
veputs(1, "Loading #{f}... " + NNL_MARK)
|
144
|
+
if File.file?(f)
|
145
145
|
begin
|
146
146
|
myconf = YAML.load_file(f)
|
147
147
|
rescue
|
@@ -153,11 +153,13 @@ module Falsework
|
|
153
153
|
@conf.merge!(myconf)
|
154
154
|
return @conf[:config]
|
155
155
|
end
|
156
|
+
|
157
|
+
veputs(1, "FAILED")
|
156
158
|
return nil
|
157
159
|
}
|
158
160
|
|
159
161
|
if @conf[:config].index('/')
|
160
|
-
return p.call(@
|
162
|
+
return p.call(@conf[:config])
|
161
163
|
else
|
162
164
|
@conf[:config_dirs].each {|dir|
|
163
165
|
return dir+'/'+@conf[:config] if p.call(dir + '/' + @conf[:config])
|
@@ -192,9 +194,15 @@ module Falsework
|
|
192
194
|
@conf[:config] = i
|
193
195
|
}
|
194
196
|
o.on('--config-dirs', 'Show possible config locations.') {
|
195
|
-
|
196
|
-
|
197
|
-
|
197
|
+
mark = false
|
198
|
+
@conf[:config_dirs].each { |idx|
|
199
|
+
f = idx + '/' + @conf[:config]
|
200
|
+
if File.readable?(f) && !mark
|
201
|
+
puts "* " + f
|
202
|
+
mark = true
|
203
|
+
else
|
204
|
+
puts " " + f
|
205
|
+
end
|
198
206
|
}
|
199
207
|
exit 0
|
200
208
|
}
|
data/test/rake_erb_templates.rb
CHANGED
@@ -31,7 +31,7 @@ def erb_skeletons(local_prj, template)
|
|
31
31
|
# puts line
|
32
32
|
if line =~ /^..? :erb:/
|
33
33
|
t = i.sub(/^.+?\//, '')
|
34
|
-
r[target + '/' + t.sub(/#{local_prj}/, '%%@project%%')
|
34
|
+
r[target + '/' + t.sub(/#{local_prj}/, '%%@project%%')] = t
|
35
35
|
break
|
36
36
|
end
|
37
37
|
n += 1
|
@@ -45,11 +45,11 @@ end
|
|
45
45
|
def erb_make(local_prj, template, target, tmplt)
|
46
46
|
raw = File.read(tmplt)
|
47
47
|
raw.gsub!(/#{local_prj}/, '<%= @project %>')
|
48
|
-
raw.gsub!(/#{local_prj
|
48
|
+
raw.gsub!(/#{Mould.name_camelcase(local_prj)}/, '<%= @camelcase %>')
|
49
49
|
|
50
50
|
mark = <<-EOF
|
51
51
|
|
52
|
-
# Don't remove this: <%= #{local_prj
|
52
|
+
# Don't remove this: <%= #{Mould.name_camelcase(local_prj)}::Meta::NAME %>/<%= #{local_prj.capitalize}::Meta::VERSION %>/#{template}/<%= DateTime.now %>
|
53
53
|
EOF
|
54
54
|
File.open(target, 'w+') {
|
55
55
|
|fp| fp.puts raw + ERB.new(mark).result(binding)
|
@@ -57,4 +57,4 @@ def erb_make(local_prj, template, target, tmplt)
|
|
57
57
|
end
|
58
58
|
|
59
59
|
|
60
|
-
pp erb_skeletons(Falsework::Meta::NAME, 'naive') if __FILE__ == $0
|
60
|
+
pp erb_skeletons(Falsework::Meta::NAME, 'ruby-naive') if __FILE__ == $0
|
data/test/test_cl.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
require_relative '../lib/falsework/mould'
|
3
|
+
|
4
|
+
class TestFalsework_3867654745 < MiniTest::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
# this runs every time before test_*
|
7
|
+
@cmd = cmd('falsework') # get path to the exe & cd to tests directory
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_listdirs
|
11
|
+
assert_equal 2, Mould.class_variable_get(:@@template_dirs).size
|
12
|
+
out, err = capture_io { Mould.template_dirs_add ["DOESN'T EXISI"] }
|
13
|
+
assert_equal 2, Mould.class_variable_get(:@@template_dirs).size
|
14
|
+
Mould.template_dirs_add [Dir.pwd]
|
15
|
+
assert_equal 3, Mould.class_variable_get(:@@template_dirs).size
|
16
|
+
|
17
|
+
assert_equal true, Mould.templates.key?("templates")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_new_dir_from_config
|
21
|
+
r = Trestle.cmd_run "#{@cmd} --config /NO_SUCH_FILE.yaml listdirs"
|
22
|
+
assert_equal(0, r[0])
|
23
|
+
assert_equal(2, r[2].split("\n").size)
|
24
|
+
|
25
|
+
r = Trestle.cmd_run "#{@cmd} --config templates/config-01.yaml listdirs"
|
26
|
+
assert_equal(0, r[0])
|
27
|
+
assert_equal(3, r[2].split("\n").size)
|
28
|
+
end
|
29
|
+
end
|
data/test/test_exe.rb
CHANGED
@@ -9,7 +9,7 @@ class TestFalsework < MiniTest::Unit::TestCase
|
|
9
9
|
def test_project_list
|
10
10
|
r = Trestle.cmd_run "#{@cmd} list"
|
11
11
|
assert_equal(0, r[0])
|
12
|
-
assert_match(/naive
|
12
|
+
assert_match(/ruby-naive/, r[2])
|
13
13
|
end
|
14
14
|
|
15
15
|
# very silly analogue of "sed -i'' -E 's/foo/bar/g' file"
|
@@ -18,7 +18,7 @@ class TestFalsework < MiniTest::Unit::TestCase
|
|
18
18
|
File.open(file, 'w+') {|fp| fp.printf(o) }
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
21
|
+
def test_project_ruby_naive
|
22
22
|
rm_rf 'templates/foo'
|
23
23
|
r = Trestle.cmd_run "#{@cmd} new templates/foo -v"
|
24
24
|
# pp r
|
@@ -57,40 +57,71 @@ class TestFalsework < MiniTest::Unit::TestCase
|
|
57
57
|
i.match(/\.\.?$/) || i.match(/\.git[^i]/)
|
58
58
|
})
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
Dir.chdir('templates/foo') {
|
61
|
+
# add files
|
62
|
+
r = Trestle.cmd_run "#{@cmd} exe qqq"
|
63
|
+
assert_equal(0, r[0])
|
64
|
+
assert_equal(true, File.executable?('bin/qqq'))
|
65
|
+
assert_equal(true, File.exist?('doc/qqq.rdoc'))
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
assert_equal(true, File.exist?('doc/qqq.rdoc'))
|
68
|
-
|
69
|
-
r = Trestle.cmd_run "#{@cmd} test qqq"
|
70
|
-
assert_equal(0, r[0])
|
71
|
-
assert_equal(true, File.exist?('test/test_qqq.rb'))
|
67
|
+
r = Trestle.cmd_run "#{@cmd} test qqq"
|
68
|
+
assert_equal(0, r[0])
|
69
|
+
assert_equal(true, File.exist?('test/test_qqq.rb'))
|
72
70
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
cd origdir
|
71
|
+
# upgrade
|
72
|
+
r = Trestle.cmd_run "#{@cmd} upgrade -b"
|
73
|
+
assert_equal(0, r[0])
|
74
|
+
rm ['test/helper_trestle.rb', 'test/rake_git.rb']
|
75
|
+
r = Trestle.cmd_run "#{@cmd} upgrade -b"
|
76
|
+
assert_equal(0, r[0])
|
77
|
+
sed 'test/helper_trestle.rb',
|
78
|
+
/^(# Don't.+falsework\/)\d+\.\d+\.\d+(\/.+)$/, '\1999.999.999\2'
|
79
|
+
r = Trestle.cmd_run "#{@cmd} upgrade -b"
|
80
|
+
assert_equal(1, r[0])
|
81
|
+
assert_match(/file .+ is from .+ falsework: 999.999.999/, r[1])
|
82
|
+
mv('test', 'ttt')
|
83
|
+
r = Trestle.cmd_run "#{@cmd} upgrade -b"
|
84
|
+
assert_equal(0, r[0])
|
85
|
+
}
|
89
86
|
end
|
90
87
|
|
91
88
|
def test_project_invalid_name
|
92
89
|
r = Trestle.cmd_run "#{@cmd} new 123"
|
93
90
|
assert_equal(1, r[0])
|
94
|
-
assert_match(/project name
|
91
|
+
assert_match(/invalid project name/, r[1])
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_project_c_glib
|
95
|
+
rm_rf 'templates/c_glib'
|
96
|
+
r = Trestle.cmd_run "#{@cmd} new templates/c-glib -t c-glib --no-git"
|
97
|
+
assert_equal(0, r[0])
|
98
|
+
|
99
|
+
Dir.chdir('templates/c_glib') {
|
100
|
+
r = Trestle.cmd_run "#{@cmd} -t c-glib exe q-q-q"
|
101
|
+
assert_equal(0, r[0])
|
102
|
+
assert_equal(true, File.exist?('src/q_q_q.h'))
|
103
|
+
assert_equal(true, File.exist?('src/q_q_q.c'))
|
104
|
+
assert_equal(true, File.exist?('doc/q_q_q.1.asciidoc'))
|
105
|
+
|
106
|
+
r = Trestle.cmd_run "#{@cmd} -t c-glib test q-q-q"
|
107
|
+
assert_equal(0, r[0])
|
108
|
+
assert_equal(true, File.exist?('test/test_q_q_q.c'))
|
109
|
+
|
110
|
+
Dir.chdir('src') {
|
111
|
+
r = Trestle.cmd_run "gmake"
|
112
|
+
assert_equal 0, r[0]
|
113
|
+
assert_equal true, File.executable?('c_glib')
|
114
|
+
assert_equal(true, File.exist?('q_q_q.o'))
|
115
|
+
}
|
116
|
+
Dir.chdir('test') {
|
117
|
+
r = Trestle.cmd_run "gmake"
|
118
|
+
assert_equal 0, r[0]
|
119
|
+
assert_equal true, File.executable?('test_utils')
|
120
|
+
assert_equal true, File.executable?('test_q_q_q')
|
121
|
+
|
122
|
+
r = Trestle.cmd_run "gmake test"
|
123
|
+
assert_equal 0, r[0]
|
124
|
+
}
|
125
|
+
}
|
95
126
|
end
|
96
127
|
end
|