italian-ruby 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/bin/italian-rspec +9 -9
- data/lib/italian/ruby/core_ext.rb +5 -1
- data/lib/italian/ruby/core_ext/array.rb +13 -0
- data/lib/italian/ruby/core_ext/class.rb +12 -0
- data/lib/italian/ruby/core_ext/file.rb +14 -0
- data/lib/italian/ruby/core_ext/gems/fabrication.rb +12 -0
- data/lib/italian/ruby/core_ext/{hanami/interactor.rb → gems/hanami.rb} +15 -1
- data/lib/italian/ruby/core_ext/{mongoid/criteria.rb → gems/mongoid.rb} +2 -1
- data/lib/italian/ruby/core_ext/gems/rspec.rb +102 -0
- data/lib/italian/ruby/core_ext/hash.rb +3 -0
- data/lib/italian/ruby/core_ext/kernel.rb +3 -0
- data/lib/italian/ruby/core_ext/main.rb +0 -14
- data/lib/italian/ruby/core_ext/module.rb +8 -0
- data/lib/italian/ruby/core_ext/nil_class.rb +11 -0
- data/lib/italian/ruby/core_ext/object.rb +21 -5
- data/lib/italian/ruby/core_ext/string.rb +3 -1
- data/lib/italian/ruby/version.rb +1 -1
- data/vscode/italianruby.tmGrammar.json +2 -2
- metadata +10 -7
- data/lib/italian/ruby/core_ext/hanami/mongoid.rb +0 -14
- data/lib/italian/ruby/core_ext/rspec/core.rb +0 -27
- data/lib/italian/ruby/core_ext/rspec/expectations.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e13700d6b40a1bc4f9ee4d845c80af9fe4ae332f2288528e6c147635c77a2c4a
|
4
|
+
data.tar.gz: d58597618f2be747a849f21661ac214cd635c872f472573242da2793d84b1cad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42101231651471d35934bb0d82743f710d406b516d8c4bcd2f12d5fe72eac1829bcfcab4664dd01e818e485595bdb07b45921838c502263749d30e1e8f509d2c
|
7
|
+
data.tar.gz: 732f903acf2f910ed472debace2c58865144973ae5583a3de55fff7aa70f0025f07ab736df3e5261ce1e81c1408148b0b1319bd69880f2f38e9b76784c2e6ce9
|
data/bin/italian-rspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
require "rspec"
|
5
5
|
require "italian/ruby"
|
6
6
|
|
7
|
-
def translate_spec(
|
8
|
-
|
9
|
-
File.write
|
7
|
+
def translate_spec(spec_file)
|
8
|
+
translated_spec_file = "#{File.dirname spec_file}/#{File.basename(spec_file, ".ir")}.rb"
|
9
|
+
File.write translated_spec_file, Italian::Ruby::Traduttore.traduci(spec_file)
|
10
|
+
translated_spec_file
|
10
11
|
end
|
11
12
|
|
12
|
-
def destroy_spec(
|
13
|
-
|
14
|
-
File.delete spec_file if File.exist? spec_file
|
13
|
+
def destroy_spec(translated_spec_file)
|
14
|
+
File.delete translated_spec_file if File.exist? translated_spec_file
|
15
15
|
end
|
16
16
|
|
17
17
|
if ARGV[0].nil?
|
@@ -24,6 +24,6 @@ else
|
|
24
24
|
spec_files = ARGV
|
25
25
|
end
|
26
26
|
|
27
|
-
spec_files.
|
28
|
-
RSpec::Core::Runner.run(
|
29
|
-
|
27
|
+
translated_spec_files = spec_files.map { |file| translate_spec file }
|
28
|
+
RSpec::Core::Runner.run(translated_spec_files, STDIN, STDOUT)
|
29
|
+
translated_spec_files.each { |file| destroy_spec file }
|
@@ -3,8 +3,12 @@
|
|
3
3
|
original_verbosity = $VERBOSE
|
4
4
|
$VERBOSE = nil
|
5
5
|
|
6
|
-
require_relative "core_ext/kernel"
|
7
6
|
require_relative "core_ext/main"
|
7
|
+
require_relative "core_ext/class"
|
8
|
+
require_relative "core_ext/module"
|
9
|
+
require_relative "core_ext/file"
|
10
|
+
require_relative "core_ext/kernel"
|
11
|
+
require_relative "core_ext/nil_class"
|
8
12
|
require_relative "core_ext/object"
|
9
13
|
require_relative "core_ext/array"
|
10
14
|
require_relative "core_ext/hash"
|
@@ -14,6 +14,19 @@ class Array
|
|
14
14
|
alias :prima :first
|
15
15
|
alias :ultimo :last
|
16
16
|
alias :ultima :last
|
17
|
+
alias :uno_a_caso :sample
|
18
|
+
alias :una_a_caso :sample
|
19
|
+
alias :prendine_a_caso :sample
|
20
|
+
alias :unisci :join
|
21
|
+
alias :appiattisci :flatten
|
22
|
+
alias :compatta :compact
|
23
|
+
alias :conteggio :count
|
24
|
+
alias :tutti? :all?
|
25
|
+
alias :tutte? :all?
|
26
|
+
alias :alcuni? :any?
|
27
|
+
alias :alcune? :any?
|
28
|
+
alias :nessuno? :none?
|
29
|
+
alias :nessuna? :none?
|
17
30
|
|
18
31
|
def esiste?
|
19
32
|
!nil? && !empty?
|
@@ -1,7 +1,9 @@
|
|
1
1
|
##
|
2
|
-
# Core Ext - Hanami
|
2
|
+
# Core Ext - Hanami
|
3
3
|
|
4
4
|
module Hanami
|
5
|
+
##
|
6
|
+
# Interactor
|
5
7
|
module Interactor
|
6
8
|
alias :fallisci! :error!
|
7
9
|
alias :errore! :error!
|
@@ -47,4 +49,16 @@ module Hanami
|
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Mongoid - Repository
|
55
|
+
module Mongoid
|
56
|
+
class Repository
|
57
|
+
|
58
|
+
def tutti(*args, &block)
|
59
|
+
all *args, &block
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
50
64
|
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
##
|
2
|
+
# Core Ext - Rspec
|
3
|
+
|
4
|
+
module RSpec
|
5
|
+
def self.descrivi(*args, &block)
|
6
|
+
describe *args, &block
|
7
|
+
end
|
8
|
+
|
9
|
+
##
|
10
|
+
# Core
|
11
|
+
module Core
|
12
|
+
class ExampleGroup
|
13
|
+
alias :classe_descritta :described_class
|
14
|
+
define_example_group_method :contesto
|
15
|
+
end
|
16
|
+
|
17
|
+
module Hooks
|
18
|
+
alias :prima :before
|
19
|
+
alias :dopo :after
|
20
|
+
end
|
21
|
+
|
22
|
+
module MemoizedHelpers
|
23
|
+
module ClassMethods
|
24
|
+
alias :sia :let
|
25
|
+
alias :sia! :let!
|
26
|
+
alias :soggetto :subject
|
27
|
+
alias :soggetto! :subject!
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Expectations
|
34
|
+
module Expectations
|
35
|
+
class ExpectationTarget
|
36
|
+
module InstanceMethods
|
37
|
+
def che(*args, &block)
|
38
|
+
to *args, &block
|
39
|
+
end
|
40
|
+
|
41
|
+
def che_non(*args, &block)
|
42
|
+
not_to *args, &block
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Mocks
|
50
|
+
module Mocks
|
51
|
+
module ExampleMethods
|
52
|
+
alias :imita :instance_double
|
53
|
+
alias :imita_classe :class_double
|
54
|
+
end
|
55
|
+
|
56
|
+
class TargetBase
|
57
|
+
def che(*args)
|
58
|
+
to *args
|
59
|
+
end
|
60
|
+
def che_non(*args)
|
61
|
+
not_to *args
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def matcher_allowed?(matcher)
|
67
|
+
matcher.class.name.start_with?("RSpec::Mocks::Matchers".freeze) or
|
68
|
+
matcher.class.name.start_with?("RSpec::Matchers::AliasedMatcher".freeze)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class MessageExpectation
|
73
|
+
alias :e_ritorni :and_return
|
74
|
+
end
|
75
|
+
|
76
|
+
class VerifyingMessageExpectation
|
77
|
+
alias :con :with
|
78
|
+
end
|
79
|
+
|
80
|
+
module Matchers
|
81
|
+
class Receive
|
82
|
+
alias :con :with
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
RSpec.configure do |config|
|
89
|
+
RSpec::Matchers.alias_matcher :sia, :be
|
90
|
+
RSpec::Matchers.alias_matcher :equivalga_a, :eq
|
91
|
+
RSpec::Matchers.alias_matcher :alzi_errore, :raise_error
|
92
|
+
RSpec::Matchers.alias_matcher :riceva, :receive
|
93
|
+
RSpec::Matchers.alias_matcher :abbia_ricevuto, :have_received
|
94
|
+
|
95
|
+
config.alias_example_to :esso
|
96
|
+
config.alias_example_to :essa
|
97
|
+
|
98
|
+
config.before :each do
|
99
|
+
alias :verifica :expect
|
100
|
+
alias :consenti :allow
|
101
|
+
end
|
102
|
+
end
|
@@ -12,7 +12,10 @@ class Hash
|
|
12
12
|
alias :mappa :map
|
13
13
|
alias :vuoto? :empty?
|
14
14
|
alias :vuota? :empty?
|
15
|
+
alias :ha_chiave? :has_key?
|
15
16
|
alias :ottieni :fetch
|
17
|
+
alias :prendi :fetch
|
18
|
+
alias :deposita :store
|
16
19
|
alias :scava :dig
|
17
20
|
alias :trasforma_chiavi :transform_keys
|
18
21
|
alias :trasforma_valori :transform_values
|
@@ -9,6 +9,9 @@
|
|
9
9
|
# scritti in Italian Ruby che in file sorgenti scritti in Ruby standard.
|
10
10
|
|
11
11
|
module Kernel
|
12
|
+
alias :classe :class
|
13
|
+
alias :ottieni_variabile_istanza :instance_variable_get
|
14
|
+
alias :imposta_variabile_istanza :instance_variable_set
|
12
15
|
|
13
16
|
def richiedi(name)
|
14
17
|
file_to_require = $:.map { |dir| Dir["#{dir}/**/#{name}.ir"] }.flatten.compact.first
|
@@ -17,23 +17,9 @@ def estendi(*args)
|
|
17
17
|
extend *args
|
18
18
|
end
|
19
19
|
|
20
|
-
def privati(*args)
|
21
|
-
private
|
22
|
-
end
|
23
|
-
def protetti(*args)
|
24
|
-
protected
|
25
|
-
end
|
26
|
-
def pubblici(*args)
|
27
|
-
public
|
28
|
-
end
|
29
|
-
|
30
20
|
def alza(*args)
|
31
21
|
raise *args
|
32
22
|
end
|
33
23
|
def fallisci(*args)
|
34
24
|
fail *args
|
35
|
-
end
|
36
|
-
|
37
|
-
def non_in?(*args)
|
38
|
-
!in? *args
|
39
25
|
end
|
@@ -5,25 +5,41 @@
|
|
5
5
|
|
6
6
|
class Object
|
7
7
|
class << self
|
8
|
-
|
9
|
-
|
8
|
+
alias :nuovo :new
|
9
|
+
alias :nuova :new
|
10
10
|
end
|
11
11
|
|
12
12
|
alias :nullo? :nil?
|
13
13
|
alias :nulla? :nil?
|
14
14
|
alias :risponde_a? :respond_to?
|
15
|
+
alias :manda :send
|
16
|
+
alias :ispeziona :inspect
|
15
17
|
|
16
18
|
def esiste?
|
17
19
|
!nil?
|
18
20
|
end
|
19
21
|
|
22
|
+
def non_risponde_a?(method)
|
23
|
+
!respond_to? method
|
24
|
+
end
|
25
|
+
|
26
|
+
def in?(array)
|
27
|
+
raise ArgumentError.new("Argument passed to `in?` must respond to `include?`") unless
|
28
|
+
array.respond_to? :include?
|
29
|
+
array.include? self
|
30
|
+
end
|
31
|
+
|
32
|
+
def non_in?(array)
|
33
|
+
!in? array
|
34
|
+
end
|
35
|
+
|
20
36
|
private
|
21
37
|
|
22
|
-
def inizializzatore(*args, &block)
|
38
|
+
def inizializzatore(*args, **options, &block)
|
23
39
|
end
|
24
40
|
|
25
|
-
def initialize(*args, &block)
|
26
|
-
inizializzatore *args, &block
|
41
|
+
def initialize(*args, **options, &block)
|
42
|
+
inizializzatore *args, **options, &block
|
27
43
|
end
|
28
44
|
|
29
45
|
end
|
data/lib/italian/ruby/version.rb
CHANGED
@@ -293,7 +293,7 @@
|
|
293
293
|
},
|
294
294
|
{
|
295
295
|
"comment": " everything being a method but having a special function is a..",
|
296
|
-
"match": "\\b(inizializzatore|nuovo|nuova|cicla|includi|estendi|preponi|fallisci|alza|attr_reader|attr_writer|attr_accessor|attr|catch|throw|privati|private_class_method|module_function|pubblici|public_class_method|protetti|refine|using)\\b(?![?!])",
|
296
|
+
"match": "\\b(inizializzatore|nuovo|nuova|cicla|includi|estendi|preponi|fallisci|alza|accessore|accessore_di_classe|attr_reader|attr_writer|attr_accessor|attr|catch|throw|privati|private_class_method|module_function|pubblici|public_class_method|protetti|refine|using)\\b(?![?!])",
|
297
297
|
"name": "keyword.other.special-method.ruby"
|
298
298
|
},
|
299
299
|
{
|
@@ -313,7 +313,7 @@
|
|
313
313
|
"name": "variable.language.self.ruby"
|
314
314
|
},
|
315
315
|
{
|
316
|
-
"begin": "\\b(?<!\\.|::)(require|require_relative|richiedi|richiedi_relativo)\\b",
|
316
|
+
"begin": "\\b(?<!\\.|::)(require|require_relative|richiedi|richiedi_relativo|richiedi_tutti)\\b",
|
317
317
|
"captures": {
|
318
318
|
"1": {
|
319
319
|
"name": "keyword.other.special-method.ruby"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: italian-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Ballardin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2ruby
|
@@ -88,15 +88,18 @@ files:
|
|
88
88
|
- lib/italian/ruby.rb
|
89
89
|
- lib/italian/ruby/core_ext.rb
|
90
90
|
- lib/italian/ruby/core_ext/array.rb
|
91
|
-
- lib/italian/ruby/core_ext/
|
92
|
-
- lib/italian/ruby/core_ext/
|
91
|
+
- lib/italian/ruby/core_ext/class.rb
|
92
|
+
- lib/italian/ruby/core_ext/file.rb
|
93
|
+
- lib/italian/ruby/core_ext/gems/fabrication.rb
|
94
|
+
- lib/italian/ruby/core_ext/gems/hanami.rb
|
95
|
+
- lib/italian/ruby/core_ext/gems/mongoid.rb
|
96
|
+
- lib/italian/ruby/core_ext/gems/rspec.rb
|
93
97
|
- lib/italian/ruby/core_ext/hash.rb
|
94
98
|
- lib/italian/ruby/core_ext/kernel.rb
|
95
99
|
- lib/italian/ruby/core_ext/main.rb
|
96
|
-
- lib/italian/ruby/core_ext/
|
100
|
+
- lib/italian/ruby/core_ext/module.rb
|
101
|
+
- lib/italian/ruby/core_ext/nil_class.rb
|
97
102
|
- lib/italian/ruby/core_ext/object.rb
|
98
|
-
- lib/italian/ruby/core_ext/rspec/core.rb
|
99
|
-
- lib/italian/ruby/core_ext/rspec/expectations.rb
|
100
103
|
- lib/italian/ruby/core_ext/string.rb
|
101
104
|
- lib/italian/ruby/richiedi_test.ir
|
102
105
|
- lib/italian/ruby/ruby_parser_patches.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Core Ext - Rspec Core
|
3
|
-
|
4
|
-
module RSpec
|
5
|
-
def self.descrivi(*args, &block)
|
6
|
-
describe *args, &block
|
7
|
-
end
|
8
|
-
|
9
|
-
module Core
|
10
|
-
module Hooks
|
11
|
-
alias_method :prima, :before
|
12
|
-
alias_method :dopo, :after
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
RSpec.configure do |config|
|
18
|
-
RSpec::Matchers.alias_matcher :sia, :be
|
19
|
-
RSpec::Matchers.alias_matcher :equivalga_a, :eq
|
20
|
-
|
21
|
-
config.alias_example_to :esso
|
22
|
-
config.alias_example_to :essa
|
23
|
-
|
24
|
-
config.before :each do
|
25
|
-
alias :verifica :expect
|
26
|
-
end
|
27
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Core Ext - Rspec Expectations
|
3
|
-
|
4
|
-
module RSpec
|
5
|
-
module Expectations
|
6
|
-
class ExpectationTarget
|
7
|
-
module InstanceMethods
|
8
|
-
def che(*args, &block)
|
9
|
-
to *args, &block
|
10
|
-
end
|
11
|
-
|
12
|
-
def che_non(*args, &block)
|
13
|
-
not_to *args, &block
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|