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
data/test/test_mould.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
require_relative '../lib/falsework/mould'
|
3
|
+
|
4
|
+
class TestFalsework_3673712978 < 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_config_parse
|
11
|
+
refute Mould.config_parse "DOESN'T EXIST", nil, nil
|
12
|
+
|
13
|
+
o = {}
|
14
|
+
r = Mould.config_parse File.dirname(@cmd) + '/../etc/falsework.yaml', [], o
|
15
|
+
assert_equal true, r
|
16
|
+
|
17
|
+
o = { foo: 1 }
|
18
|
+
out, err = capture_io do
|
19
|
+
r = Mould.config_parse File.dirname(@cmd) + '/../etc/falsework.yaml', ['bar'], o
|
20
|
+
end
|
21
|
+
assert_match "missing or nil 'bar' in", err
|
22
|
+
refute r
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_name_project
|
26
|
+
assert_equal '', Mould.name_project('')
|
27
|
+
assert_equal '', Mould.name_project(nil)
|
28
|
+
assert_equal '', Mould.name_project("\n")
|
29
|
+
assert_equal 'foobar_pro', Mould.name_project('FooBar Pro')
|
30
|
+
assert_equal 'foobar_pro', Mould.name_project(" FooBar --Pro?\n\n\n")
|
31
|
+
assert_equal 'foobar_pro', Mould.name_project('foobar#pro,')
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_name_classy
|
35
|
+
assert_equal '', Mould.name_classy('')
|
36
|
+
assert_equal '', Mould.name_classy(nil)
|
37
|
+
assert_equal '', Mould.name_classy("\n")
|
38
|
+
assert_equal 'FooBar Pro', Mould.name_classy('FooBar Pro')
|
39
|
+
assert_equal 'FooBar Pro', Mould.name_classy("FooBar \n Pro ")
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_name_valid
|
43
|
+
assert_equal false, Mould.name_valid?('')
|
44
|
+
assert_equal false, Mould.name_valid?(nil)
|
45
|
+
assert_equal false, Mould.name_valid?("\n")
|
46
|
+
assert_equal false, Mould.name_valid?('0foobar')
|
47
|
+
assert_equal false, Mould.name_valid?('foobar ')
|
48
|
+
assert_equal true, Mould.name_valid?('foobar')
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_name_camelcase
|
52
|
+
assert_equal '', Mould.name_camelcase('')
|
53
|
+
assert_equal '', Mould.name_camelcase(nil)
|
54
|
+
assert_equal '', Mould.name_camelcase("\n")
|
55
|
+
assert_equal 'FP', Mould.name_camelcase('f p')
|
56
|
+
assert_equal 'Foobar', Mould.name_camelcase('foobar')
|
57
|
+
assert_equal 'FooBarPro', Mould.name_camelcase('FooBar Pro')
|
58
|
+
assert_equal 'FooBarPro', Mould.name_camelcase(" FooBar --Pro?\n\n\n")
|
59
|
+
assert_equal 'FoobarPro', Mould.name_camelcase('foobar#pro,')
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_get_filename
|
63
|
+
f = 'foo'
|
64
|
+
b = 'bar'
|
65
|
+
|
66
|
+
assert_equal '', Mould.get_filename(nil, binding)
|
67
|
+
assert_equal '', Mould.get_filename('', binding)
|
68
|
+
assert_equal 'f/b', Mould.get_filename('f/b', binding)
|
69
|
+
assert_equal 'f/bar/q.txt', Mould.get_filename('f/%%b%%/q.txt', binding)
|
70
|
+
assert_equal 'foo/bar/q.txt', Mould.get_filename('%%f%%/%%b%%/q.txt', binding)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_uuid
|
74
|
+
512.times {|i|
|
75
|
+
t = Mould.uuidgen_fake
|
76
|
+
assert_match(/^[A-Z0-9]{8}_[A-Z0-9]{4}_[A-Z0-9]{4}_[A-Z0-9]{4}_[A-Z0-9]{12}$/, t)
|
77
|
+
refute_match /\d/, t[0]
|
78
|
+
}
|
79
|
+
end
|
80
|
+
end
|
metadata
CHANGED
@@ -1,111 +1,137 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: falsework
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.8
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Alexander Gromnitsky
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-01-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: git
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &75682810 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
23
21
|
version: 1.2.5
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: open4
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *75682810
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: open4
|
27
|
+
requirement: &75682580 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.2.0
|
35
33
|
type: :runtime
|
36
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *75682580
|
37
36
|
description: A primitive scaffold generator for writing CLI programs in Ruby.
|
38
37
|
email: alexander.gromnitsky@gmail.com
|
39
|
-
executables:
|
38
|
+
executables:
|
40
39
|
- falsework
|
41
40
|
extensions: []
|
42
|
-
|
43
|
-
|
41
|
+
extra_rdoc_files:
|
42
|
+
- doc/TODO.org
|
44
43
|
- doc/NEWS.rdoc
|
45
44
|
- doc/LICENSE
|
45
|
+
- doc/template-tutorial.rdoc
|
46
46
|
- doc/README.rdoc
|
47
|
-
|
48
|
-
|
47
|
+
files:
|
48
|
+
- Gemfile
|
49
|
+
- Gemfile.lock
|
49
50
|
- README.rdoc
|
50
51
|
- Rakefile
|
51
52
|
- bin/falsework
|
52
53
|
- doc/LICENSE
|
53
54
|
- doc/NEWS.rdoc
|
54
55
|
- doc/README.rdoc
|
55
|
-
- doc/TODO.
|
56
|
+
- doc/TODO.org
|
57
|
+
- doc/template-tutorial.rdoc
|
56
58
|
- etc/falsework.yaml
|
57
59
|
- lib/falsework/meta.rb
|
58
60
|
- lib/falsework/mould.rb
|
59
|
-
- lib/falsework/templates/
|
60
|
-
- lib/falsework/templates/
|
61
|
-
- lib/falsework/templates/
|
62
|
-
- lib/falsework/templates/
|
63
|
-
- lib/falsework/templates/
|
64
|
-
- lib/falsework/templates/
|
65
|
-
- lib/falsework/templates/
|
66
|
-
- lib/falsework/templates/
|
67
|
-
- lib/falsework/templates/
|
68
|
-
- lib/falsework/templates/
|
69
|
-
- lib/falsework/templates/
|
70
|
-
- lib/falsework/templates/
|
71
|
-
- lib/falsework/templates/
|
61
|
+
- lib/falsework/templates/c-glib/#config.yaml
|
62
|
+
- lib/falsework/templates/c-glib/README
|
63
|
+
- lib/falsework/templates/c-glib/doc/#doc.ascii
|
64
|
+
- lib/falsework/templates/c-glib/doc/%%@project%%.1.asciidoc
|
65
|
+
- lib/falsework/templates/c-glib/doc/LICENSE
|
66
|
+
- lib/falsework/templates/c-glib/doc/Makefile
|
67
|
+
- lib/falsework/templates/c-glib/src/#exe.c
|
68
|
+
- lib/falsework/templates/c-glib/src/#exe.h
|
69
|
+
- lib/falsework/templates/c-glib/src/%%@project%%.c
|
70
|
+
- lib/falsework/templates/c-glib/src/%%@project%%.h
|
71
|
+
- lib/falsework/templates/c-glib/src/Makefile
|
72
|
+
- lib/falsework/templates/c-glib/src/untest.c
|
73
|
+
- lib/falsework/templates/c-glib/src/untest.h
|
74
|
+
- lib/falsework/templates/c-glib/src/utils.c
|
75
|
+
- lib/falsework/templates/c-glib/src/utils.h
|
76
|
+
- lib/falsework/templates/c-glib/test/#test.c
|
77
|
+
- lib/falsework/templates/c-glib/test/Makefile
|
78
|
+
- lib/falsework/templates/c-glib/test/Makefile.test.mk
|
79
|
+
- lib/falsework/templates/c-glib/test/mycat.c
|
80
|
+
- lib/falsework/templates/c-glib/test/semis/text/empty.txt
|
81
|
+
- lib/falsework/templates/c-glib/test/test_utils.c
|
82
|
+
- lib/falsework/templates/ruby-naive/#config.yaml
|
83
|
+
- lib/falsework/templates/ruby-naive/.gitignore.#erb
|
84
|
+
- lib/falsework/templates/ruby-naive/Gemfile
|
85
|
+
- lib/falsework/templates/ruby-naive/README.rdoc
|
86
|
+
- lib/falsework/templates/ruby-naive/Rakefile
|
87
|
+
- lib/falsework/templates/ruby-naive/bin/%%@project%%
|
88
|
+
- lib/falsework/templates/ruby-naive/doc/#doc.rdoc
|
89
|
+
- lib/falsework/templates/ruby-naive/doc/LICENSE
|
90
|
+
- lib/falsework/templates/ruby-naive/doc/NEWS.rdoc
|
91
|
+
- lib/falsework/templates/ruby-naive/doc/README.rdoc
|
92
|
+
- lib/falsework/templates/ruby-naive/etc/%%@project%%.yaml
|
93
|
+
- lib/falsework/templates/ruby-naive/lib/%%@project%%/meta.rb
|
94
|
+
- lib/falsework/templates/ruby-naive/test/helper.rb
|
95
|
+
- lib/falsework/templates/ruby-naive/test/test_%%@project%%.rb
|
72
96
|
- lib/falsework/trestle.rb
|
73
97
|
- test/helper.rb
|
74
98
|
- test/helper_trestle.rb
|
75
99
|
- test/rake_erb_templates.rb
|
76
100
|
- test/rake_git.rb
|
77
|
-
- test/templates
|
101
|
+
- test/templates/config-01.yaml
|
102
|
+
- test/test_cl.rb
|
78
103
|
- test/test_exe.rb
|
79
|
-
-
|
80
|
-
- lib/falsework/templates/naive/
|
81
|
-
- lib/falsework/templates/naive/test/
|
104
|
+
- test/test_mould.rb
|
105
|
+
- lib/falsework/templates/ruby-naive/lib/%%@project%%/trestle.rb
|
106
|
+
- lib/falsework/templates/ruby-naive/test/helper_trestle.rb
|
107
|
+
- lib/falsework/templates/ruby-naive/test/rake_git.rb
|
82
108
|
homepage: http://github.com/gromnitsky/falsework
|
83
109
|
licenses: []
|
84
|
-
|
85
110
|
post_install_message:
|
86
|
-
rdoc_options:
|
111
|
+
rdoc_options:
|
87
112
|
- -m
|
88
113
|
- doc/README.rdoc
|
89
|
-
require_paths:
|
114
|
+
require_paths:
|
90
115
|
- lib
|
91
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
117
|
none: false
|
93
|
-
requirements:
|
94
|
-
- -
|
95
|
-
- !ruby/object:Gem::Version
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
96
121
|
version: 1.9.2
|
97
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
123
|
none: false
|
99
|
-
requirements:
|
100
|
-
- -
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version:
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
103
128
|
requirements: []
|
104
|
-
|
105
129
|
rubyforge_project:
|
106
|
-
rubygems_version: 1.8.
|
130
|
+
rubygems_version: 1.8.10
|
107
131
|
signing_key:
|
108
132
|
specification_version: 3
|
109
133
|
summary: A primitive scaffold generator for writing CLI programs in Ruby
|
110
|
-
test_files:
|
134
|
+
test_files:
|
135
|
+
- test/test_mould.rb
|
136
|
+
- test/test_cl.rb
|
111
137
|
- test/test_exe.rb
|