cureutils 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 60bf2354dca5de196e274d9e7594e7bf3590d214
4
- data.tar.gz: a4ccd611f4639a2dbc4c4f990b152727c1e60a5b
3
+ metadata.gz: 4c94e405b6e4fed704753438ad76eaeca68d1f22
4
+ data.tar.gz: eb001cd954852d147ac6af02646e00cb35ce4a66
5
5
  SHA512:
6
- metadata.gz: 5791479dd71f91966a7c25cf725c5ee82829d5fbbb551812df1b8e37495944e7caaaa86c62b36bd3e71c44acc24e865d63da9225b56cd9ce6c8ef69c5e2fe0f2
7
- data.tar.gz: 2f160e03740359179cbdc274ad9316b31f687a8ce251bb2588d294ae4c1d350ea908fb4746ffd13932c63eb3fc8ec39f1aa59f4eeb2fb1f8f0a030a928481180
6
+ metadata.gz: 761291e67ac30982fd63fc64af936b26579a2bf4f3fc753ecaa44231437ee458e895d44fd40c5cc2444fdf7959c3fd98597d6b70a441ec51f24caf521bafa348
7
+ data.tar.gz: 3ed00dbb643d140ae100ebf32cc55a11b93b4ae6db0c11a66d14d28adc942398859bef12d0297d02ef868537eacd1db50d11c58517bba415d1993b4457719349
data/Gemfile CHANGED
@@ -2,3 +2,11 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in cureutils.gemspec
4
4
  gemspec
5
+
6
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.3.0")
7
+ gem "backport_dig"
8
+ end
9
+
10
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2")
11
+ gem "activesupport", ">= 4.0.0", "< 5.0.0"
12
+ end
data/README.md CHANGED
@@ -25,14 +25,15 @@ $ cure help
25
25
  Commands:
26
26
  cure date [OPTIONS] [+FORMAT] # Display date, time and Precure related events.
27
27
  cure echo [OPTIONS] PATTERN # Print messages of Precure.
28
- cure girls # Print girls' name
28
+ cure girls [OPTIONS] # Print girls' name.
29
29
  cure grep [OPTIONS] PATTERN # Print lines matching a pattern.
30
30
  cure help [COMMAND] # Describe available commands or one specific command
31
31
  cure humanize # Change precure_name to human_name.
32
32
  cure janken # Let's play "Pikarin Janken" !
33
- cure precures # Print Precure names
33
+ cure precures [OPTIONS] # Print Precure names.
34
34
  cure tr PATTERN REPLACE # Translate Precure related parameters.
35
- cure transform # Change human_name to precure_name
35
+ cure transform # Change human_name to precure_name.
36
+ cure version # Output the version number.
36
37
  ```
37
38
 
38
39
  ## `cure date`
@@ -118,6 +119,13 @@ $ cure girls
118
119
  ...
119
120
  ```
120
121
 
122
+ | Option | Description |
123
+ | ------ | ----------- |
124
+ | -v | Include particular girl's full name. |
125
+ | -m | Include who have only appeared in the movies. |
126
+
127
+
128
+
121
129
  ## `cure grep`
122
130
  Print lines matching a pattern.
123
131
 
@@ -230,10 +238,17 @@ $ cure precures
230
238
  ...
