martha 0.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7fcb18bf887e51b4382081576b73e1f5e79538d1
4
+ data.tar.gz: 953f937418bf85aee22645dfb71abf003dfcef79
5
+ SHA512:
6
+ metadata.gz: 260180237f6f8fcdba7d427877cf4b3ebd4fe8352ebf9066b5e04f64a6491b3e073adebd9d50140bdacb3aa47d063b1f81070eb89c111fef1f053685d1e16a28
7
+ data.tar.gz: 527228ce3a8a3d8efdaba7cbfd61455334d361644f9ec9e79a6f8b04c3ee518214dad5e9cc687a47f9841298fc94adeb712c97d607ec0109334c45c0208bca84
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Codeclimate
4
+ gem 'codeclimate-test-reporter', group: :test, require: nil
5
+
6
+ # gem "codeclimate-test-reporter", group: :test, require: nil
7
+ gem 'nokogiri'
8
+
9
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,98 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ martha (0.0.0)
5
+ thor
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.3.0)
11
+ axiom-types (0.1.1)
12
+ descendants_tracker (~> 0.0.4)
13
+ ice_nine (~> 0.11.0)
14
+ thread_safe (~> 0.3, >= 0.3.1)
15
+ codeclimate-engine-rb (0.3.1)
16
+ virtus (~> 1.0)
17
+ codeclimate-test-reporter (0.6.0)
18
+ simplecov (>= 0.7.1, < 1.0.0)
19
+ coderay (1.1.1)
20
+ coercible (1.0.0)
21
+ descendants_tracker (~> 0.0.1)
22
+ descendants_tracker (0.0.4)
23
+ thread_safe (~> 0.3, >= 0.3.1)
24
+ diff-lcs (1.2.5)
25
+ docile (1.1.5)
26
+ equalizer (0.0.11)
27
+ ice_nine (0.11.2)
28
+ json (2.0.2)
29
+ method_source (0.8.2)
30
+ mini_portile2 (2.1.0)
31
+ nokogiri (1.6.8)
32
+ mini_portile2 (~> 2.1.0)
33
+ pkg-config (~> 1.1.7)
34
+ parser (2.3.1.2)
35
+ ast (~> 2.2)
36
+ pkg-config (1.1.7)
37
+ powerpack (0.1.1)
38
+ pry (0.10.4)
39
+ coderay (~> 1.1.0)
40
+ method_source (~> 0.8.1)
41
+ slop (~> 3.4)
42
+ rainbow (2.1.0)
43
+ rake (10.5.0)
44
+ reek (4.4.0)
45
+ codeclimate-engine-rb (~> 0.3.1)
46
+ parser (~> 2.3.1, >= 2.3.1.2)
47
+ rainbow (~> 2.0)
48
+ rspec (3.5.0)
49
+ rspec-core (~> 3.5.0)
50
+ rspec-expectations (~> 3.5.0)
51
+ rspec-mocks (~> 3.5.0)
52
+ rspec-core (3.5.2)
53
+ rspec-support (~> 3.5.0)
54
+ rspec-expectations (3.5.0)
55
+ diff-lcs (>= 1.2.0, < 2.0)
56
+ rspec-support (~> 3.5.0)
57
+ rspec-mocks (3.5.0)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.5.0)
60
+ rspec-support (3.5.0)
61
+ rubocop (0.42.0)
62
+ parser (>= 2.3.1.1, < 3.0)
63
+ powerpack (~> 0.1)
64
+ rainbow (>= 1.99.1, < 3.0)
65
+ ruby-progressbar (~> 1.7)
66
+ unicode-display_width (~> 1.0, >= 1.0.1)
67
+ ruby-progressbar (1.8.1)
68
+ simplecov (0.12.0)
69
+ docile (~> 1.1.0)
70
+ json (>= 1.8, < 3)
71
+ simplecov-html (~> 0.10.0)
72
+ simplecov-html (0.10.0)
73
+ slop (3.6.0)
74
+ thor (0.19.1)
75
+ thread_safe (0.3.5)
76
+ unicode-display_width (1.1.0)
77
+ virtus (1.0.5)
78
+ axiom-types (~> 0.1)
79
+ coercible (~> 1.0)
80
+ descendants_tracker (~> 0.0, >= 0.0.3)
81
+ equalizer (~> 0.0, >= 0.0.9)
82
+
83
+ PLATFORMS
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ bundler (~> 1.10)
88
+ codeclimate-test-reporter
89
+ martha!
90
+ nokogiri
91
+ pry
92
+ rake (~> 10.0)
93
+ reek
94
+ rspec
95
+ rubocop
96
+
97
+ BUNDLED WITH
98
+ 1.11.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Victor Elizalde
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,47 @@
1
+ # Martha
2
+ Gem that documents code/software for a better organisation and understanding of it by developers.
3
+
4
+ ## Table of contents
5
+ - [Installation](#installation)
6
+ - [Usage](#usage)
7
+ - [What it actually do?](#what-it-actually-do)
8
+ - [Contributing](#contributing)
9
+ - [Credits](#author-and-contributor-list)
10
+
11
+ ## Installation
12
+ Pre-install:
13
+ - Windows Users: Install ruby environment, we recommend [RubyInstaller](http://rubyinstaller.org/downloads/) and after install [Development Kit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit) and now you can use Ruby's gems.
14
+
15
+ To install the gem you can just run the following command:
16
+
17
+ ```console
18
+ % gem install martha
19
+ ```
20
+ ## What it actually do?
21
+ Command:
22
+ ```console
23
+ % martha docu <NAME_FILE>
24
+ ```
25
+ And your code is documented. Easy
26
+
27
+ Programming Lenguages Supported:
28
+ - Ruby
29
+ - C++
30
+
31
+ ## Usage
32
+
33
+ You only need to use the martha command:
34
+
35
+ ```console
36
+ % martha docu <NAME_FILE>
37
+ ```
38
+
39
+ ## Contributing
40
+ Everyone is freely to collaborate and submit pull request if needed.
41
+ You can add more support for new programming lenguages.
42
+
43
+ ##Author and Contributor List
44
+ -------------------
45
+ - Victor Elizalde
46
+ - Oscar Michel Herrera
47
+ - Mauricio Cortés
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/martha ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'martha'
3
+
4
+ Martha::Builder.start( ARGV )
@@ -0,0 +1,5 @@
1
+ #! /bin/bash
2
+
3
+ bundle
4
+
5
+ exec "$@"
@@ -0,0 +1,16 @@
1
+ version: "2"
2
+
3
+ volumes:
4
+ gems:
5
+ driver: local
6
+ services:
7
+ martha:
8
+ image: ruby:2.3.0
9
+ entrypoint: /usr/src/martha/development-entrypoint.sh
10
+ command: bash
11
+ volumes:
12
+ - .:/usr/src/martha
13
+ - gems:/usr/local/bundle
14
+ working_dir: /usr/src/martha
15
+ tty: true
16
+ stdin_open: true
@@ -0,0 +1,170 @@
1
+ require 'thor'
2
+ require 'pry'
3
+ require 'nokogiri'
4
+
5
+ module Martha
6
+ class Builder < Thor
7
+ include Martha
8
+ include Thor::Actions
9
+
10
+ def initialize(args = [], local_options = {}, config = {})
11
+ super
12
+ @author = "Victor Elizalde"
13
+ @file_info = []
14
+ @description = ""
15
+ @output_description = ""
16
+ @input_description = ""
17
+ @method_info = []
18
+ @file_name = ""
19
+ end
20
+
21
+ desc 'reveal FILE_NAME', 'It documents code'
22
+ def reveal(file_name)
23
+ @file_name = file_name
24
+ if File.file?(@file_name)
25
+ greetings
26
+ if file_name.split('.')[1] == "cpp"
27
+ puts "I found #{method_quantity_cpp} undocumented method(s)/function(s)\n\n"
28
+ document_methods_cpp
29
+ else
30
+ puts "I found #{method_quantity_rb} undocumented method(s)/function(s)\n\n"
31
+ document_methods_rb
32
+ end
33
+ else
34
+ error
35
+ end
36
+ end
37
+
38
+ private
39
+
40
+ def document_methods_cpp
41
+ File.open(@file_name, 'w') { |file|
42
+ @file_info.each do |line|
43
+ if cpp_function?(line)
44
+ fill_method_info line
45
+ @method_info.each do |line|
46
+ file.write("#{line}")
47
+ end
48
+ file.write("#{line.chop} //function\n")
49
+ else
50
+ file.write("#{line}")
51
+ end
52
+ end
53
+ }
54
+ end
55
+
56
+ def document_methods_rb
57
+ File.open(@file_name, 'w') { |file|
58
+ @file_info.each do |line|
59
+ if rb_function?(line)
60
+ fill_method_info line
61
+ @method_info.each do |line|
62
+ file.write("#{line}")
63
+ end
64
+ file.write("#{line.chop} #method\n")
65
+ else
66
+ file.write("#{line}")
67
+ end
68
+ end
69
+ }
70
+ end
71
+
72
+ def fill_method_info(line)
73
+ puts "For the following method/function:\n\n"
74
+ puts " #{line}"
75
+ print "\nInput Description (What does it receives?)\nYour Answer: "
76
+ @input_description = STDIN.gets.chomp
77
+ print "\nOutput Description (What does it returns?)\nYour Answer: "
78
+ @output_description = STDIN.gets.chomp
79
+ print "\nDescription (What does the method does?)\nYour Answer: "
80
+ @description = STDIN.gets.chomp
81
+ puts "\n"
82
+ if @file_name.split('.')[1] == "cpp"
83
+ write_method_info_cpp line
84
+ else
85
+ write_method_info_rb line
86
+ end
87
+ end
88
+
89
+ def write_method_info_rb(line)
90
+ @method_info = []
91
+ if line.include?('(')
92
+ title = line.split('(')[0].split(' ')[1]
93
+ input = line.split('(')[1].chop
94
+ input[input.size-1] = ''
95
+ else
96
+ title = line.split(' ')[1]
97
+ input = "()"
98
+ end
99
+ output = line.split('(')[0].split(' ')[0]
100
+ @method_info << "#Title: #{title}\n"
101
+ @method_info << "#Input: #{input}\n"
102
+ @method_info << "#Input Description: #{@input_description}\n"
103
+ @method_info << "#Output Description: #{@output_description}\n"
104
+ @method_info << "#Description: #{@description}\n"
105
+ @method_info << "#Author: #{@author}\n"
106
+ @method_info
107
+ end
108
+
109
+ def write_method_info_cpp(line)
110
+ @method_info = []
111
+ @method_info << "/*\n"
112
+ title = line.split('(')[0].split(' ')[1]
113
+ input = line.split('(')[1].chop
114
+ input[input.size-1] = ''
115
+ output = line.split('(')[0].split(' ')[0]
116
+ @method_info << "Title: #{title}\n"
117
+ @method_info << "Input: #{input}\n"
118
+ @method_info << "Input Description: #{@input_description}\n"
119
+ @method_info << "Output: #{output}\n"
120
+ @method_info << "Output Description: #{@output_description}\n"
121
+ @method_info << "Description: #{@description}\n"
122
+ @method_info << "Author: #{@author}\n"
123
+ @method_info << "*/\n"
124
+ @method_info
125
+ end
126
+
127
+ def greetings
128
+ puts "Hello I'm Martha!\n\n"
129
+ puts "With whom I have the pleasure?\n\n"
130
+ print "Your Name: "
131
+ @author = STDIN.gets.chomp
132
+ puts "\n"
133
+ end
134
+
135
+ def method_quantity_cpp
136
+ method_quantity = 0
137
+ file = File.open(@file_name)
138
+ file.each_line do |line|
139
+ method_quantity += 1 if cpp_function?(line)
140
+ @file_info << line
141
+ end
142
+ method_quantity
143
+ end
144
+
145
+ def method_quantity_rb
146
+ method_quantity = 0
147
+ file = File.open(@file_name)
148
+ file.each_line do |line|
149
+ method_quantity += 1 if rb_function?(line)
150
+ @file_info << line
151
+ end
152
+ method_quantity
153
+ end
154
+
155
+ def cpp_function?(line)
156
+ if line.include?('(') && !line.include?('//function')
157
+ header = line.split('(')[0]
158
+ header.split(' ').size == 2 && header.split(' ').first != "else" && header.split(' ').last != "main"
159
+ end
160
+ end
161
+
162
+ def rb_function?(line)
163
+ line.split(' ')[0] == "def" && !line.include?('#method')
164
+ end
165
+
166
+ def error
167
+ puts "I'm sorry, but the file doesn't exist"
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,3 @@
1
+ module Martha
2
+ VERSION = '0.0.0'.freeze
3
+ end
data/lib/martha.rb ADDED
@@ -0,0 +1 @@
1
+ require 'martha/builder'
data/martha.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'martha/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'martha'
8
+ spec.version = Martha::VERSION
9
+ spec.authors = ['Victor Elizalde', 'Mauricio Cortes', 'Oscar Michel']
10
+ spec.email = ['vic-bull@hotmail.com']
11
+ spec.summary = 'A ruby gem to dockerize applications.'
12
+ spec.description = 'A ruby gem to dockerize applications.'
13
+ spec.homepage = 'https://github.com/VictorElizalde/Martha'
14
+ spec.license = 'MIT'
15
+ spec.executables << "martha"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.bindir = 'bin'
21
+ spec.executables = ['martha']
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.10'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec'
27
+ spec.add_development_dependency 'pry'
28
+ spec.add_development_dependency 'rubocop'
29
+ spec.add_development_dependency 'reek'
30
+
31
+ spec.add_dependency 'thor'
32
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: martha
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Victor Elizalde
8
+ - Mauricio Cortes
9
+ - Oscar Michel
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2016-08-28 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.10'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '1.10'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rake
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '10.0'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '10.0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: rspec
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: pry
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: rubocop
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: reek
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ - !ruby/object:Gem::Dependency
100
+ name: thor
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ type: :runtime
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ description: A ruby gem to dockerize applications.
114
+ email:
115
+ - vic-bull@hotmail.com
116
+ executables:
117
+ - martha
118
+ extensions: []
119
+ extra_rdoc_files: []
120
+ files:
121
+ - ".travis.yml"
122
+ - CODE_OF_CONDUCT.md
123
+ - Gemfile
124
+ - Gemfile.lock
125
+ - LICENSE.txt
126
+ - README.md
127
+ - Rakefile
128
+ - bin/martha
129
+ - development-entrypoint.sh
130
+ - docker-compose.yml
131
+ - lib/martha.rb
132
+ - lib/martha/builder.rb
133
+ - lib/martha/version.rb
134
+ - martha.gemspec
135
+ homepage: https://github.com/VictorElizalde/Martha
136
+ licenses:
137
+ - MIT
138
+ metadata: {}
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubyforge_project:
155
+ rubygems_version: 2.5.1
156
+ signing_key:
157
+ specification_version: 4
158
+ summary: A ruby gem to dockerize applications.
159
+ test_files: []