gdlc 2.5.4.0

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.
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # ft: ruby
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'gdlc/version'
6
+
7
+ file_list = Dir['.*'] + Dir['*']
8
+ file_list += Dir['bin/*']
9
+ file_list += Dir['docs/*']
10
+ file_list += Dir['lib/**/*.rb']
11
+ file_list += Dir['res/*']
12
+ file_list += Dir['spec/*']
13
+
14
+ file_list.reject! { |fn| File.directory?(fn) }
15
+
16
+ Gem::Specification.new do |gem|
17
+ gem.name = "gdlc"
18
+ gem.version = Gdlc::VERSION
19
+ gem.authors = ["Jeff McAffee"]
20
+ gem.email = ["jeff@ktechsystems.com"]
21
+ gem.description = %q{Ruby support for GDLC compiler}
22
+ gem.summary = gem.description
23
+ gem.homepage = "https://github.com/jmcaffee/gdlc"
24
+ gem.license = "GPL-3.0"
25
+
26
+ gem.files = file_list #`git ls-files`.split($/)
27
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
28
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
29
+ gem.require_paths = ["lib"]
30
+
31
+ gem.add_development_dependency 'rspec'
32
+ end
33
+
@@ -0,0 +1,6 @@
1
+ require "gdlc/version"
2
+ require "gdlc/gdlc"
3
+
4
+ module Gdlc
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,135 @@
1
+ ##############################################################################
2
+ # File:: gdlc.rb
3
+ # Purpose:: GDLC Gem
4
+ #
5
+ # Author:: Jeff McAffee 01/31/2013
6
+ # Copyright:: Copyright (c) 2013, kTech Systems LLC. All rights reserved.
7
+ # Website:: http://ktechsystems.com
8
+ ##############################################################################
9
+
10
+ module Gdlc
11
+ class GltException
12
+ end
13
+
14
+ class GDLC
15
+
16
+ GDLC_PATH = 'gdlc'
17
+ OUTDIR_PATH = "C:/temp"
18
+
19
+ # Compiler flags
20
+ @@flags = []
21
+
22
+ # Include directories
23
+ @@incdirs = []
24
+
25
+ # Path to GDLC executable
26
+ @@app_path = GDLC_PATH
27
+
28
+ ### Class methods
29
+
30
+ def GDLC.app_path
31
+ @@app_path
32
+ end
33
+
34
+ def GDLC.app_path=(apppath)
35
+ @@app_path = apppath
36
+ end
37
+
38
+ # clear all flags
39
+ #
40
+ def GDLC.clear_flags
41
+ @@flags = []
42
+ end # GDLC.clear_flags
43
+
44
+ # Add a compiler flag
45
+ #
46
+ # Duplicate flags are discarded.
47
+ #
48
+ # flg - Flag to set.
49
+ #
50
+ def GDLC.add_flag(flg)
51
+ @@flags << flg unless @@flags.include? flg
52
+ end # add_flag
53
+
54
+ # Return a string containing all flags as input parameters
55
+ #
56
+ #
57
+ # returns params - string containing all flags separated with space
58
+ #
59
+ def GDLC.get_flags
60
+ return @@flags.join " "
61
+ end # get_flags
62
+
63
+ # Return compiler include dirs array
64
+ #
65
+ def GDLC.incdirs
66
+ @@incdirs
67
+ end
68
+
69
+ # Add include dir(s)
70
+ #
71
+ # dirName - Name of directory
72
+ #
73
+ def GDLC.add_include_dirs(dirs)
74
+ if(dirs.class == Array)
75
+ dirs.each do |d|
76
+ @@incdirs << d unless @@incdirs.include? d
77
+ end
78
+ else
79
+ @@incdirs << dirs unless @@incdirs.include? dirs
80
+ end
81
+ end
82
+
83
+ # Return a string containing all include dirs as input parameters
84
+ # Formats string as '/Isome/dir/name /Isome/other/dir'
85
+ #
86
+ # returns params - Parameter string
87
+ #
88
+ def GDLC.get_include_dirs
89
+ @@incdirs
90
+ params = @@incdirs.map { |d| "--I#{d}" }
91
+ params.join ' '
92
+ end
93
+
94
+ # Clear out the include directory list
95
+ #
96
+ def GDLC.clear_include_dirs
97
+ @@incdirs.clear
98
+
99
+ end
100
+
101
+ # Compile a guideline
102
+ #
103
+ # srcfile - Name of source file to compile
104
+ # outname - Name of output file
105
+ #
106
+ def GDLC.compile(srcfile, outname)
107
+ GDLC.execute_GDLC("#{GDLC.get_flags} #{GDLC.get_include_dirs} #{srcfile} #{outname}")
108
+ end
109
+
110
+ private
111
+
112
+ # Execute GDLC application
113
+ #
114
+ # cmdLine - Command line to pass to the application
115
+ #
116
+ def GDLC.execute_GDLC(cmdLine)
117
+ app_cmd = "#{@@app_path} #{cmdLine}"
118
+ puts "Executing: #{app_cmd}"
119
+
120
+ output = `#{app_cmd}`
121
+ exitcode = $?.exitstatus
122
+
123
+ # Currently unable to retrieve exit code from java jar execution.
124
+ # May be because 'system' executes a sub-process which is executing
125
+ # the JVM which returns the exit code.
126
+ # Regardless of the JVM exit code, the sub-process returns 0.
127
+ #
128
+ # For now, we'll look for a specific message in the output and fail if
129
+ # its not found.
130
+ puts output
131
+ fail 'compile failed' unless output.include?('XML written to file')
132
+ end
133
+
134
+ end # class GDLC
135
+ end # module
@@ -0,0 +1,22 @@
1
+ ##############################################################################
2
+ # Copyright (C) 2015 Jeff McAffee
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ #
17
+
18
+ module Gdlc
19
+ VERSION = "2.5.4.0" unless constants.include?("VERSION")
20
+ APPNAME = "GDLC" unless constants.include?("APPNAME")
21
+ COPYRIGHT = "Copyright (c) 2015 Jeff McAffee. All rights reserved" unless constants.include?("COPYRIGHT")
22
+ end
Binary file
@@ -0,0 +1,3 @@
1
+ Manifest-Version: 1.0
2
+ Main-Class: runtime.main.GdlMain
3
+ Class-Path: ostermillerutils_1_07_00.jar
@@ -0,0 +1,85 @@
1
+ require "spec_helper"
2
+ require "gdlc/gdlc"
3
+
4
+ include Gdlc
5
+
6
+ describe GDLC do
7
+
8
+ before(:each) do
9
+ GDLC.clear_flags
10
+ GDLC.clear_include_dirs
11
+ end
12
+
13
+ context "add_flag" do
14
+ it "should store flag values" do
15
+ GDLC.add_flag '-v'
16
+ GDLC.get_flags.should eq "-v"
17
+ end # it "should store flag values"
18
+
19
+ it "does not store duplicate flags" do
20
+ GDLC.add_flag '-v'
21
+ GDLC.add_flag '-v'
22
+ GDLC.get_flags.should eq "-v"
23
+ end # it "does not store duplicate flags"
24
+
25
+ end
26
+
27
+ context "get_flags" do
28
+ it "returns multiple flags separated by a space" do
29
+ GDLC.add_flag '-v'
30
+ GDLC.add_flag '-vp'
31
+ GDLC.get_flags.should eq "-v -vp"
32
+ end # it "returns multiple flags separated by a space"
33
+
34
+ end # context "get_flags"
35
+
36
+ context "clear_flags" do
37
+ it "clears all flags" do
38
+ GDLC.clear_flags
39
+ GDLC.add_flag '-v'
40
+ GDLC.get_flags.should eq "-v"
41
+
42
+ GDLC.clear_flags
43
+ GDLC.get_flags.should eq ""
44
+ end # it "clears all flags"
45
+
46
+ end # context "clear_flags"
47
+
48
+ context "add_include_dirs" do
49
+ it "should store include dirs" do
50
+ GDLC.add_include_dirs '/test/include/dir'
51
+ GDLC.incdirs[0].should eq '/test/include/dir'
52
+ end # it "should store include dirs"
53
+
54
+ it "can store an array of include dirs" do
55
+ GDLC.add_include_dirs ['/test/include/dir', 'another/test/include/dir']
56
+ GDLC.incdirs.size.should eq 2
57
+ end
58
+
59
+ it "does NOT store duplicates" do
60
+ GDLC.add_include_dirs ['/test/include/dir', 'another/test/include/dir', '/test/include/dir']
61
+ GDLC.incdirs.size.should eq 2
62
+ end
63
+
64
+ end # context "add_include_dirs"
65
+
66
+ context "get_include_dirs" do
67
+ it "returns include dirs as space separated values prefixed with '/I'" do
68
+ GDLC.add_include_dirs '/test/include/dir'
69
+ GDLC.add_include_dirs 'another/test/include/dir'
70
+ GDLC.get_include_dirs.should eq '/I/test/include/dir /Ianother/test/include/dir'
71
+ end
72
+
73
+ end # context "get_include_dirs"
74
+
75
+ context "clear_include_dirs" do
76
+ it "clears all include dirs" do
77
+ GDLC.add_include_dirs '/test/include/dir'
78
+ GDLC.add_include_dirs 'another/test/include/dir'
79
+ GDLC.clear_include_dirs
80
+ GDLC.incdirs.should be_empty
81
+ end
82
+
83
+ end # context "clear_include_dirs"
84
+
85
+ end
@@ -0,0 +1,17 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gdlc
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.5.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeff McAffee
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Ruby support for GDLC compiler
28
+ email:
29
+ - jeff@ktechsystems.com
30
+ executables:
31
+ - gdlc
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - ".rspec"
37
+ - Gemfile
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - bin/gdlc
42
+ - docs/GDLC_manual.html
43
+ - docs/GDLC_manual.md
44
+ - gdlc.gemspec
45
+ - lib/gdlc.rb
46
+ - lib/gdlc/gdlc.rb
47
+ - lib/gdlc/version.rb
48
+ - res/gdlc.jar
49
+ - res/manifest.mf
50
+ - res/ostermillerutils_1_07_00.jar
51
+ - spec/gdlc_spec.rb
52
+ - spec/spec_helper.rb
53
+ homepage: https://github.com/jmcaffee/gdlc
54
+ licenses:
55
+ - GPL-3.0
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 2.3.0
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: Ruby support for GDLC compiler
77
+ test_files:
78
+ - spec/gdlc_spec.rb
79
+ - spec/spec_helper.rb