midwire_common 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -1
- data/README.md +1 -1
- data/lib/midwire_common/all.rb +0 -1
- data/lib/midwire_common/array.rb +2 -1
- data/lib/midwire_common/enumerable.rb +1 -3
- data/lib/midwire_common/hash.rb +10 -8
- data/lib/midwire_common/rake_helper.rb +3 -119
- data/lib/midwire_common/string.rb +1 -0
- data/lib/midwire_common/time.rb +1 -1
- data/lib/midwire_common/version.rb +1 -1
- data/lib/midwire_common.rb +1 -1
- data/lib/tasks/version.rake +51 -35
- data/midwire_common.gemspec +5 -4
- data/spec/lib/midwire_common/array_spec.rb +0 -2
- data/spec/lib/midwire_common/enumerable_spec.rb +1 -1
- data/spec/lib/midwire_common/hash_spec.rb +1 -1
- data/spec/lib/midwire_common/rake_helper_spec.rb +30 -0
- data/spec/lib/midwire_common/yaml_setting_spec.rb +1 -1
- metadata +7 -5
- data/.rubocop.yml +0 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d307d5ad84f9e843f0b140b76cc4d1caa9c199ed
|
4
|
+
data.tar.gz: 9caa3bff2e935878df2542260cb6215b19c03aaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1d18c918e5f6a8911883b96ee018925abfa5a0c2796ba14c1f3b0af896a173b792370b4d1170d3554b922a0afedbfa711039ee66d49b2da6432ce3b04d2a432
|
7
|
+
data.tar.gz: 1d094b78ea0d0d8e525e1490422b1a8540ac912f9cfd498988559b2aef721b8702d8e156ea2d4b37ea4c76a8a3ce2a2409280c28ac565b9d5d9dbad153608800
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
*0.3.0* (March 10, 2016)
|
2
|
+
|
3
|
+
* Cleanup the code
|
4
|
+
* Refactor version.rake
|
5
|
+
|
1
6
|
*0.2.0* (March 10, 2016)
|
2
7
|
|
3
8
|
* Call `load` before returning data in YamlSetting
|
@@ -14,7 +19,7 @@
|
|
14
19
|
* Add 'snakerirze' and 'camelize' methods in string.rb
|
15
20
|
* Fix `version:bump` rake task to use single-quote string for VERSION.
|
16
21
|
* Remove 'pry' dependency for 'version.rake'
|
17
|
-
* Upgrade rubocop version
|
22
|
+
* Upgrade rubocop version
|
18
23
|
* Update the README.
|
19
24
|
* Add some specs to cover changes.
|
20
25
|
|
data/README.md
CHANGED
data/lib/midwire_common/all.rb
CHANGED
@@ -6,7 +6,6 @@ require 'midwire_common/fixnum'
|
|
6
6
|
require 'midwire_common/float'
|
7
7
|
require 'midwire_common/hash'
|
8
8
|
require 'midwire_common/string'
|
9
|
-
# require 'midwire_common/system_command'
|
10
9
|
require 'midwire_common/time'
|
11
10
|
require 'midwire_common/time_tool'
|
12
11
|
require 'midwire_common/yaml_setting'
|
data/lib/midwire_common/array.rb
CHANGED
@@ -43,7 +43,8 @@ class Array
|
|
43
43
|
# [[1,2],[2,3]].superjoin( %w{<table><tr> </tr><tr> </tr></table>}, %w{<td> </td><td> </td>} )
|
44
44
|
# => <table><tr><td>1</td><td>2</td></tr><tr><td>2</td><td>3</td></tr></table>
|
45
45
|
def superjoin(*ldescr)
|
46
|
-
d
|
46
|
+
d = ldescr[0]
|
47
|
+
rest = ldescr[1..-1]
|
47
48
|
d[0] + map do |a|
|
48
49
|
(a.respond_to?(:superjoin) && rest.length > 0) ? a.superjoin(*rest) : a.to_s
|
49
50
|
end.join(d[1]) + d[2]
|
@@ -1,12 +1,10 @@
|
|
1
1
|
module Enumerable
|
2
2
|
# Sort by frequency of occurrence
|
3
|
-
# rubocop:disable Style/EachWithObject
|
4
3
|
def sort_by_frequency
|
5
|
-
histogram =
|
4
|
+
histogram = each_with_object(Hash.new(0)) do |x, hash|
|
6
5
|
hash[x] += 1
|
7
6
|
hash
|
8
7
|
end
|
9
8
|
sort_by { |x| [histogram[x] * -1, x] }
|
10
9
|
end
|
11
|
-
# rubocop:enable Style/EachWithObject
|
12
10
|
end
|
data/lib/midwire_common/hash.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class BottomlessHash < Hash
|
2
2
|
def initialize
|
3
|
-
super
|
3
|
+
super(&-> (h, k) { h[k] = self.class.new })
|
4
4
|
end
|
5
5
|
|
6
6
|
def self.from_hash(hash)
|
@@ -20,18 +20,20 @@ class Hash
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
# rubocop:disable Metrics/AbcSize
|
23
24
|
def diff(other)
|
24
25
|
(keys + other.keys).uniq.each_with_object({}) do |key, memo|
|
25
26
|
unless self[key] == other[key]
|
26
|
-
if self[key].is_a?(Hash) && other[key].is_a?(Hash)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
memo[key] = if self[key].is_a?(Hash) && other[key].is_a?(Hash)
|
28
|
+
self[key].diff(other[key])
|
29
|
+
else
|
30
|
+
[self[key], other[key]]
|
31
|
+
end
|
31
32
|
end
|
32
33
|
memo
|
33
34
|
end
|
34
35
|
end
|
36
|
+
# rubocop:enable Metrics/AbcSize
|
35
37
|
|
36
38
|
# TODO: Spec/Test this method
|
37
39
|
def apply_diff!(changes, direction = :right)
|
@@ -85,7 +87,7 @@ class Hash
|
|
85
87
|
# ... and now h == { :b => 2, :c => 3}
|
86
88
|
def pop(*keys)
|
87
89
|
r = reject { |k, _v| !keys.flatten.include? k.to_sym }
|
88
|
-
|
90
|
+
reject! { |k, _v| keys.flatten.include? k.to_sym }
|
89
91
|
r
|
90
92
|
end
|
91
93
|
|
@@ -113,7 +115,7 @@ class Hash
|
|
113
115
|
# Recursively change keys to symbols
|
114
116
|
# Modifies the hash keys in place.
|
115
117
|
def recursively_symbolize_keys!
|
116
|
-
|
118
|
+
symbolize_keys!
|
117
119
|
values.each do |v|
|
118
120
|
v.recursively_symbolize_keys! if v.is_a? Hash
|
119
121
|
end
|
@@ -3,7 +3,6 @@ require 'midwire_common'
|
|
3
3
|
|
4
4
|
module MidwireCommon
|
5
5
|
# RakeHelper helps to automate gem release and versioning tasks
|
6
|
-
# rubocop:disable Metrics/ClassLength
|
7
6
|
class RakeHelper
|
8
7
|
include Rake::DSL if defined? Rake::DSL
|
9
8
|
|
@@ -12,130 +11,15 @@ module MidwireCommon
|
|
12
11
|
new(dir).install
|
13
12
|
end
|
14
13
|
|
15
|
-
attr_reader :
|
14
|
+
attr_reader :basedir
|
16
15
|
|
17
|
-
def initialize(
|
18
|
-
@
|
16
|
+
def initialize(basedir)
|
17
|
+
@basedir = basedir
|
19
18
|
end
|
20
19
|
|
21
20
|
def install
|
22
21
|
task_dir = File.expand_path('../tasks', File.dirname(__FILE__))
|
23
22
|
Dir["#{task_dir}/*.rake"].sort.each { |ext| load ext }
|
24
23
|
end
|
25
|
-
|
26
|
-
# def build_gem
|
27
|
-
# file_name = nil
|
28
|
-
# sh("gem build -V '#{spec_path}'") { |out, code|
|
29
|
-
# file_name = File.basename(built_gem_path)
|
30
|
-
# FileUtils.mkdir_p(File.join(base, 'pkg'))
|
31
|
-
# FileUtils.mv(built_gem_path, 'pkg')
|
32
|
-
# Bundler.ui.confirm "#{name} #{version} built to pkg/#{file_name}"
|
33
|
-
# }
|
34
|
-
# File.join(base, 'pkg', file_name)
|
35
|
-
# end
|
36
|
-
|
37
|
-
def install_gem
|
38
|
-
built_gem_path = build_gem
|
39
|
-
out, _ = sh_with_code("gem install '#{built_gem_path}'")
|
40
|
-
msg = <<-string.here_with_pipe
|
41
|
-
|Couldn't install gem, run `gem install #{built_gem_path}'
|
42
|
-
| for more detailed output
|
43
|
-
string
|
44
|
-
fail msg unless out[/Successfully installed/]
|
45
|
-
Bundler.ui.confirm "#{name} (#{version}) installed"
|
46
|
-
end
|
47
|
-
|
48
|
-
def release_gem
|
49
|
-
guard_clean
|
50
|
-
guard_already_tagged
|
51
|
-
built_gem_path = build_gem
|
52
|
-
tag_version do
|
53
|
-
git_push
|
54
|
-
rubygem_push(built_gem_path)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
protected
|
59
|
-
|
60
|
-
def rubygem_push(path)
|
61
|
-
if Pathname.new('~/.gem/credentials').expand_path.exist?
|
62
|
-
sh("gem push '#{path}'")
|
63
|
-
Bundler.ui.confirm "Pushed #{name} #{version} to rubygems.org"
|
64
|
-
else
|
65
|
-
fail <<-string.here_with_pipe
|
66
|
-
|Your rubygems.org credentials aren't set.
|
67
|
-
| Run `gem push` to set them.
|
68
|
-
string
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def built_gem_path
|
73
|
-
Dir[File.join(base, "#{name}-*.gem")].sort_by { |f| File.mtime(f) }.last
|
74
|
-
end
|
75
|
-
|
76
|
-
def git_push
|
77
|
-
perform_git_push
|
78
|
-
perform_git_push ' --tags'
|
79
|
-
Bundler.ui.confirm 'Pushed git commits and tags'
|
80
|
-
end
|
81
|
-
|
82
|
-
def perform_git_push(options = '')
|
83
|
-
cmd = "git push #{options}"
|
84
|
-
out, code = sh_with_code(cmd)
|
85
|
-
msg = <<-string.here_with_pipe
|
86
|
-
|Couldn't git push. `#{cmd}' failed with the following output:\n\n
|
87
|
-
|#{out}\n
|
88
|
-
string
|
89
|
-
fail msg unless code == 0
|
90
|
-
end
|
91
|
-
|
92
|
-
def guard_already_tagged
|
93
|
-
already_included = sh('git tag').split(/\n/).include?(version_tag)
|
94
|
-
msg = 'This tag has already been committed to the repo.'
|
95
|
-
fail(msg) if already_included
|
96
|
-
end
|
97
|
-
|
98
|
-
def guard_clean
|
99
|
-
clean? || fail('There are files that need to be committed first.')
|
100
|
-
end
|
101
|
-
|
102
|
-
def clean?
|
103
|
-
sh_with_code('git diff --exit-code')[1] == 0
|
104
|
-
end
|
105
|
-
|
106
|
-
def tag_version
|
107
|
-
sh "git tag -a -m \"Version #{version}\" #{version_tag}"
|
108
|
-
Bundler.ui.confirm "Tagged #{version_tag}"
|
109
|
-
yield if block_given?
|
110
|
-
rescue
|
111
|
-
Bundler.ui.error "Untagged #{version_tag} due to error"
|
112
|
-
sh_with_code "git tag -d #{version_tag}"
|
113
|
-
raise
|
114
|
-
end
|
115
|
-
|
116
|
-
def sh(cmd, &block)
|
117
|
-
out, code = sh_with_code(cmd, &block)
|
118
|
-
msg = <<-string.here_with_pipe
|
119
|
-
|Running `#{cmd}' failed.
|
120
|
-
| Run this command directly for more detailed output.
|
121
|
-
string
|
122
|
-
if code == 0
|
123
|
-
out
|
124
|
-
else
|
125
|
-
fail(out.empty? ? msg : out)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def sh_with_code(cmd, &block)
|
130
|
-
cmd << ' 2>&1'
|
131
|
-
outbuf = ''
|
132
|
-
Bundler.ui.debug(cmd)
|
133
|
-
Dir.chdir(base) do
|
134
|
-
outbuf = `#{cmd}`
|
135
|
-
block.call(outbuf) if block if $CHILD_STATUS == 0
|
136
|
-
end
|
137
|
-
[outbuf, $CHILD_STATUS]
|
138
|
-
end
|
139
24
|
end
|
140
|
-
# rubocop:enable Metrics/ClassLength
|
141
25
|
end
|
data/lib/midwire_common/time.rb
CHANGED
data/lib/midwire_common.rb
CHANGED
data/lib/tasks/version.rake
CHANGED
@@ -4,18 +4,8 @@ require 'readline'
|
|
4
4
|
require 'fileutils'
|
5
5
|
require 'midwire_common/string'
|
6
6
|
|
7
|
-
module Bundler
|
8
|
-
class GemHelper
|
9
|
-
# Push the gem to your own internal gem inabox server
|
10
|
-
# def rubygem_push(path)
|
11
|
-
# sh("gem inabox '#{path}'")
|
12
|
-
# Bundler.ui.confirm "Pushed #{name} #{version} to #{path}"
|
13
|
-
# end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
7
|
namespace :version do
|
18
|
-
PROJECT_ROOT = File.expand_path(FileUtils.pwd)
|
8
|
+
PROJECT_ROOT = File.expand_path(FileUtils.pwd).freeze
|
19
9
|
PROJECT_NAME = ENV['PROJECT_NAME'] || File.basename(PROJECT_ROOT)
|
20
10
|
|
21
11
|
desc 'Write changes to the CHANGELOG'
|
@@ -27,46 +17,42 @@ namespace :version do
|
|
27
17
|
)
|
28
18
|
text << "\n"
|
29
19
|
prepend_changelog(text)
|
30
|
-
|
20
|
+
launch_editor(changelog)
|
31
21
|
end
|
32
22
|
|
33
23
|
desc 'Increment the patch version and write changes to the changelog'
|
34
24
|
task :bump_patch do
|
35
|
-
exit unless
|
25
|
+
exit unless check_branch_and_warn
|
36
26
|
major, minor, patch = read_version
|
37
27
|
patch = patch.to_i + 1
|
38
|
-
|
39
|
-
|
40
|
-
readme = open('README.md').read
|
41
|
-
File.open('README.md', 'w') do |f|
|
42
|
-
# rubocop:disable Metrics/LineLength
|
43
|
-
f.write(readme.gsub(/^\*\*Version: [0-9\.]+\*\*$/, "**Version: #{version_string}**"))
|
44
|
-
# rubocop:enable Metrics/LineLength
|
45
|
-
end
|
28
|
+
write_version_file([major, minor, patch])
|
29
|
+
update_readme_version_string
|
46
30
|
Rake::Task['version:changes'].invoke
|
47
31
|
end
|
48
32
|
|
49
33
|
desc 'Alias for :bump_patch'
|
50
|
-
task bump: :bump_patch
|
34
|
+
task bump: :bump_patch
|
51
35
|
|
52
36
|
desc 'Increment the minor version and write changes to the changelog'
|
53
37
|
task :bump_minor do
|
54
|
-
exit unless
|
38
|
+
exit unless check_branch_and_warn
|
55
39
|
major, minor, _patch = read_version
|
56
40
|
minor = minor.to_i + 1
|
57
41
|
patch = 0
|
58
|
-
|
42
|
+
write_version_file([major, minor, patch])
|
43
|
+
update_readme_version_string
|
59
44
|
Rake::Task['version:changes'].invoke
|
60
45
|
end
|
61
46
|
|
62
47
|
desc 'Increment the major version and write changes to the changelog'
|
63
48
|
task :bump_major do
|
64
|
-
exit unless
|
49
|
+
exit unless check_branch_and_warn
|
65
50
|
major, _minor, _patch = read_version
|
66
51
|
major = major.to_i + 1
|
67
52
|
minor = 0
|
68
53
|
patch = 0
|
69
|
-
|
54
|
+
write_version_file([major, minor, patch])
|
55
|
+
update_readme_version_string
|
70
56
|
Rake::Task['version:changes'].invoke
|
71
57
|
end
|
72
58
|
|
@@ -88,14 +74,16 @@ namespace :version do
|
|
88
74
|
end
|
89
75
|
|
90
76
|
def read_version
|
91
|
-
|
77
|
+
silence_warnings do
|
78
|
+
load version_file_path
|
79
|
+
end
|
92
80
|
text = eval("#{module_name}::VERSION")
|
93
81
|
text.split('.')
|
94
82
|
end
|
95
83
|
|
96
|
-
def
|
84
|
+
def write_version_file(version_array)
|
97
85
|
version = version_array.join('.')
|
98
|
-
new_version = %( VERSION = '#{version}')
|
86
|
+
new_version = %( VERSION = '#{version}'.freeze)
|
99
87
|
lines = File.readlines(version_file_path)
|
100
88
|
File.open(version_file_path, 'w') do |f|
|
101
89
|
lines.each do |line|
|
@@ -108,11 +96,27 @@ namespace :version do
|
|
108
96
|
end
|
109
97
|
end
|
110
98
|
|
99
|
+
def update_readme_version_string
|
100
|
+
version_string = read_version.join('.')
|
101
|
+
readme = open('README.md').read
|
102
|
+
regex = /^\*\*Version: [0-9\.]+\*\*$/i
|
103
|
+
return nil unless readme =~ regex
|
104
|
+
File.open('README.md', 'w') do |f|
|
105
|
+
f.write(readme.gsub(regex, "**Version: #{version_string}**"))
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def changelog
|
110
|
+
return @changelog_path if @changelog_path
|
111
|
+
@changelog_path = File.join(PROJECT_ROOT, 'CHANGELOG')
|
112
|
+
FileUtils.touch(@changelog_path)
|
113
|
+
@changelog_path
|
114
|
+
end
|
115
|
+
|
111
116
|
def prepend_changelog(text_array)
|
112
|
-
|
113
|
-
old = File.read("#{PROJECT_ROOT}/CHANGELOG").to_s.chomp
|
117
|
+
old = File.read(changelog).to_s.chomp
|
114
118
|
text_array.push(old)
|
115
|
-
File.open(
|
119
|
+
File.open(changelog, 'w') do |f|
|
116
120
|
text_array.flatten.each do |line|
|
117
121
|
f.puts(line)
|
118
122
|
end
|
@@ -132,13 +136,13 @@ namespace :version do
|
|
132
136
|
# rubocop:enable Lint/AssignmentInCondition
|
133
137
|
|
134
138
|
def current_branch
|
135
|
-
`git
|
139
|
+
`git symbolic-ref --short HEAD`.chomp
|
136
140
|
end
|
137
141
|
|
138
142
|
def branch_warning_message
|
139
143
|
<<-string.here_with_pipe("\n")
|
140
144
|
|You typically do not want to bump versions on the 'master' branch
|
141
|
-
|unless you plan to rebase or back-merge into
|
145
|
+
|unless you plan to rebase or back-merge into 'develop'.
|
142
146
|
|
|
143
147
|
|If you don't care or don't know what I'm talking about just enter 'y'
|
144
148
|
|and continue.
|
@@ -151,7 +155,7 @@ namespace :version do
|
|
151
155
|
string
|
152
156
|
end
|
153
157
|
|
154
|
-
def
|
158
|
+
def check_branch_and_warn
|
155
159
|
return true unless current_branch == 'master'
|
156
160
|
puts(branch_warning_message)
|
157
161
|
while (line = $stdin.gets.chomp)
|
@@ -160,4 +164,16 @@ namespace :version do
|
|
160
164
|
return false
|
161
165
|
end
|
162
166
|
end
|
167
|
+
|
168
|
+
def launch_editor(file)
|
169
|
+
system("#{ENV['EDITOR']} #{file}") if ENV['EDITOR']
|
170
|
+
end
|
171
|
+
|
172
|
+
def silence_warnings
|
173
|
+
original_verbosity = $VERBOSE
|
174
|
+
$VERBOSE = nil
|
175
|
+
yield
|
176
|
+
ensure
|
177
|
+
$VERBOSE = original_verbosity
|
178
|
+
end
|
163
179
|
end
|
data/midwire_common.gemspec
CHANGED
@@ -5,14 +5,15 @@ Gem::Specification.new do |spec|
|
|
5
5
|
spec.name = 'midwire_common'
|
6
6
|
spec.version = MidwireCommon::VERSION
|
7
7
|
spec.authors = ['Chris Blackburn']
|
8
|
-
spec.email = ['
|
9
|
-
spec.description = 'A useful Ruby library'
|
8
|
+
spec.email = ['87a1779b@opayq.com']
|
10
9
|
spec.summary = 'Midwire Tech Ruby Library'
|
11
|
-
spec.
|
10
|
+
spec.description = 'A useful Ruby library'
|
11
|
+
spec.homepage = 'https://bitbucket.org/midwiretech/midwire_common'
|
12
|
+
spec.license = 'MIT'
|
12
13
|
|
13
14
|
spec.files = `git ls-files -z`.split("\x0")
|
14
15
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
-
spec.test_files = spec.files.grep(%r{^
|
16
|
+
spec.test_files = spec.files.grep(%r{^spec/})
|
16
17
|
spec.require_paths = ['lib']
|
17
18
|
|
18
19
|
spec.add_development_dependency 'rspec', '~> 2.14'
|
@@ -49,7 +49,6 @@ describe Array do
|
|
49
49
|
a.bsearch('c').should eq(2)
|
50
50
|
end
|
51
51
|
|
52
|
-
# rubocop:disable Metrics/LineLength
|
53
52
|
it 'can superjoin elements' do
|
54
53
|
[1, 2, 3].superjoin(['->', '+', '<-']).should eq('->1+2+3<-')
|
55
54
|
[[1, 2], [2, 3]].superjoin(
|
@@ -58,5 +57,4 @@ describe Array do
|
|
58
57
|
'<table><tr><td>1</td><td>2</td></tr><tr><td>2</td><td>3</td></tr></table>'
|
59
58
|
)
|
60
59
|
end
|
61
|
-
# rubocop:enable Metrics/LineLength
|
62
60
|
end
|
@@ -4,6 +4,6 @@ describe Enumerable do
|
|
4
4
|
it 'can sort by frequency of occurrences' do
|
5
5
|
[1, 2, 3, 3, 3, 3, 2].sort_by_frequency.should eq([3, 3, 3, 3, 2, 2, 1])
|
6
6
|
%w(a b c d e f a f f b f a).sort_by_frequency
|
7
|
-
|
7
|
+
.should eq(%w(f f f f a a a b b c d e))
|
8
8
|
end
|
9
9
|
end
|
@@ -118,7 +118,7 @@ describe Hash do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'reports different values' do
|
121
|
-
expect(h1_values.diff(h2_values)).to eq('c' => [3,
|
121
|
+
expect(h1_values.diff(h2_values)).to eq('c' => [3, 4])
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'reports different keys even with nested hashes' do
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module MidwireCommon
|
4
|
+
RSpec.describe RakeHelper do
|
5
|
+
let(:rake_helper) { described_class.new(Dir.pwd) }
|
6
|
+
|
7
|
+
context '#new' do
|
8
|
+
it 'returns an instance' do
|
9
|
+
expect(rake_helper).to be_a(described_class)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'sets @basedir' do
|
13
|
+
expect(rake_helper.basedir).to eq(Dir.pwd)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context '.install' do
|
18
|
+
it 'returns version.rake' do
|
19
|
+
file = rake_helper.install.first
|
20
|
+
expect(File.basename(file)).to eq('version.rake')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'loads version.rake' do
|
24
|
+
file = File.join(MidwireCommon.root, 'lib/tasks/version.rake')
|
25
|
+
expect(rake_helper).to receive(:load).with(file)
|
26
|
+
rake_helper.install
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: midwire_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Blackburn
|
@@ -152,14 +152,13 @@ dependencies:
|
|
152
152
|
version: '0.19'
|
153
153
|
description: A useful Ruby library
|
154
154
|
email:
|
155
|
-
-
|
155
|
+
- 87a1779b@opayq.com
|
156
156
|
executables: []
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
160
|
- ".gitignore"
|
161
161
|
- ".rspec"
|
162
|
-
- ".rubocop.yml"
|
163
162
|
- ".ruby-version"
|
164
163
|
- CHANGELOG
|
165
164
|
- Gemfile
|
@@ -193,13 +192,15 @@ files:
|
|
193
192
|
- spec/lib/midwire_common/fixnum_spec.rb
|
194
193
|
- spec/lib/midwire_common/float_spec.rb
|
195
194
|
- spec/lib/midwire_common/hash_spec.rb
|
195
|
+
- spec/lib/midwire_common/rake_helper_spec.rb
|
196
196
|
- spec/lib/midwire_common/string_spec.rb
|
197
197
|
- spec/lib/midwire_common/time_spec.rb
|
198
198
|
- spec/lib/midwire_common/time_tool_spec.rb
|
199
199
|
- spec/lib/midwire_common/yaml_setting_spec.rb
|
200
200
|
- spec/spec_helper.rb
|
201
|
-
homepage: https://
|
202
|
-
licenses:
|
201
|
+
homepage: https://bitbucket.org/midwiretech/midwire_common
|
202
|
+
licenses:
|
203
|
+
- MIT
|
203
204
|
metadata: {}
|
204
205
|
post_install_message:
|
205
206
|
rdoc_options: []
|
@@ -229,6 +230,7 @@ test_files:
|
|
229
230
|
- spec/lib/midwire_common/fixnum_spec.rb
|
230
231
|
- spec/lib/midwire_common/float_spec.rb
|
231
232
|
- spec/lib/midwire_common/hash_spec.rb
|
233
|
+
- spec/lib/midwire_common/rake_helper_spec.rb
|
232
234
|
- spec/lib/midwire_common/string_spec.rb
|
233
235
|
- spec/lib/midwire_common/time_spec.rb
|
234
236
|
- spec/lib/midwire_common/time_tool_spec.rb
|
data/.rubocop.yml
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
Style/Documentation:
|
2
|
-
Enabled: false
|
3
|
-
|
4
|
-
Style/AlignParameters:
|
5
|
-
EnforcedStyle: with_fixed_indentation
|
6
|
-
|
7
|
-
Metrics/MethodLength:
|
8
|
-
CountComments: false # count full line comments?
|
9
|
-
Max: 16
|
10
|
-
|
11
|
-
Style/RegexpLiteral:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
Encoding:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
# MethodLength:
|
18
|
-
# CountComments: false
|
19
|
-
# Max: 30
|
20
|
-
|
21
|
-
#AlignHash:
|
22
|
-
# EnforcedColonStyle: table
|
23
|
-
# EnforcedHashRocketStyle: table
|
24
|
-
|
25
|
-
HashSyntax:
|
26
|
-
Enabled: true
|
27
|
-
|
28
|
-
Lambda:
|
29
|
-
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
30
|
-
Enabled: true
|
31
|
-
|
32
|
-
LambdaCall:
|
33
|
-
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
34
|
-
Enabled: true
|
35
|
-
|
36
|
-
LineLength:
|
37
|
-
Max: 80
|
38
|
-
|
39
|
-
AlignParameters:
|
40
|
-
Description: >
|
41
|
-
Align the parameters of a method call if they span more
|
42
|
-
than one line.
|
43
|
-
Enabled: false
|
44
|
-
|
45
|
-
# Checks formatting of special comments
|
46
|
-
CommentAnnotation:
|
47
|
-
Keywords:
|
48
|
-
- TODO
|
49
|
-
- FIXME
|
50
|
-
- OPTIMIZE
|
51
|
-
- HACK
|
52
|
-
- REVIEW
|
53
|
-
|
54
|
-
AllCops:
|
55
|
-
# Include gemspec and Rakefile
|
56
|
-
Include:
|
57
|
-
- '**/*.gemspec'
|
58
|
-
- '**/*.podspec'
|
59
|
-
- '**/*.jbuilder'
|
60
|
-
- '**/*.rake'
|
61
|
-
- '**/Gemfile'
|
62
|
-
- '**/Rakefile'
|
63
|
-
- '**/Capfile'
|
64
|
-
- '**/Guardfile'
|
65
|
-
- '**/Podfile'
|
66
|
-
- '**/Thorfile'
|
67
|
-
- '**/Vagrantfile'
|
68
|
-
Exclude:
|
69
|
-
- 'vendor/**/*'
|
70
|
-
- 'stubs/**/*'
|
71
|
-
|
72
|
-
Lint/Eval:
|
73
|
-
Enabled: false
|