dietary_dsl 0.1.2

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: 651b234879ecc76f0c70595a4afdf213395a9f98
4
+ data.tar.gz: 9c81ff86c69d62073a0b7740b7b779fdbd405e56
5
+ SHA512:
6
+ metadata.gz: bf6269b03deab7b95b91de36d253452c0b245765deedd2c40e2a0c7c5ed58beaf6470e7030f6f4f1c5bdeb6ad7eef4d6c89671445dc11f4dab0a9e59398a0230
7
+ data.tar.gz: 14866e3d9c0eea790d71c4d2a20165e2c3e01a14607d50e70a26fe99df1c5ffc836c5bb2b1a21a04ceb6017785ed4b7ff9bae285b4afcabf67d54300fcd7b51f
data/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ [*]
2
+ end_of_line = lf
3
+ insert_final_newline = true
4
+ trim_trailing_whitespace = true
5
+ indent_style = space
6
+ indent_size = 2
7
+
8
+ [*.md]
9
+ indent_size = 4
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+ .rubocop-https*
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,35 @@
1
+ image: "ruby:2.3"
2
+
3
+ cache:
4
+ paths:
5
+ - vendor/ruby
6
+
7
+ before_script:
8
+ - ruby -v
9
+ - gem install bundler --no-ri --no-rdoc
10
+ - bundle install -j $(nproc) --path vendor
11
+
12
+ rubocop:
13
+ script:
14
+ - rake rubocop
15
+
16
+ rspec:
17
+ script:
18
+ - rspec spec
19
+ artifacts:
20
+ paths:
21
+ - coverage
22
+
23
+ pages:
24
+ stage: deploy
25
+ dependencies:
26
+ - rspec
27
+ script:
28
+ - mkdir public
29
+ - mv coverage/ public/coverage
30
+ artifacts:
31
+ paths:
32
+ - public
33
+ expire_in: 30 days
34
+ only:
35
+ - master
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,24 @@
1
+ AllCops:
2
+ Exclude:
3
+ - Gemfile
4
+ - vendor/**/*
5
+ - concept/**/*
6
+
7
+ TargetRubyVersion: 2.3
8
+
9
+ Metrics/BlockLength:
10
+ Exclude:
11
+ - dietary_dsl.gemspec
12
+ - Guardfile
13
+ - spec/**/*
14
+
15
+ Metrics/LineLength:
16
+ Exclude:
17
+ - dietary_dsl.gemspec
18
+ Max: 120
19
+
20
+ Style/EndOfLine:
21
+ EnforcedStyle: lf
22
+
23
+ Style/AsciiComments:
24
+ Enabled: false
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at danielramosacosta@hotmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dietary_dsl.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ notification :notifu if Gem.win_platform?
4
+
5
+ guard :rspec, cmd: 'bundle exec rspec' do
6
+ require 'guard/rspec/dsl'
7
+ dsl = Guard::RSpec::Dsl.new(self)
8
+
9
+ rspec = dsl.rspec
10
+ watch(rspec.spec_helper) { rspec.spec_dir }
11
+ watch(rspec.spec_support) { rspec.spec_dir }
12
+ watch(rspec.spec_files)
13
+
14
+ ruby = dsl.ruby
15
+ dsl.watch_spec_files_for(ruby.lib_files)
16
+ watch(%r{^lib/(.+)\.rb}) do |m|
17
+ spec = File.join(__dir__, "spec/#{m[1]}_spec.rb")
18
+ # Si no encontramos el fichero, ejecutamos el directorio superior completo
19
+
20
+ puts "[WARNING] No existe #{spec}" unless File.exist?(spec)
21
+ File.exist?(spec) ? spec : File.dirname(spec)
22
+ end
23
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Daniel Ramos
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # DietaryDsl
2
+
3
+ [![Build status](https://gitlab.com/DanielRamosAcosta/dietary_dsl/badges/master/build.svg)](httpshttps://gitlab.com/DanielRamosAcosta/dietary_dsl/pipelines)
4
+ [![Overall test coverage](https://gitlab.com/DanielRamosAcosta/dietary_dsl/badges/master/coverage.svg)](http://danielramosacosta.gitlab.io/dietary_dsl/coverage)
5
+
6
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dietary_dsl`. To experiment with that code, run `bin/console` for an interactive prompt.
7
+
8
+ TODO: Delete this and the text above, and describe your gem
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'dietary_dsl'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install dietary_dsl
25
+
26
+ ## Usage
27
+
28
+ TODO: Write usage instructions here
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dietary_dsl. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
39
+
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
44
+
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'guard'
6
+ require 'guard/commander'
7
+ require 'rubocop/rake_task'
8
+ require 'rb-notifu'
9
+
10
+ RuboCop::RakeTask.new
11
+ RSpec::Core::RakeTask.new(:spec)
12
+
13
+ task default: :spec
14
+
15
+ namespace :spec do
16
+ desc 'Observa los ficheros de la gema y ejecuta sus tests correspondientes'
17
+ task :watch do
18
+ Guard.start
19
+ end
20
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'dietary_dsl'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -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
+ # Do any other automated setup that you need to do here
data/concept/clases.rb ADDED
@@ -0,0 +1,35 @@
1
+ class Week
2
+ def initialize(&block)
3
+ instance_eval &block
4
+ end
5
+
6
+ def lunes(day); end
7
+
8
+ def martes(day); end
9
+
10
+ def miercoles(day); end
11
+
12
+ def jueves(day); end
13
+
14
+ def viernes(day); end
15
+ end
16
+
17
+ class Day
18
+ def initialize(&block)
19
+ instance_eval &block
20
+ end
21
+
22
+ def desayuno(day); end
23
+
24
+ def almuerzo(day); end
25
+
26
+ def cena(day); end
27
+ end
28
+
29
+ class Menu
30
+ def initialize(&block)
31
+ instance_eval &block
32
+ end
33
+
34
+ def plato(day); end
35
+ end
@@ -0,0 +1,116 @@
1
+ require_relative './clases'
2
+
3
+ pan = Plato.new('Pan') do
4
+ alimento food: 'Harina de trigo', cantidad: 300.g
5
+ alimento food: 'Sal', cantidad: 1.cucharada
6
+ end
7
+
8
+ pulpo = Plato.new('Pulpo a la gallega') do
9
+ alimento food: 'Pulpo', cantidad: 300.g
10
+ alimento food: 'Aceite', cantidad: 1.dl
11
+ alimento food: 'Pimentón', cantidad: 1.cucharada
12
+ end
13
+
14
+ macedonia = Plato.new('Macedonia') do
15
+ alimento food: 'Manzana', cantidad: 20.g
16
+ alimento food: 'Pera', cantidad: 30.g
17
+ alimento food: 'Naranja', cantidad: 1
18
+ end
19
+
20
+ leche = Plato.new('Leche') do
21
+ alimento food: 'Leche', cantidad: 1.vaso
22
+ end
23
+
24
+ menu_uno = Menu.new('Leche y pan') do
25
+ plato leche
26
+ plato pan
27
+ end
28
+
29
+ menu_dos = Menu.new('Leche y pan') do
30
+ plato leche
31
+ plato pan
32
+ end
33
+
34
+ almuerzo = Menu.new('Pulpo con macedonia') do
35
+ plato pan
36
+ plato pulpo
37
+ plato macedonia
38
+ end
39
+
40
+ dia = Day.new('lunes') do
41
+ desayuno menu_uno
42
+ almuerzo menu_dos
43
+ cena menu_tres
44
+ end
45
+
46
+ Week.new do
47
+ lunes dia
48
+ martes(Day.new do
49
+ desayuno(Menu.new do
50
+ plato 'tostadas'
51
+ plato 'manzana'
52
+ plato 'natillas'
53
+ end)
54
+ almuerzo(Menu.new do
55
+ plato 'tostadas'
56
+ plato 'manzana'
57
+ plato 'natillas'
58
+ end)
59
+ cena(Menu.new do
60
+ plato 'tostadas'
61
+ plato 'manzana'
62
+ plato 'natillas'
63
+ end)
64
+ end)
65
+ miercoles(Day.new do
66
+ desayuno(Menu.new do
67
+ plato 'tostadas'
68
+ plato 'manzana'
69
+ plato 'natillas'
70
+ end)
71
+ almuerzo(Menu.new do
72
+ plato 'tostadas'
73
+ plato 'manzana'
74
+ plato 'natillas'
75
+ end)
76
+ cena(Menu.new do
77
+ plato 'tostadas'
78
+ plato 'manzana'
79
+ plato 'natillas'
80
+ end)
81
+ end)
82
+ jueves(Day.new do
83
+ desayuno(Menu.new do
84
+ plato 'tostadas'
85
+ plato 'manzana'
86
+ plato 'natillas'
87
+ end)
88
+ almuerzo(Menu.new do
89
+ plato 'tostadas'
90
+ plato 'manzana'
91
+ plato 'natillas'
92
+ end)
93
+ cena(Menu.new do
94
+ plato 'tostadas'
95
+ plato 'manzana'
96
+ plato 'natillas'
97
+ end)
98
+ end)
99
+ viernes(Day.new do
100
+ desayuno(Menu.new do
101
+ plato 'tostadas'
102
+ plato 'manzana'
103
+ plato 'natillas'
104
+ end)
105
+ almuerzo(Menu.new do
106
+ plato 'tostadas'
107
+ plato 'manzana'
108
+ plato 'natillas'
109
+ end)
110
+ cena(Menu.new do
111
+ plato 'tostadas'
112
+ plato 'manzana'
113
+ plato 'natillas'
114
+ end)
115
+ end)
116
+ end
@@ -0,0 +1,56 @@
1
+ ---
2
+
3
+ lunes:
4
+ desayuno:
5
+ - Pan blanco, de barra
6
+ - Manzana
7
+ almuerzo:
8
+ - potaje
9
+ - pulpo
10
+ - manzana
11
+ cena:
12
+ - ensalada
13
+
14
+ martes:
15
+ desayuno:
16
+ - tostadas
17
+ - manzana
18
+ almuerzo:
19
+ - potaje
20
+ - pulpo
21
+ - manzana
22
+ cena:
23
+ - ensalada
24
+
25
+ miercoles:
26
+ desayuno:
27
+ - tostadas
28
+ - manzana
29
+ almuerzo:
30
+ - potaje
31
+ - pulpo
32
+ - manzana
33
+ cena:
34
+ - ensalada
35
+
36
+ jueves:
37
+ desayuno:
38
+ - tostadas
39
+ - manzana
40
+ almuerzo:
41
+ - potaje
42
+ - pulpo
43
+ - manzana
44
+ cena:
45
+ - ensalada
46
+
47
+ viernes:
48
+ desayuno:
49
+ - tostadas
50
+ - manzana
51
+ almuerzo:
52
+ - potaje
53
+ - pulpo
54
+ - manzana
55
+ cena:
56
+ - ensalada
@@ -0,0 +1,48 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path('../lib', __FILE__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'dietary_dsl/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'dietary_dsl'
10
+ spec.version = DietaryDsl::VERSION
11
+ spec.authors = ['Daniel Ramos']
12
+ spec.email = ['danielramosacosta@hotmail.com']
13
+
14
+ spec.summary = 'DSL para la representación de menús dietéticos'
15
+ spec.description = 'Esta gema sirve para realizar una representación de menús dietéticos usando un lenguaje de dominio específico.'
16
+ spec.homepage = 'https://gitlab.com/DanielRamosAcosta/dietary_dsl'
17
+ spec.license = 'MIT'
18
+
19
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
20
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
21
+ if spec.respond_to?(:metadata)
22
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
23
+ else
24
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
25
+ 'public gem pushes.'
26
+ end
27
+
28
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
29
+ f.match(%r{^(test|spec|features)/})
30
+ end
31
+ spec.bindir = 'exe'
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ['lib']
34
+
35
+ spec.add_runtime_dependency 'builder', '~> 3.2'
36
+ spec.add_runtime_dependency 'activesupport', '~> 5.1'
37
+
38
+ spec.add_development_dependency 'bundler', '~> 1.14'
39
+ spec.add_development_dependency 'rake', '~> 12.0'
40
+ spec.add_development_dependency 'rspec', '~> 3.0'
41
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
42
+ spec.add_development_dependency 'rb-notifu', '~> 0.0.4'
43
+ spec.add_development_dependency 'rubocop', '~> 0.48'
44
+ spec.add_development_dependency 'simplecov', '~> 0.14'
45
+ spec.add_development_dependency 'webmock', '~> 3.0'
46
+ spec.add_development_dependency 'vcr', '~> 3.0'
47
+ spec.add_development_dependency 'wdm', '~> 0.1' if Gem.win_platform?
48
+ end