cgialib 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.
- data/Manifest.txt +7 -2
- data/Rakefile +4 -3
- data/examples/ut/mytest1.c +22 -0
- data/features/language_parser.feature +21 -0
- data/features/steps/language_parser.rb +84 -0
- data/lib/cgialib/lp/JavaDoc.rb +220 -0
- data/lib/cgialib/lp/JavaLanguageScanner.rb +660 -0
- data/lib/cgialib/lp/SQLLanguageScanner.rb +688 -0
- data/lib/cgialib/lp/SQLTokenizer.rb +403 -0
- data/lib/cgialib/lp.rb +5 -0
- data/lib/cgialib/template/ut/c.rb +10 -3
- data/lib/cgialib.rb +1 -1
- data/website/index.html +4 -21
- data/website/index.txt +2 -27
- data/website/template.html.erb +1 -1
- metadata +29 -4
- data/features/development.feature +0 -13
- data/features/steps/common.rb +0 -174
data/features/steps/common.rb
DELETED
@@ -1,174 +0,0 @@
|
|
1
|
-
def in_project_folder(&block)
|
2
|
-
project_folder = @active_project_folder || @tmp_root
|
3
|
-
FileUtils.chdir(project_folder, &block)
|
4
|
-
end
|
5
|
-
|
6
|
-
def in_home_folder(&block)
|
7
|
-
FileUtils.chdir(@home_path, &block)
|
8
|
-
end
|
9
|
-
|
10
|
-
Given %r{^a safe folder} do
|
11
|
-
FileUtils.rm_rf @tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
12
|
-
FileUtils.mkdir_p @tmp_root
|
13
|
-
FileUtils.mkdir_p @home_path = File.expand_path(File.join(@tmp_root, "home"))
|
14
|
-
@lib_path = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
15
|
-
Given "env variable $HOME set to '#{@home_path}'"
|
16
|
-
end
|
17
|
-
|
18
|
-
Given %r{^this project is active project folder} do
|
19
|
-
Given "a safe folder"
|
20
|
-
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
21
|
-
end
|
22
|
-
|
23
|
-
Given %r{^env variable \$([\w_]+) set to '(.*)'} do |env_var, value|
|
24
|
-
ENV[env_var] = value
|
25
|
-
end
|
26
|
-
|
27
|
-
def force_local_lib_override(project_name = @project_name)
|
28
|
-
rakefile = File.read(File.join(project_name, 'Rakefile'))
|
29
|
-
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
30
|
-
f << "$:.unshift('#{@lib_path}')\n"
|
31
|
-
f << rakefile
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def setup_active_project_folder project_name
|
36
|
-
@active_project_folder = File.join(@tmp_root, project_name)
|
37
|
-
@project_name = project_name
|
38
|
-
end
|
39
|
-
|
40
|
-
Given %r{'(.*)' folder is deleted} do |folder|
|
41
|
-
in_project_folder do
|
42
|
-
FileUtils.rm_rf folder
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
When %r{^'(.*)' generator is invoked with arguments '(.*)'$} do |generator, arguments|
|
47
|
-
FileUtils.chdir(@active_project_folder) do
|
48
|
-
if Object.const_defined?("APP_ROOT")
|
49
|
-
APP_ROOT.replace(FileUtils.pwd)
|
50
|
-
else
|
51
|
-
APP_ROOT = FileUtils.pwd
|
52
|
-
end
|
53
|
-
run_generator(generator, arguments.split(' '), SOURCES)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
When %r{run executable '(.*)' with arguments '(.*)'} do |executable, arguments|
|
58
|
-
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
59
|
-
FileUtils.chdir(@active_project_folder) do
|
60
|
-
system "ruby #{executable} #{arguments} > #{@stdout}"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
When %r{^task 'rake (.*)' is invoked$} do |task|
|
65
|
-
@stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
|
66
|
-
FileUtils.chdir(@active_project_folder) do
|
67
|
-
system "rake #{task} --trace > #{@stdout} 2> #{@stdout}"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
Then %r{^folder '(.*)' is created} do |folder|
|
72
|
-
in_project_folder do
|
73
|
-
File.exists?(folder).should be_true
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
Then %r{^file '(.*)' (is|is not) created} do |file, is|
|
78
|
-
in_project_folder do
|
79
|
-
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
Then %r{^file with name matching '(.*)' is created} do |pattern|
|
84
|
-
in_project_folder do
|
85
|
-
Dir[pattern].should_not be_empty
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
Then %r{gem file '(.*)' and generated file '(.*)' should be the same} do |gem_file, project_file|
|
90
|
-
File.exists?(gem_file).should be_true
|
91
|
-
File.exists?(project_file).should be_true
|
92
|
-
gem_file_contents = File.read(File.dirname(__FILE__) + "/../../#{gem_file}")
|
93
|
-
project_file_contents = File.read(File.join(@active_project_folder, project_file))
|
94
|
-
project_file_contents.should == gem_file_contents
|
95
|
-
end
|
96
|
-
|
97
|
-
Then %r{^output same as contents of '(.*)'$} do |file|
|
98
|
-
expected_output = File.read(File.join(File.dirname(__FILE__) + "/../expected_outputs", file))
|
99
|
-
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@stdout}")
|
100
|
-
actual_output.should == expected_output
|
101
|
-
end
|
102
|
-
|
103
|
-
Then %r{^(does|does not) invoke generator '(.*)'$} do |does_invoke, generator|
|
104
|
-
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@stdout}")
|
105
|
-
does_invoke == "does" ?
|
106
|
-
actual_output.should(match(/dependency\s+#{generator}/)) :
|
107
|
-
actual_output.should_not(match(/dependency\s+#{generator}/))
|
108
|
-
end
|
109
|
-
|
110
|
-
Then %r{help options '(.*)' and '(.*)' are displayed} do |opt1, opt2|
|
111
|
-
actual_output = File.read(@stdout)
|
112
|
-
actual_output.should match(/#{opt1}/)
|
113
|
-
actual_output.should match(/#{opt2}/)
|
114
|
-
end
|
115
|
-
|
116
|
-
Then %r{^output (does|does not) match \/(.*)\/} do |does, regex|
|
117
|
-
actual_output = File.read(@stdout)
|
118
|
-
(does == 'does') ?
|
119
|
-
actual_output.should(match(/#{regex}/)) :
|
120
|
-
actual_output.should_not(match(/#{regex}/))
|
121
|
-
end
|
122
|
-
|
123
|
-
Then %r{^contents of file '(.*)' (does|does not) match \/(.*)\/} do |file, does, regex|
|
124
|
-
in_project_folder do
|
125
|
-
actual_output = File.read(file)
|
126
|
-
(does == 'does') ?
|
127
|
-
actual_output.should(match(/#{regex}/)) :
|
128
|
-
actual_output.should_not(match(/#{regex}/))
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
Then %r{^all (\d+) tests pass} do |expected_test_count|
|
133
|
-
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
134
|
-
actual_output = File.read(@stdout)
|
135
|
-
actual_output.should match(expected)
|
136
|
-
end
|
137
|
-
|
138
|
-
Then %r{^all (\d+) examples pass} do |expected_test_count|
|
139
|
-
expected = %r{^#{expected_test_count} examples?, 0 failures}
|
140
|
-
actual_output = File.read(@stdout)
|
141
|
-
actual_output.should match(expected)
|
142
|
-
end
|
143
|
-
|
144
|
-
Then %r{^yaml file '(.*)' contains (\{.*\})} do |file, yaml|
|
145
|
-
in_project_folder do
|
146
|
-
yaml = eval yaml
|
147
|
-
YAML.load(File.read(file)).should == yaml
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
Then %r{^Rakefile can display tasks successfully} do
|
152
|
-
@stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
|
153
|
-
FileUtils.chdir(@active_project_folder) do
|
154
|
-
system "rake -T > #{@stdout} 2> #{@stdout}"
|
155
|
-
end
|
156
|
-
actual_output = File.read(@stdout)
|
157
|
-
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
158
|
-
end
|
159
|
-
|
160
|
-
Then %r{^task 'rake (.*)' is executed successfully} do |task|
|
161
|
-
@stdout.should_not be_nil
|
162
|
-
actual_output = File.read(@stdout)
|
163
|
-
actual_output.should_not match(/^Don't know how to build task '#{task}'/)
|
164
|
-
actual_output.should_not match(/Error/i)
|
165
|
-
end
|
166
|
-
|
167
|
-
Then %r{^gem spec key '(.*)' contains \/(.*)\/} do |key, regex|
|
168
|
-
in_project_folder do
|
169
|
-
gem_file = Dir["pkg/*.gem"].first
|
170
|
-
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
171
|
-
spec_value = gem_spec.send(key.to_sym)
|
172
|
-
spec_value.to_s.should match(/#{regex}/)
|
173
|
-
end
|
174
|
-
end
|