rabbit-slide-giosakti-201710-coding-conventions-ruby 2017.10.16.1
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 +7 -0
- data/.rabbit +1 -0
- data/README.md +36 -0
- data/Rakefile +20 -0
- data/coding-conventions-ruby.rab +129 -0
- data/config.yaml +23 -0
- data/pdf/201710-coding-conventions-ruby-201710-coding-conventions-ruby.pdf +0 -0
- data/theme.rb +24 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dabfcf2e7e2ce582669e6e18e9c59ffc695c4d7d
|
4
|
+
data.tar.gz: 839fa58562620cd3d14efb599b85189e0028747d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7207e6359e956db3a3143448efe53377895268259b840d2d49d08c91d61289fa14857ca9b820be28e2a05d44b30e13879fbaea6b0a5714fd33e9748e5c551832
|
7
|
+
data.tar.gz: 3732a9322fb7048fb03a0e0fc5e42350c4a602ea95fc564ac6ebb9253bafd135641c27f8042178b69536327c9ab2044f74c5335eca1f7fa4b58dd049ac882fa6
|
data/.rabbit
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
coding-conventions-ruby.rab
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Coding Conventions in Ruby
|
2
|
+
|
3
|
+
This talk gives intro about coding conventions and how can it be enforced in ruby.
|
4
|
+
|
5
|
+
## License
|
6
|
+
|
7
|
+
### Slide
|
8
|
+
|
9
|
+
MIT
|
10
|
+
|
11
|
+
Use the followings for notation of the author:
|
12
|
+
|
13
|
+
* Giovanni Sakti
|
14
|
+
|
15
|
+
## For author
|
16
|
+
|
17
|
+
### Show
|
18
|
+
|
19
|
+
rake
|
20
|
+
|
21
|
+
### Publish
|
22
|
+
|
23
|
+
rake publish
|
24
|
+
|
25
|
+
# or for rubygems only
|
26
|
+
rake publish:rubygems
|
27
|
+
|
28
|
+
## For viewers
|
29
|
+
|
30
|
+
### Install
|
31
|
+
|
32
|
+
gem install rabbit-slide-giosakti-201710-coding-conventions-ruby
|
33
|
+
|
34
|
+
### Show
|
35
|
+
|
36
|
+
rabbit rabbit-slide-giosakti-201710-coding-conventions-ruby.gem
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "rabbit/task/slide"
|
2
|
+
|
3
|
+
# Edit ./config.yaml to customize meta data
|
4
|
+
|
5
|
+
spec = nil
|
6
|
+
Rabbit::Task::Slide.new do |task|
|
7
|
+
spec = task.spec
|
8
|
+
spec.files += Dir.glob("images/**/*.*")
|
9
|
+
# spec.files -= Dir.glob("private/**/*.*")
|
10
|
+
|
11
|
+
# You may include other themes here
|
12
|
+
# spec.add_runtime_dependency("rabbit-theme-nyankosakana")
|
13
|
+
# spec.add_runtime_dependency("rabbit-theme-yart")
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Tag #{spec.version}"
|
17
|
+
task :tag do
|
18
|
+
sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
|
19
|
+
sh("git", "push", "--tags")
|
20
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
= Coding Conventions in Ruby
|
2
|
+
|
3
|
+
% : subtitle
|
4
|
+
% in Ruby
|
5
|
+
: author
|
6
|
+
Giovanni Sakti
|
7
|
+
: institution
|
8
|
+
Starqle
|
9
|
+
% : content-source
|
10
|
+
% id_ruby
|
11
|
+
% : date
|
12
|
+
% 2017-10-16
|
13
|
+
: theme
|
14
|
+
.
|
15
|
+
|
16
|
+
= Coding Conventions
|
17
|
+
|
18
|
+
(('tag:center'))What is coding conventions?
|
19
|
+
|
20
|
+
== properties
|
21
|
+
: hide-title
|
22
|
+
true
|
23
|
+
|
24
|
+
= Coding Conventions
|
25
|
+
|
26
|
+
* A set of guidelines
|
27
|
+
* for specific programming languages
|
28
|
+
* recommend programming styles, practics and methods
|
29
|
+
|
30
|
+
= What does it cover?
|
31
|
+
|
32
|
+
* file organization
|
33
|
+
* indentation
|
34
|
+
* comments
|
35
|
+
* declarations
|
36
|
+
* statements
|
37
|
+
|
38
|
+
= What does it cover? (cont'd)
|
39
|
+
|
40
|
+
* white space
|
41
|
+
* naming conventions
|
42
|
+
* practices & principles
|
43
|
+
* architectural
|
44
|
+
* etc
|
45
|
+
|
46
|
+
= Applies
|
47
|
+
|
48
|
+
(('tag:center'))Coding conventions may be applied to ((*organization*)), ((*specific project*)) or ((*specific product*))
|
49
|
+
|
50
|
+
== properties
|
51
|
+
: hide-title
|
52
|
+
true
|
53
|
+
|
54
|
+
= Benefits
|
55
|
+
|
56
|
+
* Improve readability
|
57
|
+
* Make software maintenance easier
|
58
|
+
|
59
|
+
= Rationale
|
60
|
+
|
61
|
+
* 40-80% of the lifetime cost of a piece of software ((*goes to maintenance*))
|
62
|
+
* Hardly any software is maintained for its whole life by the original author
|
63
|
+
|
64
|
+
= Rationale (cont'd)
|
65
|
+
|
66
|
+
* Code conventions ((*improve the readability*)) of the software, allowing engineers to understand new code more quickly and thoroughly
|
67
|
+
* If you ship your source code as a product, you need to make sure it is as well packaged and clean as any other product you create
|
68
|
+
|
69
|
+
= In Practice
|
70
|
+
|
71
|
+
(('tag:center'))Conventions may be formalized in a documented set of rules or may be as informal as the habitual coding practices of an individual
|
72
|
+
|
73
|
+
== properties
|
74
|
+
: hide-title
|
75
|
+
true
|
76
|
+
|
77
|
+
= Ruby Style Guide
|
78
|
+
|
79
|
+
Ruby has coding conventions document called the ((*Ruby Style Guide*)) that serve as a generic reference for Ruby programmer\n
|
80
|
+
|
81
|
+
((<"github.com/bbatsov/ruby-style-guide"|URL:github.com/bbatsov/ruby-style-guide>))
|
82
|
+
|
83
|
+
= RuboCop
|
84
|
+
|
85
|
+
(('tag:center'))Ruby also has interesting software to enforce coding convention called ((*RuboCop*))
|
86
|
+
|
87
|
+
= Installing RuboCop
|
88
|
+
|
89
|
+
# rouge console
|
90
|
+
|
91
|
+
% gem install rubocop
|
92
|
+
|
93
|
+
= Using RuboCop
|
94
|
+
|
95
|
+
# rouge console
|
96
|
+
|
97
|
+
% rubocop <file-name>
|
98
|
+
|
99
|
+
= Default Style Guide
|
100
|
+
|
101
|
+
By default, RuboCop use the ruby style guide as the default configuration
|
102
|
+
|
103
|
+
= Custom Style Guide
|
104
|
+
|
105
|
+
If you want to customize the style guide, you can create a ((*.rubocop.yml*)) in the same directory where you run rubocop
|
106
|
+
|
107
|
+
= Custom Style Guide
|
108
|
+
|
109
|
+
You can use following default configuration file of RuboCop as reference to create .rubocop.yml
|
110
|
+
|
111
|
+
((<"github.com/bbatsov/rubocop/blob/master/config/default.yml"|URL:github.com/bbatsov/rubocop/blob/master/config/default.yml>))
|
112
|
+
|
113
|
+
= Custom Style Guide
|
114
|
+
|
115
|
+
Consult the following url for more info about configuration
|
116
|
+
|
117
|
+
((<"rubocop.readthedocs.io/en/latest/configuration"|URL:http://rubocop.readthedocs.io/en/latest/configuration/>))
|
118
|
+
|
119
|
+
= Exercise
|
120
|
+
|
121
|
+
Implement a custom ((*.rubocop.yml*)) configuration file according to your organization convention
|
122
|
+
|
123
|
+
= Thanks
|
124
|
+
|
125
|
+
(('tag:center'))Thanks
|
126
|
+
|
127
|
+
== properties
|
128
|
+
: hide-title
|
129
|
+
true
|
data/config.yaml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
id: 201710-coding-conventions-ruby
|
3
|
+
base_name: 201710-coding-conventions-ruby
|
4
|
+
tags:
|
5
|
+
- rabbit
|
6
|
+
- ruby
|
7
|
+
- rspec
|
8
|
+
presentation_date: 2017-10-16
|
9
|
+
version: 2017.10.16.1
|
10
|
+
licenses:
|
11
|
+
- MIT
|
12
|
+
slideshare_id:
|
13
|
+
speaker_deck_id:
|
14
|
+
ustream_id:
|
15
|
+
vimeo_id:
|
16
|
+
youtube_id:
|
17
|
+
author:
|
18
|
+
markup_language: :rd
|
19
|
+
name: Giovanni Sakti
|
20
|
+
email: giosakti@gmail.com
|
21
|
+
rubygems_user: giosakti
|
22
|
+
slideshare_user:
|
23
|
+
speaker_deck_user: giosakti
|
data/theme.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
@margin_left = screen_x(1)
|
2
|
+
@margin_right = screen_x(1)
|
3
|
+
|
4
|
+
# @title_slide_title_font_size = @large_font_size
|
5
|
+
# @title_slide_subtitle_font_size = @small_font_size
|
6
|
+
|
7
|
+
match(Slide, HeadLine) do |headlines|
|
8
|
+
headlines.horizontal_centering = true
|
9
|
+
|
10
|
+
# This code below already available as default theme
|
11
|
+
# I put it here to show on how to style specific slide
|
12
|
+
# headlines.each do |headline|
|
13
|
+
# slide = headline.slide
|
14
|
+
# headline.hide if slide["hide-title"] == true
|
15
|
+
# end
|
16
|
+
end
|
17
|
+
|
18
|
+
match(Slide, Body) do |bodies|
|
19
|
+
bodies.vertical_centering = true
|
20
|
+
end
|
21
|
+
|
22
|
+
include_theme("default")
|
23
|
+
# include_theme("rabbit-theme-nyankosakana")
|
24
|
+
# include_theme("rabbit-theme-yart")
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rabbit-slide-giosakti-201710-coding-conventions-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2017.10.16.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Giovanni Sakti
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rabbit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.2
|
27
|
+
description: This talk gives intro about coding conventions and how can it be enforced
|
28
|
+
in ruby.
|
29
|
+
email:
|
30
|
+
- giosakti@gmail.com
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".rabbit"
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- coding-conventions-ruby.rab
|
39
|
+
- config.yaml
|
40
|
+
- pdf/201710-coding-conventions-ruby-201710-coding-conventions-ruby.pdf
|
41
|
+
- theme.rb
|
42
|
+
homepage: http://slide.rabbit-shocker.org/authors/giosakti/201710-coding-conventions-ruby/
|
43
|
+
licenses:
|
44
|
+
- MIT
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.6.13
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Coding Conventions in Ruby
|
66
|
+
test_files: []
|