codemodels-properties 0.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8bcb887a06f6bbd52e3aa497078e03fa5af754d0
4
+ data.tar.gz: 75a21209f8386fa110f0e8547ae74732c88b5d58
5
+ SHA512:
6
+ metadata.gz: 49f1266a7e246081c35e8fc32e0300436a2289a8af95627e8471b8c9e326fa66c06fd2b8ab3891152a95237176bfa704ab920f7eb0d0aea25e01a056e57ebed5
7
+ data.tar.gz: 2ce53180802fcaae9db5ff32ca6146d2cd5b5887f3e597777d2e700198e331d65983e97a94fc3a78cae300c152577428c3b071935181410af36108f8c02a66d5
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
19
+
20
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 ftomassetti
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ codemodels-properties
2
+ =====================
3
+
4
+ Plugin to support properties files in CodeModels.
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'rake/testtask'
2
+ require 'rubygems/tasks'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ end
7
+
8
+ Gem::Tasks.new do |tasks|
9
+ tasks.console.command = 'jruby'
10
+ end
11
+
12
+ desc "Run tests"
13
+ task :default => :test
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'codemodels/properties/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.platform = 'java'
8
+ s.name = 'codemodels-properties'
9
+ s.version = CodeModels::Properties::VERSION
10
+ s.summary = "CodeModels plugin for properties files."
11
+ s.description = "CodeModels plugin for properties files."
12
+ s.authors = ["Federico Tomassetti"]
13
+ s.email = 'f.tomassetti@gmail.com'
14
+ s.homepage = 'https://github.com/ftomassetti/codemodels-properties'
15
+ s.license = "APACHE 2"
16
+
17
+ s.files = `git ls-files`.split($/)
18
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency('codemodels')
23
+
24
+ s.add_development_dependency "bundler", "~> 1.3"
25
+ s.add_development_dependency "rake"
26
+ s.add_development_dependency "rubygems-tasks"
27
+ s.add_development_dependency "simplecov"
28
+ end
@@ -0,0 +1,4 @@
1
+ require 'codemodels/properties/version'
2
+ require 'codemodels/properties/metamodel'
3
+ require 'codemodels/properties/parser'
4
+ require 'codemodels/properties/language'
@@ -0,0 +1,17 @@
1
+ require 'codemodels'
2
+
3
+ module CodeModels
4
+ module Properties
5
+
6
+ class PropertiesLanguage < Language
7
+ def initialize
8
+ super('Properties')
9
+ @extensions << 'properties'
10
+ @parser = CodeModels::Properties::Parser.new
11
+ end
12
+ end
13
+
14
+ CodeModels.register_language PropertiesLanguage.new
15
+
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ require 'codemodels'
2
+
3
+ module CodeModels
4
+ module Properties
5
+
6
+ class PropertiesAstNode < CodeModels::CodeModelsAstNode
7
+ end
8
+
9
+ class Property < PropertiesAstNode
10
+ has_attr 'name', String
11
+ has_attr 'value', String
12
+ end
13
+
14
+ class PropertiesFile < PropertiesAstNode
15
+ contains_many_uni 'properties', Property
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ require 'codemodels'
2
+
3
+ module CodeModels
4
+ module Properties
5
+
6
+ class Parser < CodeModels::Parser
7
+
8
+ def internal_parse_artifact(artifact)
9
+ code = artifact.code
10
+ node = PropertiesFile.new
11
+ artifact.code.lines.map(&:chomp).each do |l|
12
+ name,value = l.split(':')
13
+ child_node = Property.new
14
+ child_node.name = name
15
+ child_node.value = value
16
+ node.addProperties(child_node)
17
+ end
18
+ node
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: UTF-8
2
+ module CodeModels
3
+ module Properties
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
@@ -0,0 +1,2 @@
1
+ a: ciao
2
+ b:mondo
@@ -0,0 +1,28 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_filter "/test/"
4
+ end
5
+
6
+ require 'codemodels/properties'
7
+ require 'test/unit'
8
+
9
+ include CodeModels
10
+
11
+ module TestHelper
12
+
13
+ def assert_class(expected_class,node)
14
+ assert node.class==expected_class, "Node expected to have class #{expected_class} instead it has class #{node.class}"
15
+ end
16
+
17
+ def relative_path(path)
18
+ File.join(File.dirname(__FILE__),path)
19
+ end
20
+
21
+ def read_test_data(filename)
22
+ dir = File.dirname(__FILE__)
23
+ dir = File.join(dir,'data')
24
+ path = File.join(dir,filename)
25
+ IO.read(path)
26
+ end
27
+
28
+ end
@@ -0,0 +1,26 @@
1
+ require "test_helper"
2
+
3
+ class TestParsing < Test::Unit::TestCase
4
+
5
+ include TestHelper
6
+ include CodeModels::Properties
7
+
8
+ def setup
9
+ @dir = File.dirname(__FILE__)+'/data'
10
+ @example1 = CodeModels.parse_file(@dir+'/example1.properties')
11
+ end
12
+
13
+ def test_basic
14
+ assert_class PropertiesFile, @example1
15
+ assert_equal 2, @example1.properties.count
16
+
17
+ assert_class Property, @example1.properties[0]
18
+ assert_equal 'a', @example1.properties[0].name
19
+ assert_equal ' ciao', @example1.properties[0].value
20
+
21
+ assert_class Property, @example1.properties[1]
22
+ assert_equal 'b', @example1.properties[1].name
23
+ assert_equal 'mondo', @example1.properties[1].value
24
+ end
25
+
26
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: codemodels-properties
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: java
6
+ authors:
7
+ - Federico Tomassetti
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: codemodels
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
25
+ prerelease: false
26
+ type: :runtime
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '1.3'
39
+ prerelease: false
40
+ type: :development
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubygems-tasks
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ prerelease: false
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ prerelease: false
82
+ type: :development
83
+ description: CodeModels plugin for properties files.
84
+ email: f.tomassetti@gmail.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - .gitignore
90
+ - Gemfile
91
+ - LICENSE
92
+ - README.md
93
+ - Rakefile
94
+ - codemodels-properties.gemspec
95
+ - lib/codemodels/properties.rb
96
+ - lib/codemodels/properties/language.rb
97
+ - lib/codemodels/properties/metamodel.rb
98
+ - lib/codemodels/properties/parser.rb
99
+ - lib/codemodels/properties/version.rb
100
+ - test/data/example1.properties
101
+ - test/test_helper.rb
102
+ - test/test_parsing.rb
103
+ homepage: https://github.com/ftomassetti/codemodels-properties
104
+ licenses:
105
+ - APACHE 2
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.2.0
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: CodeModels plugin for properties files.
127
+ test_files:
128
+ - test/data/example1.properties
129
+ - test/test_helper.rb
130
+ - test/test_parsing.rb