231
239
  ```
232
240
 
233
- ## Zsh completion
241
+ | Option | Description |
242
+ | ------ | ----------- |
243
+ | -m | Include who have only appeared in the movies. |
234
244
 
235
- [etc/cure-completion.zsh](etc/cure-completion.zsh) is useful if you are using Zsh.
245
+ ## Zsh completion
236
246
 
247
+ [zsh-completion/_cure](zsh-completion/_cure) is the file for `cure` command completion.
248
+ With [zplug](https://github.com/zplug/zplug), it can be installed like this.
249
+ ```sh
250
+ zplug "greymd/cureutils", use:cureutils.plugin.zsh
251
+ ```
237
252
 
238
253
  ## Contributing
239
254
 
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.bindir = 'bin'
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ['lib']
19
+ spec.required_ruby_version = '>= 2.0.0'
19
20
  spec.add_development_dependency 'bundler', '~> 1.11'
20
21
  spec.add_development_dependency 'rake', '~> 10.0'
21
22
  spec.add_development_dependency 'rspec', '~> 3.0'
@@ -119,11 +119,15 @@ module Cureutils
119
119
  option 'precure', aliases: 'p',
120
120
  type: :string,
121
121
  desc: "Print the given PRECURE's message."
122
+ option 'style', aliases: 's',
123
+ type: :string,
124
+ desc: 'Choose style of the transformation.'
122
125
  def echo
123
126
  manager = CureEchoManager.new
124
127
  manager.precure(options[:precure])
125
128
  manager.msg_attack(options[:attack])
126
129
  manager.nosleep(options[:quick])
130
+ manager.style(options[:style])
127
131
  exit(manager.print_results)
128
132
  end
129
133
 
@@ -13,6 +13,7 @@ class CureEchoManager
13
13
  @err = $stderr
14
14
  @cure_name = 'echo'
15
15
  @message_mode = EchoMode::TRANSFORM
16
+ @style_priority = []
16
17
  end
17
18
 
18
19
  def source_output(source = $stdout)
@@ -44,19 +45,37 @@ class CureEchoManager
44
45
  Rubicure::Girl.sleep_sec = 0 if flag
45
46
  end
46
47
 
48
+ def style(style)
49
+ @style_priority << style.to_sym if style
50
+ end
51
+
47
52
  def print_results
48
53
  return 1 unless existing_precure?
54
+ precure = Cure.send(@cure_name.to_sym)
49
55
  if @message_mode == EchoMode::TRANSFORM
50
- Cure.send(@cure_name.to_sym).transform!
56
+ precure = original_transform(precure)
51
57
  elsif @message_mode == EchoMode::ATTACK
52
- Cure.send(@cure_name.to_sym).transform!
53
- Cure.send(@cure_name.to_sym).attack!
58
+ precure = original_transform(precure)
59
+ precure.attack!
54
60
  end
55
61
  0
56
62
  end
57
63
 
58
64
  private
59
65
 
66
+ def original_transform(precure)
67
+ return precure.transform! unless precure.respond_to?(:transform_styles)
68
+ chosen_style = @style_priority.find do |s|
69
+ precure.transform_styles.include?(s)
70
+ end
71
+ if chosen_style
72
+ precure.transform! chosen_style
73
+ else
74
+ default_style, _entity = precure.transform_styles.first
75
+ precure.transform! default_style
76
+ end
77
+ end
78
+
60
79
  def existing_precure?
61
80
  found_precure = Rubicure::Girl.config.find do |k, _v|
62
81
  k == @cure_name.to_sym
@@ -2,7 +2,7 @@ module Cureutils
2
2
  class Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 0
5
+ PATCH = 1
6
6
  PRE = nil
7
7
 
8
8
  class << self
@@ -66,6 +66,15 @@ precure_girl_names=(
66
66
  'shiny_luminous'
67
67
  )
68
68
 
69
+ # ruby -r rubicure -e 'cures = [Cure.magical, Cure.miracle, Cure.felice]; cures.map{|c| c.transform_styles.map{|k, _v| k}}.uniq.each{|v| puts v}'
70
+ transform_styles=(
71
+ 'diamond'
72
+ 'ruby'
73
+ 'sapphire'
74
+ 'topaz'
75
+ 'emerald'
76
+ )
77
+
69
78
  function _cure-grep () {
70
79
  local -a args
71
80
  if (( CURRENT>=3 )) ;then
@@ -91,11 +100,14 @@ function _cure-echo () {
91
100
  local -a args
92
101
  if [[ ('--precure' == "${words[$CURRENT-1]}") || ('-p' == "${words[$CURRENT-1]}") ]] ; then
93
102
  _describe -t precure_girl_names 'precure_girl_names' precure_girl_names
103
+ elif [[ ('--style' == "${words[$CURRENT-1]}") || ('-s' == "${words[$CURRENT-1]}") ]] ; then
104
+ _describe -t transform_styles 'transform_styles' transform_styles
94
105
  elif (( CURRENT>=3 )) ; then
95
106
  echo $words | grep -w -- '-p' 1> /dev/null || args=($args '-p:Print messages of given Prequre.')
96
107
  echo $words | grep -w -- '-q' 1> /dev/null || args=($args '-q:Print messages immediately.')
97
108
  echo $words | grep -w -- '-a' 1> /dev/null || args=($args '-a:Print attack messages.')
98
109
  echo $words | grep -w -- '-t' 1> /dev/null || args=($args '-t:Print transform message.')
110
+ echo $words | grep -w -- '-s' 1> /dev/null || args=($args '-s:Choose style of the transformation.')
99
111
  _describe -t args 'args' args
100
112
  fi
101
113
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cureutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamada, Yasuhiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-12 00:00:00.000000000 Z
11
+ date: 2016-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,7 +126,6 @@ files:
126
126
  - ".gitmodules"
127
127
  - ".rspec"
128
128
  - ".travis.yml"
129
- - CODE_OF_CONDUCT.md
130
129
  - Gemfile
131
130
  - LICENSE.txt
132
131
  - README.md
@@ -157,7 +156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
156
  requirements:
158
157
  - - ">="
159
158
  - !ruby/object:Gem::Version
160
- version: '0'
159
+ version: 2.0.0
161
160
  required_rubygems_version: !ruby/object:Gem::Requirement
162
161
  requirements:
163
162
  - - ">="
@@ -1,49 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, and in the interest of
4
- fostering an open and welcoming community, we pledge to respect all people who
5
- contribute through reporting issues, posting feature requests, updating
6
- documentation, submitting pull requests or patches, and other activities.
7
-
8
- We are committed to making participation in this project a harassment-free
9
- experience for everyone, regardless of level of experience, gender, gender
10
- identity and expression, sexual orientation, disability, personal appearance,
11
- body size, race, ethnicity, age, religion, or nationality.
12
-
13
- Examples of unacceptable behavior by participants include:
14
-
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
18
- * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic
20
- addresses, without explicit permission
21
- * Other unethical or unprofessional conduct
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or
24
- reject comments, commits, code, wiki edits, issues, and other contributions
25
- that are not aligned to this Code of Conduct, or to ban temporarily or
26
- permanently any contributor for other behaviors that they deem inappropriate,
27
- threatening, offensive, or harmful.
28
-
29
- By adopting this Code of Conduct, project maintainers commit themselves to
30
- fairly and consistently applying these principles to every aspect of managing
31
- this project. Project maintainers who do not follow or enforce the Code of
32
- Conduct may be permanently removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces
35
- when an individual is representing the project or its community.
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at yasuhiro.yamada@rakuten.com. All
39
- complaints will be reviewed and investigated and will result in a response that
40
- is deemed necessary and appropriate to the circumstances. Maintainers are
41
- obligated to maintain confidentiality with regard to the reporter of an
42
- incident.
43
-
44
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
- version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
47
-
48
- [homepage]: http://contributor-covenant.org
49
- [version]: http://contributor-covenant.org/version/1/3/0/