ruby-zen 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d091ca50231b12b64cfbac4c0c52bbd87552c72e0268bb1621df8e6d33f1566
4
- data.tar.gz: 58b8400ecd43dbbc8b7643af45c8348d843f25914232273f1a31a97129646223
3
+ metadata.gz: 94b6c9e0213a4afbb888a4b4b937d8d1c1c3f7ede4719ce582a362762754e4f5
4
+ data.tar.gz: 04b4529731f7efc69027b1f71ee1f6e05e1684e9a0cf31ba1551c0ec6cd537ae
5
5
  SHA512:
6
- metadata.gz: 7e8e767594c3bce32cc082b43abfa3f66114e8a85ea03bdf573914083c32722538b89949f9180a232ec9c764d6beba07922c8871d6318282eb4cccb2545a965d
7
- data.tar.gz: 5bd6f5e891114d20dddccc86da2c8d957e598ef403f64a2c99b33060ca01e82ebc3bf357dfd5171f068dd8dd6b294eedfa82662bd59ea04e520a1c422add0726
6
+ metadata.gz: cd713a5cdb69fca117a7fa2011fc5e3f1d1be8ee6cd97e02b73f0213bf98ff93c65fac26eb7f81f6203be890463dd98c67daf87661b9872113e88b4189a0b697
7
+ data.tar.gz: e7a1006e8a688067e5c2d113e32bf3ebc63c35555319da1c64a3e479bf87dddead4a99fff0918da63e1d7ec009bac9ec3e302e22021392874c60b5f1300c86c3
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
  # RubyZen
3
3
 
4
4
  Display Ruby ZEN rules.
5
- ![logo](./docs/images/logo-iloveruby.png)
5
+
6
+ ![logo](./docs/images/logo.png)
6
7
 
7
8
  # Documentation
8
9
 
@@ -12,8 +13,7 @@ Display Ruby ZEN rules.
12
13
 
13
14
  # Use
14
15
 
15
- Try with `rubyzen` command to see all functions.
16
-
16
+ Run `rubyzen` command.
17
17
 
18
18
  | Function | Description |
19
19
  | -------- | ------------------------- |
@@ -24,3 +24,4 @@ Try with `rubyzen` command to see all functions.
24
24
  # Contact
25
25
 
26
26
  * **Email**: `dvarrui@protonmail.com`
27
+ * [IloveRuby - dvarrui](https://github.com/dvarrui/iloveruby)
data/lib/ruby-zen/cli.rb CHANGED
@@ -25,6 +25,7 @@ class CLI < Thor
25
25
 
26
26
  map ['-s', '--show'] => 'show'
27
27
  option :more, type: :boolean
28
+ option :step, type: :boolean
28
29
  option :lang, type: :string
29
30
  desc 'show [LANG]', 'Display ZEN rules in the chosen language'
30
31
  long_desc <<-LONGDESC
@@ -0,0 +1,6 @@
1
+ ____ _ __________ _ _ _
2
+ | _ \ _ _| |__ _ _ |__ / ____| \ | | _ __ _ _| | ___ ___
3
+ | |_) | | | | '_ \| | | | / /| _| | \| | | '__| | | | |/ _ \/ __|
4
+ | _ <| |_| | |_) | |_| | / /_| |___| |\ | | | | |_| | | __/\__ \
5
+ |_| \_\\__,_|_.__/ \__, | /____|_____|_| \_| |_| \__,_|_|\___||___/
6
+ |___/
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Params
3
3
  NAME = 'rubyzen'
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  GEMNAME = 'ruby-zen'
6
6
  LANGS = [ :es, :en ]
7
7
  ZEN_FILENAME = 'zenfile.yaml'
@@ -7,25 +7,31 @@ class Rules
7
7
  @app = application
8
8
  end
9
9
 
10
- def show(options = [ '--nomore' ])
11
- if options.include? '--nomore'
12
- show_names
10
+ def show(options = { 'more' => false, 'step' => true })
11
+ if options['more']
12
+ step = options['step']
13
+ show_more(step: step)
13
14
  else
14
- show_details
15
+ show_only_names
15
16
  end
16
17
  end
17
18
 
18
- def show_names
19
- @app.rules.each_with_index do |rule, index|
20
- principle = rule[:rule]
21
- puts "\n[#{(index + 1)}] #{principle}"
22
- end
19
+ private
20
+
21
+ def show_title
22
+ dirbase = File.dirname(__FILE__)
23
+ filepath = File.join(dirbase, 'files', 'title.txt')
24
+ content = File.read(filepath)
25
+ puts content
26
+ puts
23
27
  end
24
28
 
25
- def show_details
29
+ def show_more(step:)
30
+ show_title
31
+
26
32
  @app.rules.each_with_index do |rule, index|
27
33
  principle = rule[:rule]
28
- puts "\n[#{(index + 1)}] #{principle}"
34
+ puts "[#{(index + 1)}] #{principle}"
29
35
  desc = rule[:desc]
30
36
  if desc.is_a? String
31
37
  puts "#{desc}\n".white
@@ -36,6 +42,22 @@ class Rules
36
42
  puts text
37
43
  end
38
44
  end
45
+ puts
46
+ if step
47
+ print '[Press ENTER to continue]'
48
+ STDIN.gets
49
+ puts
50
+ end
39
51
  end
40
52
  end
53
+
54
+ def show_only_names
55
+ show_title
56
+
57
+ @app.rules.each_with_index do |rule, index|
58
+ principle = rule[:rule]
59
+ puts "[#{(index + 1)}] #{principle}"
60
+ end
61
+ end
62
+
41
63
  end
data/lib/ruby-zen.rb CHANGED
@@ -10,8 +10,8 @@ class RubyZen
10
10
  end
11
11
 
12
12
  def self.langs
13
- langs = Params::LANGS + [:all]
14
- puts langs.join(', ')
13
+ langs = Params::LANGS
14
+ puts "Available langs: #{langs.join(', ')}"
15
15
  end
16
16
 
17
17
  def self.show(options)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-zen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
@@ -67,6 +67,7 @@ files:
67
67
  - lib/ruby-zen.rb
68
68
  - lib/ruby-zen/application.rb
69
69
  - lib/ruby-zen/cli.rb
70
+ - lib/ruby-zen/files/title.txt
70
71
  - lib/ruby-zen/files/zenfile.yaml
71
72
  - lib/ruby-zen/params.rb
72
73
  - lib/ruby-zen/rules.rb