macsay 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6aef2804377822ab2bc35ea56bafbe0c115108683f79b559aee9ad5519609334
4
+ data.tar.gz: 50bcb13786fff78d338d2a1d8bf412468149ef4dbeac33ced20f8552959b82ed
5
+ SHA512:
6
+ metadata.gz: 906b405239c26e6c19090666f99589a17fc2f012dffda0b153044952d862e9f9ec1bc6d8c032a1ec3775971a97dc4352039fbd49acb281bc58e4b278f396b39a
7
+ data.tar.gz: 31053908f76b018f881dbf003134fff0dd033b5948a2bd8394d5d9a1a892284917894a439f6cbb46d50d95cedb5796bbb792c305b47ef9d17ffb944d743ac0f8
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ *.bundle
14
+ *.so
15
+ *.o
16
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,10 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ Layout/LineLength:
4
+ Max: 120
5
+ Style/HashEachMethods:
6
+ Enabled: false
7
+ Style/HashTransformKeys:
8
+ Enabled: false
9
+ Style/HashTransformValues:
10
+ Enabled: false
@@ -0,0 +1,8 @@
1
+ ---
2
+ os: osx
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.4.3
7
+ script:
8
+ - bundle exec rake
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in macsay.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 12.0'
9
+ gem 'rspec', '~> 3.0'
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ macsay (0.1.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.0)
10
+ diff-lcs (1.3)
11
+ jaro_winkler (1.5.4)
12
+ parallel (1.19.1)
13
+ parser (2.7.0.5)
14
+ ast (~> 2.4.0)
15
+ rainbow (3.0.0)
16
+ rake (12.3.3)
17
+ rake-compiler (1.1.0)
18
+ rake
19
+ rexml (3.2.4)
20
+ rspec (3.9.0)
21
+ rspec-core (~> 3.9.0)
22
+ rspec-expectations (~> 3.9.0)
23
+ rspec-mocks (~> 3.9.0)
24
+ rspec-core (3.9.1)
25
+ rspec-support (~> 3.9.1)
26
+ rspec-expectations (3.9.1)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.9.0)
29
+ rspec-mocks (3.9.1)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.9.0)
32
+ rspec-support (3.9.2)
33
+ rubocop (0.80.1)
34
+ jaro_winkler (~> 1.5.1)
35
+ parallel (~> 1.10)
36
+ parser (>= 2.7.0.1)
37
+ rainbow (>= 2.2.2, < 4.0)
38
+ rexml
39
+ ruby-progressbar (~> 1.7)
40
+ unicode-display_width (>= 1.4.0, < 1.7)
41
+ ruby-progressbar (1.10.1)
42
+ unicode-display_width (1.6.1)
43
+
44
+ PLATFORMS
45
+ ruby
46
+
47
+ DEPENDENCIES
48
+ bundler
49
+ macsay!
50
+ rake (~> 12.0)
51
+ rake-compiler
52
+ rspec (~> 3.0)
53
+ rubocop
54
+
55
+ BUNDLED WITH
56
+ 2.1.4
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 winebarrel
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.
@@ -0,0 +1,20 @@
1
+ # MacSay
2
+
3
+ ## Description
4
+
5
+ Simple Ruby bindings for NSSpeechSynthesizer.
6
+
7
+ ## Example
8
+
9
+ ```ruby
10
+ require 'macsay'
11
+
12
+ voices = MacSay.available_voices
13
+ voice = voices.sort_by { rand }.first
14
+
15
+ # ゆっくりしていってね!!!
16
+ MacSay.say('yukkuri shite itte ne!!!', voice)
17
+
18
+ # ゆっくりしね!!!
19
+ MacSay.say('yukkuri shine!!!')
20
+ ```
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+ require 'rake/extensiontask'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ Rake::ExtensionTask.new('macsay') do |ext|
11
+ ext.ext_dir = 'ext'
12
+ end
13
+
14
+ RuboCop::RakeTask.new do |task|
15
+ task.options = %w[-c .rubocop.yml]
16
+ end
17
+
18
+ task default: %i[rubocop spec]
19
+ task spec: [:compile]
20
+ task compile: [:clean]
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'macsay'
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__)
@@ -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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mkmf'
2
- $LDFLAGS = ' -framework Cocoa '
4
+ $LDFLAGS = ' -framework Cocoa ' # rubocop:disable Style/GlobalVars
3
5
  create_makefile('macsay')
data/ext/say.m CHANGED
@@ -1,9 +1,9 @@
1
1
  #include <unistd.h>
2
2
  #import <Cocoa/Cocoa.h>
3
3
 
4
- #define WAIT 0.1
4
+ #define WAIT 100000 // µs
5
5
 
