mulang 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a3aa1dfc1754530b06598f1b95de76b9bd22233c
4
+ data.tar.gz: 0dc685a28b5fe995e2bb844dcc9c766441380fd7
5
+ SHA512:
6
+ metadata.gz: 465881582588f31e24fa3b8581b6fcc0d219b8d725415fe2564a1b22802b3c460d1674cf626ed2d704dfb12788bc29503b754a966e67cbdb243bb4e70198afce
7
+ data.tar.gz: e79c85ef775050d5d5c53b38cc3e8bb21670de4735e2756894c58801fdc62fbef492b1f28569c7b4a4c428e0a031d7e07cc357f06d8530433ba65985d08bd8ca
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "mulang"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
Binary file
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ MULANG_VERSION=`grep -e '[0-9]*\.[0-9]*\.[0-9]' lib/mulang/version.rb -o | tail -n 1`
6
+
7
+ echo "Pulling Mulang $MULANG_VERSION..."
8
+ wget https://github.com/mumuki/mulang/releases/download/v$MULANG_VERSION/mulang -O bin/mulang
9
+
10
+ chmod +x bin/mulang
11
+ echo "Mulang pulled. Placed in bin/mulang"
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ ./bin/pull_mulang.sh
@@ -0,0 +1,15 @@
1
+ require 'active_support/all'
2
+
3
+ require_relative './mulang/version'
4
+
5
+ module Mulang
6
+ def self.bin_path
7
+ File.join(__dir__, '..', 'bin', 'mulang')
8
+ end
9
+ def self.analyse(analysis)
10
+ IO.popen([bin_path, analysis.to_json]) { |f| JSON.parse f.read }
11
+ end
12
+ end
13
+
14
+ require_relative './mulang/code'
15
+ require_relative './mulang/language'
@@ -0,0 +1,24 @@
1
+ module Mulang
2
+ class Code
3
+ def initialize(language, content)
4
+ @language = language
5
+ @content = content
6
+ end
7
+
8
+ def ast
9
+ @language.ast @content
10
+ end
11
+
12
+ def sample
13
+ @language.sample @content
14
+ end
15
+
16
+ def analysis(spec)
17
+ { sample: sample, spec: spec }
18
+ end
19
+
20
+ def analyse(spec)
21
+ Mulang.analyse analysis(spec)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,43 @@
1
+ module Mulang::Language
2
+ class Native
3
+ def initialize(language)
4
+ @language = language
5
+ end
6
+
7
+ def ast(content)
8
+ Mulang.analyse(ast_analysis(content))['intermediateLanguage']
9
+ end
10
+
11
+ def ast_analysis(content)
12
+ {
13
+ sample: { tag: 'CodeSample', language: @language, content: content },
14
+ spec: { expectations: [], smellsSet: { tag: 'NoSmells' }, includeIntermediateLanguage: true }
15
+ }
16
+ end
17
+
18
+ def sample(content)
19
+ {
20
+ tag: 'CodeSample',
21
+ language: @language,
22
+ content: content
23
+ }
24
+ end
25
+ end
26
+
27
+ class External
28
+ def initialize(&tool)
29
+ @tool = block_given? ? tool : proc { |it| it }
30
+ end
31
+
32
+ def ast(content)
33
+ @tool.call(content) rescue nil
34
+ end
35
+
36
+ def sample(content)
37
+ {
38
+ tag: 'MulangSample',
39
+ ast: ast(content)
40
+ }
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,4 @@
1
+ module Mulang
2
+ VERSION = "3.3.0"
3
+ MULANG_VERSION = "3.3.0"
4
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mulang
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Franco Bulgarelli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: Gem wrapper for mulang tool
70
+ email:
71
+ - franco@mumuki.org
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - bin/console
77
+ - bin/mulang
78
+ - bin/pull_mulang.sh
79
+ - bin/setup
80
+ - lib/mulang.rb
81
+ - lib/mulang/code.rb
82
+ - lib/mulang/language.rb
83
+ - lib/mulang/version.rb
84
+ homepage: https://github.com/mumuki/mulang
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ - bin
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.5.1
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Gem wrapper for mulang tool
109
+ test_files: []