machine_setup 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -3
- data/VERSION +1 -1
- data/bin/setup_config_gen +11 -5
- data/bin/setup_init_dsl +10 -4
- data/examples/ssm/ssm.setup.param +12 -36
- data/examples/ssm/ssm.setup.param.de.yml +69 -27
- data/examples/ssm/ssm.setup.param.en.yml +64 -13
- data/examples/underleaver/underleaver.setup.param +5 -4
- data/examples/underleaver/underleaver.setup.param.de.yml +8 -8
- data/lib/setup_configuration/generator_module.rb +84 -0
- data/lib/setup_configuration/legacy/importer.rb +3 -3
- data/lib/setup_configuration/mps_template_binding.rb +58 -0
- data/lib/setup_configuration/parameter_template_binding.rb +71 -0
- data/lib/setup_configuration/setup_code_binding.rb +40 -0
- data/lib/setup_configuration/setup_code_generator.rb +24 -0
- data/lib/setup_configuration/setup_config.rb +37 -4
- data/lib/setup_configuration/suite_generator.rb +29 -311
- data/lib/setup_configuration/template_binding.rb +28 -0
- data/lib/setup_configuration/templates/english.lng.erb +2 -2
- data/lib/setup_configuration/translation.rb +40 -27
- data/lib/setup_configuration.rb +6 -3
- data/test/setup_configuration/parameter_factory_test.rb +27 -0
- metadata +13 -7
@@ -1,42 +1,55 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
module SetupConfiguration
|
3
|
+
module SetupConfiguration
|
4
4
|
|
5
|
-
|
5
|
+
module Translation
|
6
6
|
|
7
|
-
|
8
|
-
languages.collect{ |lang| "#{config_name}.#{FILE_EXTENSION}.#{lang}.yml"}
|
9
|
-
end
|
7
|
+
FILE_EXTENSION="setup.param".freeze
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
9
|
+
def self.translation_files(config_name)
|
10
|
+
languages.collect { |lang| "#{config_name}.#{FILE_EXTENSION}.#{lang}.yml" }
|
11
|
+
end
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
# Returns all supported setup languages.
|
14
|
+
def self.languages()
|
15
|
+
language_defs().keys()
|
16
|
+
end
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
def self.language_name(lang)
|
19
|
+
language_defs()[lang]
|
20
|
+
end
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
def self.language_abbreviation(lang_name)
|
23
|
+
language_defs.invert()[lang_name.downcase]
|
24
|
+
end
|
27
25
|
|
28
|
-
|
26
|
+
def self.language_names()
|
27
|
+
language_defs.values.sort
|
28
|
+
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
:private
|
31
|
+
|
32
|
+
def self.language_defs()
|
33
|
+
{:de => "deutsch", :en => "english"}
|
33
34
|
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
class Translator
|
37
|
+
|
38
|
+
NAME = :name.freeze
|
39
|
+
COMMENT = :comment.freeze
|
40
|
+
|
41
|
+
# Adds a file with translations.
|
42
|
+
def self.i18n_load_path(path)
|
43
|
+
I18n.load_path << path
|
44
|
+
end
|
45
|
+
|
46
|
+
# Returns name and description for the given parameter in the given language.
|
47
|
+
def translate(key, language)
|
48
|
+
name=I18n.translate(NAME, :scope => key, :default => key.to_s, :locale => language)
|
49
|
+
description=I18n.translate(COMMENT, :scope => key, :default => "", :locale => language)
|
50
|
+
[name, description]
|
51
|
+
end
|
52
|
+
|
40
53
|
end
|
41
54
|
|
42
55
|
end
|
data/lib/setup_configuration.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
module SetupConfiguration
|
4
|
-
end
|
5
|
-
|
6
3
|
def SetupConfiguration(name, abbreviation=name, &block)
|
7
4
|
suite=SetupConfiguration::Suite.instance
|
8
5
|
suite.name=name
|
@@ -20,6 +17,12 @@ require 'fileutils'
|
|
20
17
|
require 'i18n'
|
21
18
|
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/core_ext')
|
22
19
|
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/parameter_machinetype_bridge')
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/generator_module')
|
21
|
+
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/template_binding')
|
22
|
+
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/parameter_template_binding')
|
23
|
+
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/mps_template_binding')
|
24
|
+
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/setup_code_generator')
|
25
|
+
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/setup_code_binding')
|
23
26
|
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/setup_config')
|
24
27
|
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/suite_generator')
|
25
28
|
require File.expand_path(File.dirname(__FILE__) + '/setup_configuration/translation')
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require File.dirname(__FILE__) + "/../test_helper"
|
3
|
+
module SetupConfiguration
|
4
|
+
|
5
|
+
class ParameterFactoryTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "A ParameterFactory" do
|
8
|
+
|
9
|
+
setup do
|
10
|
+
@creator = ParameterFactory.new()
|
11
|
+
end
|
12
|
+
|
13
|
+
should "define a method 'drive'" do
|
14
|
+
assert_not_nil @creator.public_methods.delete("drive")
|
15
|
+
end
|
16
|
+
|
17
|
+
should "define a method 'param'" do
|
18
|
+
assert_not_nil @creator.public_methods.delete("param")
|
19
|
+
end
|
20
|
+
|
21
|
+
should "define a method 'param_ref'" do
|
22
|
+
assert_not_nil @creator.public_methods.delete("param_ref")
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: machine_setup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- robi-wan
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable: setup_config_gen
|
13
|
+
date: 2011-04-13 00:00:00 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: i18n
|
@@ -32,7 +31,7 @@ dependencies:
|
|
32
31
|
requirements:
|
33
32
|
- - ~>
|
34
33
|
- !ruby/object:Gem::Version
|
35
|
-
version: "0.
|
34
|
+
version: "0.4"
|
36
35
|
type: :runtime
|
37
36
|
version_requirements: *id002
|
38
37
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +42,7 @@ dependencies:
|
|
43
42
|
requirements:
|
44
43
|
- - ~>
|
45
44
|
- !ruby/object:Gem::Version
|
46
|
-
version: "2.
|
45
|
+
version: "2.7"
|
47
46
|
type: :runtime
|
48
47
|
version_requirements: *id003
|
49
48
|
- !ruby/object:Gem::Dependency
|
@@ -88,6 +87,7 @@ files:
|
|
88
87
|
- lib/setup_configuration/core_ext.rb
|
89
88
|
- lib/setup_configuration/core_ext/array.rb
|
90
89
|
- lib/setup_configuration/core_ext/array/grouping.rb
|
90
|
+
- lib/setup_configuration/generator_module.rb
|
91
91
|
- lib/setup_configuration/legacy/category.rb
|
92
92
|
- lib/setup_configuration/legacy/importer.rb
|
93
93
|
- lib/setup_configuration/legacy/language_context.rb
|
@@ -95,19 +95,24 @@ files:
|
|
95
95
|
- lib/setup_configuration/legacy/parameter.rb
|
96
96
|
- lib/setup_configuration/legacy/templates/setup.param.erb
|
97
97
|
- lib/setup_configuration/legacy/templates/setup.param.language.yml.erb
|
98
|
+
- lib/setup_configuration/mps_template_binding.rb
|
98
99
|
- lib/setup_configuration/parameter_machinetype_bridge.rb
|
100
|
+
- lib/setup_configuration/parameter_template_binding.rb
|
101
|
+
- lib/setup_configuration/setup_code_binding.rb
|
102
|
+
- lib/setup_configuration/setup_code_generator.rb
|
99
103
|
- lib/setup_configuration/setup_config.rb
|
100
104
|
- lib/setup_configuration/suite_generator.rb
|
105
|
+
- lib/setup_configuration/template_binding.rb
|
101
106
|
- lib/setup_configuration/templates/deutsch.lng.erb
|
102
107
|
- lib/setup_configuration/templates/english.lng.erb
|
103
108
|
- lib/setup_configuration/templates/logcodesetup.exp.erb
|
104
109
|
- lib/setup_configuration/templates/mps3.ini.erb
|
105
110
|
- lib/setup_configuration/translation.rb
|
106
111
|
- test/setup_configuration/machine_type_test.rb
|
112
|
+
- test/setup_configuration/parameter_factory_test.rb
|
107
113
|
- test/setup_configuration/parameter_test.rb
|
108
114
|
- test/setup_configuration/setup_configuration_test.rb
|
109
115
|
- test/test_helper.rb
|
110
|
-
has_rdoc: true
|
111
116
|
homepage: http://github.com/robi-wan/machine_setup
|
112
117
|
licenses: []
|
113
118
|
|
@@ -131,12 +136,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
136
|
requirements: []
|
132
137
|
|
133
138
|
rubyforge_project:
|
134
|
-
rubygems_version: 1.
|
139
|
+
rubygems_version: 1.7.2
|
135
140
|
signing_key:
|
136
141
|
specification_version: 3
|
137
142
|
summary: Generating configuration for machine setup parameters.
|
138
143
|
test_files:
|
139
144
|
- test/setup_configuration/machine_type_test.rb
|
145
|
+
- test/setup_configuration/parameter_factory_test.rb
|
140
146
|
- test/setup_configuration/parameter_test.rb
|
141
147
|
- test/setup_configuration/setup_configuration_test.rb
|
142
148
|
- test/test_helper.rb
|