6
- void *say(char *cmsg, char *cvoice) {
6
+ void say(char *cmsg, char *cvoice) {
7
7
  NSAutoreleasePool *pool;
8
8
  NSSpeechSynthesizer* speech;
9
9
  NSString *voice, *msg;
@@ -20,29 +20,28 @@ void *say(char *cmsg, char *cvoice) {
20
20
 
21
21
  speech = [[NSSpeechSynthesizer alloc] initWithVoice:voice];
22
22
 
23
- [speech startSpeakingString: msg];
23
+ [speech startSpeakingString: msg];
24
24
 
25
25
  while ([speech isSpeaking]) {
26
- sleep(WAIT);
26
+ usleep(WAIT);
27
27
  }
28
28
 
29
29
  [pool release];
30
30
  }
31
31
 
32
- void available_voices(void (*func)(void *, char *), void *data) {
32
+ void available_voices(void (*func)(void *, const char *), void *data) {
33
33
  NSAutoreleasePool *pool;
34
34
  NSArray *voices;
35
35
  NSEnumerator *itor;
36
36
  NSString *voice;
37
37
 
38
-
39
38
  pool = [[NSAutoreleasePool alloc] init];
40
39
 
41
40
  voices = [NSSpeechSynthesizer availableVoices];
42
41
  itor = [voices objectEnumerator];
43
42
 
44
- while (voice = [itor nextObject]) { // (b)
45
- char *cvoice = [voice UTF8String];
43
+ while (voice = [itor nextObject]) {
44
+ const char *cvoice = [voice UTF8String];
46
45
  func(data, cvoice);
47
46
  }
48
47
 
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'macsay'
5
+ spec.version = '0.1.1'
6
+ spec.authors = ['winebarrel']
7
+ spec.email = ['sugawara@winebarrel.jp']
8
+
9
+ spec.summary = 'Simple Ruby bindings for NSSpeechSynthesizer.'
10
+ spec.description = 'Simple Ruby bindings for NSSpeechSynthesizer.'
11
+ spec.homepage = 'https://github.com/winebarrel/macsay'
12
+ spec.license = 'MIT'
13
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
14
+
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = 'exe'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = %w[lib ext]
25
+ spec.extensions = 'ext/extconf.rb'
26
+
27
+ spec.add_development_dependency 'bundler'
28
+ spec.add_development_dependency 'rake'
29
+ spec.add_development_dependency 'rake-compiler'
30
+ spec.add_development_dependency 'rspec'
31
+ spec.add_development_dependency 'rubocop'
32
+ end
metadata CHANGED
@@ -1,71 +1,131 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: macsay
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - winebarrel
14
8
  autorequire:
15
- bindir: bin
9
+ bindir: exe
16
10
  cert_chain: []
17
-
18
- date: 2012-03-29 00:00:00 +09:00
19
- default_executable:
20
- dependencies: []
21
-
11
+ date: 2020-03-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake-compiler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
22
83
  description: Simple Ruby bindings for NSSpeechSynthesizer.
23
- email: sgwr_dts@yahoo.co.jp
84
+ email:
85
+ - sugawara@winebarrel.jp
24
86
  executables: []
25
-
26
- extensions:
87
+ extensions:
27
88
  - ext/extconf.rb
28
- extra_rdoc_files:
29
- - README
30
- files:
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".rubocop.yml"
94
+ - ".travis.yml"
95
+ - Gemfile
96
+ - Gemfile.lock
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - bin/console
101
+ - bin/setup
31
102
  - ext/extconf.rb
32
103
  - ext/macsay.c
33
104
  - ext/say.m
34
- - README
35
- has_rdoc: true
36
- homepage: https://github.com/winebarrel/infra-study/tree/master/2nd/macsay
37
- licenses: []
38
-
105
+ - macsay.gemspec
106
+ homepage: https://github.com/winebarrel/macsay
107
+ licenses:
108
+ - MIT
109
+ metadata:
110
+ homepage_uri: https://github.com/winebarrel/macsay
39
111
  post_install_message:
40
- rdoc_options:
41
- - --title
42
- - MacSay - Simple Ruby bindings for NSSpeechSynthesizer.
43
- require_paths:
112
+ rdoc_options: []
113
+ require_paths:
44
114
  - lib
45
- required_ruby_version: !ruby/object:Gem::Requirement
46
- none: false
47
- requirements:
115
+ - ext
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
48
118
  - - ">="
49
- - !ruby/object:Gem::Version
50
- hash: 3
51
- segments:
52
- - 0
53
- version: "0"
54
- required_rubygems_version: !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
119
+ - !ruby/object:Gem::Version
120
+ version: 2.3.0
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
57
123
  - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
63
126
  requirements: []
64
-
65
- rubyforge_project:
66
- rubygems_version: 1.5.3
127
+ rubygems_version: 3.0.3
67
128
  signing_key:
68
- specification_version: 3
129
+ specification_version: 4
69
130
  summary: Simple Ruby bindings for NSSpeechSynthesizer.
70
131
  test_files: []
71
-
data/README DELETED
@@ -1,20 +0,0 @@
1
- = MacSay
2
-
3
- Copyright (c) 2012 SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
4
-
5
- == Description
6
-
7
- Simple Ruby bindings for NSSpeechSynthesizer.
8
-
9
- == Example
10
-
11
- require 'macsay'
12
-
13
- voices = MacSay.available_voices
14
- voice = voices.sort_by { rand }.first
15
-
16
- # ゆっくりしていってね!!!
17
- MacSay.say('yukkuri shite itte ne!!!', voice)
18
-
19
- # ゆっくりしね!!!
20
- MacSay.say('yukkuri shine!!!')