chars 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 744e39b682dc29231aafe96056415cc38c65e032df5c2a3aff6a5a846b38f67b
4
+ data.tar.gz: 47e309f42894f6d94ec2d15568d5d33df8a97600c1c227eb2366eb8fb8d56eb4
5
+ SHA512:
6
+ metadata.gz: 20755db9457fda76ceed274d18919a43dbf3c850d0aaad6a38f077b0e89fcf15d7c0a79b3ac95fe158d5abef8db4e68bd0ccc6971f8989e0b4f7c918b9a282b8
7
+ data.tar.gz: 54bc4adfd93752f68454c475b57a1705428231f8decab3be8b8710d6c344c60715af7c466b21b7c398e7b2cc30801ff5fe77a4924e1ac34b4fa724c3f1a3adec
data/.document CHANGED
@@ -1,4 +1,4 @@
1
1
  lib/**/*.rb
2
2
  -
3
- ChangeLog.*
3
+ ChangeLog.md
4
4
  LICENSE.txt
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - 2.4
13
+ - 2.5
14
+ - 2.6
15
+ - 2.7
16
+ - 3.0
17
+ - jruby
18
+ name: Ruby ${{ matrix.ruby }}
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ - name: Install dependencies
26
+ run: bundle install --jobs 4 --retry 3
27
+ - name: Run tests
28
+ run: bundle exec rake test
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /Gemfile.lock
2
+ /doc/
3
+ /pkg/
4
+ /vendor/bundle
5
+ .DS_Store
6
+ .yardoc
7
+ *.swp
8
+ *~
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --markup markdown --title 'Chars Documentation' --protected --quiet --files ChangeLog.md,LICENSE.txt
1
+ --markup markdown --title 'Chars Documentation' --protected --quiet
data/ChangeLog.md CHANGED
@@ -1,3 +1,35 @@
1
+ ### 0.3.0 / 2021-10-23
2
+
3
+ * Added {Chars::WHITESPACE}.
4
+ * Added {Chars::DIGITS}.
5
+ * Added {Chars::CharSet#each_substring_with_index}.
6
+ * Added {Chars::CharSet#substrings_with_indexes}.
7
+ * Added {Chars::CharSet#each_substring}.
8
+ * Added {Chars::CharSet#substrings}.
9
+ * Added {Chars::CharSet#each_string_of_length}.
10
+ * Added {Chars::CharSet#strings_of_length}.
11
+ * Added {Chars::StringEnumerator}.
12
+
13
+ ### 0.2.4 / 2021-10-22
14
+
15
+ * Require [ruby] >= 2.0.0.
16
+ * Added {Chars::CharSet#initialize_copy} to prevent leaking characters
17
+ between copied {Chars::CharSet} objects.
18
+
19
+ ### 0.2.3 / 2020-12-25
20
+
21
+ * Change {Chars::CharSet} to inherit from `Set`, instead of `SortedSet`.
22
+
23
+ ### 0.2.2 / 2012-05-28
24
+
25
+ * {Chars::CharSet#initialize} now raises a TypeError when given arguments
26
+ that were neither a `String`, `Integer` or `Enumerable`.
27
+ * Allow {Chars::CharSet#strings_in} to yield results as they are found.
28
+ * Improved the performance of {Chars::CharSet#strings_in} when operating on
29
+ small Strings.
30
+ * Replaced ore-tasks with
31
+ [rubygems-tasks](https://github.com/postmodern/rubygems-tasks#readme).
32
+
1
33
  ### 0.2.1 / 2011-06-22
2
34
 
3
35
  * Added {Chars::CharSet.[]}
@@ -52,3 +84,4 @@
52
84
  belongs to a certain character set.
53
85
  * Supports random text generation using specific character sets.
54
86
 
87
+ [ruby]: https://www.ruby-lang.org/
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ gem 'rubygems-tasks', '~> 0.2'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'kramdown'
10
+ gem 'yard', '~> 0.9'
11
+ gem 'yard-spellcheck', require: false
12
+ end
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2009-2010 Hal Brodigan
3
+ Copyright (c) 2009-2021 Hal Brodigan
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Chars
2
2
 
3
- * http://chars.rubyforge.org/
4
- * http://github.com/postmodern/chars/
5
- * Postmodern (postmodern.mod3 at gmail.com)
3
+ [![CI](https://github.com/postmodern/chars.rb/actions/workflows/ruby.yml/badge.svg)](https://github.com/postmodern/chars.rb/actions/workflows/ruby.yml)
4
+
5
+ * [Source](https://github.com/postmodern/chars.rb#readme)
6
+ * [Issues](https://github.com/postmodern/chars.rb/issues)
7
+ * [Documentation](https://rubydoc.info/gems/chars)
6
8
 
7
9
  ## Description
8
10
 
@@ -12,84 +14,162 @@ recognizing text and generating random text from specific character sets.
12
14
  ## Features
13
15
 
14
16
  * Provides character sets for:
15
- * Numeric ('0' - '9')
16
- * Octal ('0' - '7')
17
- * Uppercase Hexadecimal ('0' - '9', 'A' - 'F')
18
- * Lowercase Hexadecimal ('0' - '9', 'a' - 'f')
19
- * Hexadecimal ('0' - '9', 'a' - 'f', 'A' - 'F')
20
- * Uppercase Alpha ('A' - 'Z')
21
- * Lowercase Alpha ('a' - 'z')
22
- * Alpha ('a' - 'z', 'A' - 'Z')
23
- * Alpha-numeric ('0' - '9', 'a' - 'z', 'A' - 'Z')
24
- * Punctuation (' ', '\'', '"', '`', ',', ';', ':', '~', '-', '(', ')',
25
- '[', ']', '{', '}', '.', '?', '!')
26
- * Symbols (' ', '\'', '"', '`', ',', ';', ':', '~', '-', '(', ')',
27
- '[', ']', '{', '}', '.', '?', '!', '@', '#', '$', '%', '^', '&', '*',
28
- '_', '+', '=', '|', '\\', '<', '>', '/')
29
- * Space (' ', '\f', '\n', '\r', '\t', '\v')
30
- * Visible ('0' - '9', 'a' - 'z', 'A' - 'Z', '\'', '"', '`', ',',
31
- ';', ':', '~', '-', '(', ')', '[', ']', '{', '}', '.', '?', '!', '@',
32
- '#', '$', '%', '^', '&', '*', '_', '+', '=', '|', '\\', '<', '>', '/',)
33
- * Printable ('0' - '9', 'a' - 'z', 'A' - 'Z', ' ', '\'', '"', '`', ',',
34
- ';', ':', '~', '-', '(', ')', '[', ']', '{', '}', '.', '?', '!', '@',
35
- '#', '$', '%', '^', '&', '*', '_', '+', '=', '|', '\\', '<', '>', '/',
36
- '\f', '\n', '\r', '\t', '\v')
37
- * Control ('\x00' - '\x1f', '\x7f')
38
- * Signed ASCII ('\x00' - '\x7f')
39
- * ASCII ('\x00' - '\xff')
17
+ * Numeric: `0` - `9`
18
+ * Octal: `0` - `7`
19
+ * Uppercase Hexadecimal: `0` - `9`, `A` - `F`
20
+ * Lowercase Hexadecimal: `0` - `9`, `a` - `f`
21
+ * Hexadecimal: `0` - `9`, `a` - `f`, `A` - `F`
22
+ * Uppercase Alpha: `A` - `Z`
23
+ * Lowercase Alpha: `a` - `z`
24
+ * Alpha: `a` - `z`, `A` - `Z`
25
+ * Alpha-numeric: `0` - `9`, `a` - `z`, `A` - `Z`
26
+ * Punctuation: `' '`, `'`, `"`, `` ` ``, `,`, `;`, `:`, `~`, `-`, `(`, `)`, `[`, `]`, `{`, `}`, `.`, `?`, `!`
27
+ * Symbols: `' '`, `'`, `"`, `` ` ``, `,`, `;`, `:`, `~`, `-`, `(`, `)`, `[`, `]`, `{`, `}`, `.`, `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `_`, `+`, `=`, `|`, `\`, `<`, `>`, `/`
28
+ * Space: `' '`, `\f`, `\n`, `\r`, `\t`, `\v`
29
+ * Visible: `0` - `9`, `a` - `z`, `A` - `Z`, `'`, `"`, `` ` ``, `,`, `;`, `:`, `~`, `-`, `(`, `)`, `[`, `]`, `{`, `}`, `.`, `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `_`, `+`, `=`, `|`, `\`, `<`, `>`, `/`
30
+ * Printable: `0` - `9`, `a` - `z`, `A` - `Z`, `' '`, `'`, `"`, `` ` ``, `,`, `;`, `:`, `~`, `-`, `(`, `)`, `[`, `]`, `{`, `}`, `.`, `?`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, <code>*</code>, <code>_</code>, `+`, `=`, `|`, `\`, `<`, `>`, `/`, `\f`, `\n`, `\r`, `\t`, `\v`
31
+ * Control: `\x00` - `\x1f`, `\x7f`
32
+ * Signed ASCII: `\x00` - `\x7f`
33
+ * ASCII: `\x00` - `\xff`
40
34
 
41
35
  ## Examples
42
36
 
43
37
  Determine whether a byte belongs to a character set:
44
38
 
45
- 0x41.alpha?
46
- # => true
39
+ ```ruby
40
+ 0x41.alpha?
41
+ # => true
42
+ ```
47
43
 
48
44
  Determine whether a String belongs to a character set:
49
45
 
50
- "22e1c0".hex?
51
- # => true
52
-
53
- Find all sub-strings that belong to a character set within a String:
54
-
55
- ls = File.read('/bin/ls')
56
- Chars.printable.strings_in(ls)
57
- # => ["/lib64/ld-linux-x86-64.so.2", "KIq/", "5J~!", "%L~!", ...]
46
+ ```ruby
47
+ "22e1c0".hex?
48
+ # => true
49
+ ```
58
50
 
59
51
  Return a random character from the set of all characters:
60
52
 
61
- Chars.all.random_char
62
- # => "\x94"
53
+ ```ruby
54
+ Chars.all.random_char
55
+ # => "\x94"
56
+ ```
63
57
 
64
58
  Return a random Array of characters from the alpha-numeric character set:
65
59
 
66
- Chars.alpha_numeric.random_chars(10)
67
- # => ["Q", "N", "S", "4", "x", "z", "3", "M", "F", "F"]
60
+ ```ruby
61
+ Chars.alpha_numeric.random_chars(10)
62
+ # => ["Q", "N", "S", "4", "x", "z", "3", "M", "F", "F"]
63
+ ```
68
64
 
69
65
  Return a random Array of a random length of unique characters from the
70
66
  visible character set:
71
67
 
72
- Chars.visible.random_distinct_chars(1..10)
73
- # => ["S", "l", "o", "8", "'", "q"]
68
+ ```ruby
69
+ Chars.visible.random_distinct_chars(1..10)
70
+ # => ["S", "l", "o", "8", "'", "q"]
71
+ ```
74
72
 
75
73
  Return a random String from the set of all characters:
76
74
 
77
- Chars.all.random_string(10)
78
- # => "\xc2h\xad\xccm7\x1e6J\x13"
75
+ ```ruby
76
+ Chars.all.random_string(10)
77
+ # => "\xc2h\xad\xccm7\x1e6J\x13"
78
+ ```
79
+
80
+ Generate a secure password:
81
+
82
+ ```ruby
83
+ require 'securerandom'
84
+ Chars.visible.random_string(10..14, random: SecureRandom)
85
+ # => ".*$X=D*XK2h8gC"
86
+ ```
79
87
 
80
88
  Return a random String with a random length between 5 and 10, from the
81
89
  set of space characters:
82
90
 
83
- Chars.space.random_string(5..10)
84
- # => "\r\v\n\t\n\f"
91
+ ```ruby
92
+ Chars.space.random_string(5..10)
93
+ # => "\r\v\n\t\n\f"
94
+ ```
95
+
96
+ Find all sub-strings that belong to a character set within a String:
97
+
98
+ ```ruby
99
+ ls = File.binread('/bin/ls')
100
+ Chars.printable.substrings(ls)
101
+ # =>
102
+ # ["/lib64/ld-linux-x86-64.so.2",
103
+ # "_ITM_deregisterTMCloneTable",
104
+ # "__gmon_start__",
105
+ # "_ITM_registerTMCloneTable",
106
+ # ...
107
+ # ]
108
+ ```
109
+
110
+ Find all sub-strings that belong to a character set within a String, with
111
+ indexes:
112
+
113
+ ```ruby
114
+ ls = File.binread('/bin/ls')
115
+ Chars.printable.substrings_with_indexes(ls)
116
+ # =>
117
+ # [["/lib64/ld-linux-x86-64.so.2", 792],
118
+ # ["_ITM_deregisterTMCloneTable", 4009],
119
+ # ["__gmon_start__", 4037],
120
+ # ["_ITM_registerTMCloneTable", 4052],
121
+ # ...
122
+ # ]
123
+ ```
124
+
125
+ Enumerate over all strings from a character set of a given length:
126
+
127
+ ```ruby
128
+ passwords = Chars.visible.strings_of_length(6)
129
+ passwords.each { |password| puts password }
130
+ # AAAAAA
131
+ # AAAAAB
132
+ # AAAAAC
133
+ # ...
134
+ ```
135
+
136
+ Enumerate over all strings from a character set of lengths between 4 and 8:
137
+
138
+ ```ruby
139
+ passwords = Chars.visible.strings_of_length(4..8)
140
+ passwords.each { |password| puts password }
141
+ # AAAA
142
+ # AAAB
143
+ # AAAC
144
+ # ...
145
+ ```
85
146
 
86
147
  ## Requirements
87
148
 
88
- * [ruby](http://www.ruby-lang.org/) >= 1.8.7
149
+ * [ruby](https://www.ruby-lang.org/) >= 2.0.0
89
150
 
90
151
  ## Install
91
152
 
92
- $ sudo gem install chars
153
+ $ gem install chars
154
+
155
+ ### gemspec
156
+
157
+ ```ruby
158
+ gem.add_dependency 'chars', '~> 0.3'
159
+ ```
160
+
161
+ ### Gemfile
162
+
163
+ ```ruby
164
+ gem 'chars', '~> 0.3'
165
+ ```
166
+
167
+ ## Crystal
168
+
169
+ [chars.cr] is a [Crystal] port of this library.
170
+
171
+ [chars.cr]: https://github.com/postmodern/chars.cr
172
+ [Crystal]: https://crystal-lang.org/
93
173
 
94
174
  ## License
95
175
 
data/Rakefile CHANGED
@@ -1,36 +1,12 @@
1
1
  require 'rubygems'
2
- require 'rake'
3
2
 
4
- begin
5
- gem 'ore-tasks', '~> 0.4'
6
- require 'ore/tasks'
3
+ require 'rubygems/tasks'
4
+ Gem::Tasks.new
7
5
 
8
- Ore::Tasks.new
9
- rescue LoadError => e
10
- STDERR.puts e.message
11
- STDERR.puts "Run `gem install ore-tasks` to install 'ore/tasks'."
12
- end
13
-
14
- begin
15
- gem 'rspec', '~> 2.4'
16
- require 'rspec/core/rake_task'
17
-
18
- RSpec::Core::RakeTask.new
19
- rescue LoadError => e
20
- task :spec do
21
- abort "Please run `gem install rspec` to install RSpec."
22
- end
23
- end
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new
24
8
  task :test => :spec
25
9
  task :default => :spec
26
10
 
27
- begin
28
- gem 'yard', '~> 0.6.0'
29
- require 'yard'
30
-
31
- YARD::Rake::YardocTask.new
32
- rescue LoadError => e
33
- task :yard do
34
- abort "Please run `gem install yard` to install YARD."
35
- end
36
- end
11
+ require 'yard'
12
+ YARD::Rake::YardocTask.new
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.expand_path(File.join(__dir__,'..','lib')))
4
+
5
+ require 'chars'
6
+ require 'benchmark'
7
+
8
+ CHARSET = Chars::ALPHA_NUMERIC
9
+ N = 1_000_000
10
+ STRING = ('A' * N) + '!'
11
+ ENUM = (['A', 0x42] * (N / 2)) << '!'
12
+
13
+ Benchmark.bm(12) do |b|
14
+ b.report('String') { CHARSET === STRING }
15
+ b.report('Enumerable') { CHARSET === ENUM }
16
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.expand_path(File.join(__dir__,'..','lib')))
4
+
5
+ require 'chars'
6
+ require 'benchmark'
7
+
8
+ CHARSET = Chars::ALPHA_NUMERIC
9
+ STRING = File.binread('/usr/bin/openssl')
10
+
11
+ Benchmark.bm(41) do |b|
12
+ b.report('Chars::CharSet#each_substring_with_index') do
13
+ CHARSET.each_substring_with_index(STRING) { |string,index| }
14
+ end
15
+
16
+ b.report('Chars::CharSet#each_substring') do
17
+ CHARSET.each_substring(STRING) { |string| }
18
+ end
19
+
20
+ (5..20).step(5) do |n|
21
+ b.report("Chars::CharSet#each_substring (length=#{n})") do
22
+ CHARSET.strings_in(STRING, :length => n) { |offset,string| }
23
+ end
24
+ end
25
+ end
data/chars.gemspec CHANGED
@@ -2,126 +2,60 @@
2
2
 
3
3
  require 'yaml'
4
4
 
5
- Gem::Specification.new do |gemspec|
6
- files = if File.directory?('.git')
7
- `git ls-files`.split($/)
8
- elsif File.directory?('.hg')
9
- `hg manifest`.split($/)
10
- elsif File.directory?('.svn')
11
- `svn ls -R`.split($/).select { |path| File.file?(path) }
12
- else
13
- Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
14
- end
5
+ Gem::Specification.new do |gem|
6
+ gemspec = YAML.load_file('gemspec.yml')
15
7
 
16
- filter_files = lambda { |paths|
17
- case paths
18
- when Array
19
- (files & paths)
20
- when String
21
- (files & Dir[paths])
22
- end
23
- }
24
-
25
- version = {
26
- :file => 'lib/chars/version.rb',
27
- :constant => 'Chars::VERSION'
28
- }
29
-
30
- defaults = {
31
- 'name' => File.basename(File.dirname(__FILE__)),
32
- 'files' => files,
33
- 'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
34
- 'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
35
- 'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}'],
36
- }
37
-
38
- metadata = defaults.merge(YAML.load_file('gemspec.yml'))
39
-
40
- gemspec.name = metadata.fetch('name',defaults[:name])
41
- gemspec.version = if metadata['version']
42
- metadata['version']
43
- elsif File.file?(version[:file])
44
- require File.join('.',version[:file])
45
- eval(version[:constant])
46
- end
47
-
48
- gemspec.summary = metadata.fetch('summary',metadata['description'])
49
- gemspec.description = metadata.fetch('description',metadata['summary'])
50
-
51
- case metadata['license']
52
- when Array
53
- gemspec.licenses = metadata['license']
54
- when String
55
- gemspec.license = metadata['license']
56
- end
57
-
58
- case metadata['authors']
59
- when Array
60
- gemspec.authors = metadata['authors']
61
- when String
62
- gemspec.author = metadata['authors']
63
- end
8
+ gem.name = gemspec.fetch('name')
9
+ gem.version = gemspec.fetch('version') do
10
+ lib_dir = File.join(File.dirname(__FILE__),'lib')
11
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
64
12
 
65
- gemspec.email = metadata['email']
66
- gemspec.homepage = metadata['homepage']
13
+ require 'chars/version'
14
+ Chars::VERSION
15
+ end
67
16
 
68
- case metadata['require_paths']
69
- when Array
70
- gemspec.require_paths = metadata['require_paths']
71
- when String
72
- gemspec.require_path = metadata['require_paths']
73
- end
17
+ gem.summary = gemspec['summary']
18
+ gem.description = gemspec['description']
19
+ gem.licenses = Array(gemspec['license'])
20
+ gem.authors = Array(gemspec['authors'])
21
+ gem.email = gemspec['email']
22
+ gem.homepage = gemspec['homepage']
23
+ gem.metadata = gemspec['metadata'] if gemspec['metadata']
74
24
 
75
- gemspec.files = filter_files[metadata['files']]
25
+ glob = lambda { |patterns| gem.files & Dir[*patterns] }
76
26
 
77
- gemspec.executables = metadata['executables']
78
- gemspec.extensions = metadata['extensions']
27
+ gem.files = `git ls-files`.split($/)
28
+ gem.files = glob[gemspec['files']] if gemspec['files']
79
29
 
80
- if Gem::VERSION < '1.7.'
81
- gemspec.default_executable = gemspec.executables.first
30
+ gem.executables = gemspec.fetch('executables') do
31
+ glob['bin/*'].map { |path| File.basename(path) }
82
32
  end
33
+ gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
83
34
 
84
- gemspec.test_files = filter_files[metadata['test_files']]
85
-
86
- unless gemspec.files.include?('.document')
87
- gemspec.extra_rdoc_files = metadata['extra_doc_files']
88
- end
89
-
90
- gemspec.post_install_message = metadata['post_install_message']
91
- gemspec.requirements = metadata['requirements']
92
-
93
- if gemspec.respond_to?(:required_ruby_version=)
94
- gemspec.required_ruby_version = metadata['required_ruby_version']
95
- end
35
+ gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
36
+ gem.test_files = glob[gemspec['test_files'] || '{test/{**/}*_test.rb']
37
+ gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
96
38
 
97
- if gemspec.respond_to?(:required_rubygems_version=)
98
- gemspec.required_rubygems_version = metadata['required_ruby_version']
99
- end
39
+ gem.require_paths = Array(gemspec.fetch('require_paths') {
40
+ %w[ext lib].select { |dir| File.directory?(dir) }
41
+ })
100
42
 
101
- parse_versions = lambda { |versions|
102
- case versions
103
- when Array
104
- versions.map { |v| v.to_s }
105
- when String
106
- versions.split(/,\s*/)
107
- end
108
- }
43
+ gem.requirements = gemspec['requirements']
44
+ gem.required_ruby_version = gemspec['required_ruby_version']
45
+ gem.required_rubygems_version = gemspec['required_rubygems_version']
46
+ gem.post_install_message = gemspec['post_install_message']
109
47
 
110
- if metadata['dependencies']
111
- metadata['dependencies'].each do |name,versions|
112
- gemspec.add_dependency(name,parse_versions[versions])
113
- end
114
- end
48
+ split = lambda { |string| string.split(/,\s*/) }
115
49
 
116
- if metadata['runtime_dependencies']
117
- metadata['runtime_dependencies'].each do |name,versions|
118
- gemspec.add_runtime_dependency(name,parse_versions[versions])
50
+ if gemspec['dependencies']
51
+ gemspec['dependencies'].each do |name,versions|
52
+ gem.add_dependency(name,split[versions])
119
53
  end
120
54
  end
121
55
 
122
- if metadata['development_dependencies']
123
- metadata['development_dependencies'].each do |name,versions|
124
- gemspec.add_development_dependency(name,parse_versions[versions])
56
+ if gemspec['development_dependencies']
57
+ gemspec['development_dependencies'].each do |name,versions|
58
+ gem.add_development_dependency(name,split[versions])
125
59
  end
126
60
  end
127
61
  end
data/gemspec.yml CHANGED
@@ -5,14 +5,18 @@ description:
5
5
  recognizing text and generating random text from specific character sets.
6
6
 
7
7
  license: MIT
8
- homepage: http://github.com/postmodern/chars
8
+ homepage: https://github.com/postmodern/chars.rb#readme
9
9
  authors: Postmodern
10
10
  email: postmodern.mod3@gmail.com
11
11
  has_yard: true
12
12
 
13
- required_ruby_version: ">= 1.8.7"
13
+ metadata:
14
+ documentation_uri: https://rubydoc.info/gems/chars
15
+ source_code_uri: https://github.com/postmodern/chars.rb
16
+ bug_tracker_uri: https://github.com/postmodern/chars.rb/issues
17
+ changelog_uri: https://github.com/postmodern/chars.rb/blob/master/ChangeLog.md
18
+
19
+ required_ruby_version: ">= 2.0.0"
14
20
 
15
21
  development_dependencies:
16
- ore-tasks: ~> 0.4
17
- rspec: ~> 2.4
18
- yard: ~> 0.6.1
22
+ bundler: ~> 2.0