mosso 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb7e22adeb977ca4005c2d90bb990da34a87a504
4
- data.tar.gz: 39d726f44bdd5c9736125ac15a56d67619b47dbd
3
+ metadata.gz: 1716c3a7b665a15502d453527718dc8511a60e7a
4
+ data.tar.gz: d196f3b7cfd8de8e99c9c0edb2c41f9b238e0a85
5
5
  SHA512:
6
- metadata.gz: af265b7610de6995534c4b8f9deea1c28c0511ab614d5050c133edda87ba3dfb3b4499b3997da9449177e06aafb82adaf94dc7100ecaed6194b77b4ba85c5895
7
- data.tar.gz: e64baa532eaba7a4b7f1c49eedac7469c55ce06e53accae7eb138cc32cab83fa2479059dd99f50482f336c3c396cc4fcfc70fecd542671276ba603c7c6da1dc7
6
+ metadata.gz: b33d73da36ce8291778267c8b6b8f2bc2356043bc675b126d5c410986282ea332610c9c03ef837e7ef3a50fe6a81caee216942b117bdaaeae0205d659e87a577
7
+ data.tar.gz: 2205b0696fce5e002629e01b96194bc1e21dcc628c89352f270da2d956334294f2986c1165eb5e2f43bbba09b5302092b92516dc424b38fa9a17d5f6fa008a30
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  pkg
19
+ .idea
@@ -0,0 +1,69 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2014-10-05 01:04:18 +0900 using RuboCop version 0.26.1.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 4
9
+ # Cop supports --auto-correct.
10
+ Style/DefWithParentheses:
11
+ Enabled: true
12
+
13
+ # Offense count: 2
14
+ Style/Documentation:
15
+ Enabled: true
16
+
17
+ # Offense count: 1
18
+ # Configuration parameters: MinBodyLength.
19
+ Style/GuardClause:
20
+ Enabled: true
21
+
22
+ # Offense count: 1
23
+ # Cop supports --auto-correct.
24
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
25
+ Style/HashSyntax:
26
+ Enabled: true
27
+
28
+ # Offense count: 7
29
+ # Cop supports --auto-correct.
30
+ Style/MethodCallParentheses:
31
+ Enabled: true
32
+
33
+ # Offense count: 2
34
+ # Cop supports --auto-correct.
35
+ # Configuration parameters: PreferredDelimiters.
36
+ Style/PercentLiteralDelimiters:
37
+ Enabled: true
38
+
39
+ # Offense count: 2
40
+ # Cop supports --auto-correct.
41
+ Style/PerlBackrefs:
42
+ Enabled: false
43
+
44
+ # Offense count: 2
45
+ Style/RegexpLiteral:
46
+ MaxSlashes: 0
47
+
48
+ # Offense count: 20
49
+ # Cop supports --auto-correct.
50
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
51
+ Style/StringLiterals:
52
+ Enabled: false
53
+
54
+ # Offense count: 2
55
+ # Cop supports --auto-correct.
56
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
57
+ Style/TrailingBlankLines:
58
+ Enabled: true
59
+
60
+ # Offense count: 12
61
+ # Cop supports --auto-correct.
62
+ Style/TrailingWhitespace:
63
+ Enabled: true
64
+
65
+ # Offense count: 2
66
+ # Cop supports --auto-correct.
67
+ Style/UnneededPercentQ:
68
+ Enabled: true
69
+
@@ -1,3 +1,7 @@
1
1
  language: ruby
2
+ before_install:
3
+ - gem update --system 2.1.11
4
+ - gem --version
2
5
  rvm:
3
- - 2.1.1
6
+ - 2.0.0
7
+ - 2.1.0
data/Gemfile CHANGED
@@ -2,3 +2,9 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in mosso.gemspec
4
4
  gemspec
5
+ gem "rspec", "~> 2.14.1"
6
+ gem "simplecov", "~> 0.9.1"
7
+ gem 'rubocop', '~> 0.26.1'
8
+ group :test do
9
+ gem 'coveralls', require: false
10
+ end
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Mosso
2
2
 
3
+ ![badge](https://badge.fury.io/rb/mosso.png) ![build](https://travis-ci.org/ryosy383/mosso.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/ryosy383/mosso/badge.png)](https://coveralls.io/r/ryosy383/mosso)
4
+
3
5
  Module to measure the execution time.
4
6
 
5
7
  ## Installation
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core'
3
+ require 'rspec/core/rake_task'
4
+ task default: [:spec]
3
5
 
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = 'spec/**/*_spec.rb'
8
+ end
@@ -1,30 +1,29 @@
1
1
  class Measure
2
-
3
- def initialize()
4
- start()
2
+ def initialize
3
+ start
5
4
  end
6
-
5
+
7
6
  def to_s
8
7
  ret = []
9
8
  file, line = parse_caller(caller.first)
10
- ret << "Exection Time: #{exection_time()} [sec]"
9
+ ret << "Exection Time: #{exection_time} [sec]"
11
10
  ret << "FileName: #{file}, Line: #{line}"
12
11
  ret << "\n"
13
- ret.join("\n")
12
+ ret.join("\n")
14
13
  end
15
-
16
- def start()
14
+
15
+ def start
17
16
  @start_time = Time.now
18
17
  end
19
-
20
- def reset()
21
- start()
18
+
19
+ def reset
20
+ start
22
21
  end
23
-
24
- def exection_time()
22
+
23
+ def exection_time
25
24
  Time.now - @start_time
26
25
  end
27
-
26
+
28
27
  def parse_caller(at)
29
28
  if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
30
29
  file = $1
@@ -32,5 +31,4 @@ class Measure
32
31
  [file, line]
33
32
  end
34
33
  end
35
-
36
- end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Mosso
2
- VERSION = "0.0.24"
2
+ VERSION = "0.0.25"
3
3
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Mosso::VERSION
9
9
  spec.authors = ["ryosy383"]
10
10
  spec.email = ["mosso.ryosy383@gmail.com"]
11
- spec.summary = %q{mosso}
12
- spec.description = %q{Module to measure the execution time.}
11
+ spec.summary = 'mosso'
12
+ spec.description = 'Module to measure the execution time.'
13
13
  spec.homepage = "https://github.com/ryosy383/mosso"
14
14
  spec.license = "MIT"
15
15
 
@@ -1,9 +1,10 @@
1
1
  require 'spec_helper'
2
+ require 'mosso'
2
3
 
3
4
  describe Mosso do
4
5
  it 'should have a version number' do
5
6
  expect(Mosso::VERSION).not_to eq(nil)
6
- expect(Mosso::VERSION).to eql("0.0.24")
7
+ expect(Mosso::VERSION).to eql("0.0.25")
7
8
  end
8
9
 
9
10
  it 'should measure rightly the execution time' do
@@ -13,33 +14,32 @@ describe Mosso do
13
14
  # initialize
14
15
  measure = Measure.new
15
16
  sleep 1
16
- expect(measure.exection_time().round).to eq(1)
17
+ expect(measure.exection_time.round).to eq(1)
17
18
  l1, l2 = measure.to_s.split("\n")
18
- expect(l1).to match Regexp.new("^#{line1}1\.\\d{9}\\s\\[sec\\]")
19
+ expect(l1).to match Regexp.new("^#{line1}1+\.\\d+\s\\[sec\\]")
19
20
  expect(l2).to match Regexp.new("^#{line2}")
20
-
21
+
21
22
  # exection_time
22
23
  sleep 2
23
- expect(measure.exection_time().round).to eq(3)
24
+ expect(measure.exection_time.round).to eq(3)
24
25
  l1, l2 = measure.to_s.split("\n")
25
- expect(l1).to match Regexp.new("^#{line1}3\.\\d{9}\\s\\[sec\\]")
26
+ expect(l1).to match Regexp.new("^#{line1}3+\.\\d+\s\\[sec\\]")
26
27
  expect(l2).to match Regexp.new("^#{line2}")
27
-
28
+
28
29
  # reset
29
30
  measure.reset
30
31
  sleep 1
31
- expect(measure.exection_time().round).to eq(1)
32
+ expect(measure.exection_time.round).to eq(1)
32
33
  l1, l2 = measure.to_s.split("\n")
33
- expect(l1).to match Regexp.new("^#{line1}1\.\\d{9}\\s\\[sec\\]")
34
+ expect(l1).to match Regexp.new("^#{line1}1+\.\\d+\s\\[sec\\]")
34
35
  expect(l2).to match Regexp.new("^#{line2}")
35
-
36
+
36
37
  # start
37
38
  measure.start
38
39
  sleep 2
39
- expect(measure.exection_time().round).to eq(2)
40
+ expect(measure.exection_time.round).to eq(2)
40
41
  l1, l2 = measure.to_s.split("\n")
41
- expect(l1).to match Regexp.new("^#{line1}2\.\\d{9}\\s\\[sec\\]")
42
- expect(l2).to match Regexp.new("^#{line2}")
42
+ expect(l1).to match Regexp.new("^#{line1}2+\.\\d+\s\\[sec\\]")
43
+ expect(l2).to match Regexp.new("^#{line2}")
43
44
  end
44
45
  end
45
-
@@ -1,2 +1,17 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'mosso'
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ SimpleCov::Formatter::HTMLFormatter,
7
+ Coveralls::SimpleCov::Formatter
8
+ ]
9
+ SimpleCov.start do
10
+ add_filter '/spec/'
11
+ end
12
+
13
+ RSpec.configure do |config|
14
+ config.treat_symbols_as_metadata_keys_with_true_values = true
15
+ config.run_all_when_everything_filtered = true
16
+ config.filter_run :focus
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mosso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryosy383
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-04 00:00:00.000000000 Z
11
+ date: 2014-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,8 +59,10 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".coveralls.yml"
62
63
  - ".gitignore"
63
64
  - ".rspec"
65
+ - ".rubocop.yml"
64
66
  - ".travis.yml"
65
67
  - Gemfile
66
68
  - LICENSE.txt
@@ -70,7 +72,7 @@ files:
70
72
  - lib/mosso.rb
71
73
  - lib/mosso/version.rb
72
74
  - mosso.gemspec
73
- - spec/mosso_spec.rb
75
+ - spec/mosso/mosso_spec.rb
74
76
  - spec/spec_helper.rb
75
77
  homepage: https://github.com/ryosy383/mosso
76
78
  licenses:
@@ -92,10 +94,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
94
  version: '0'
93
95
  requirements: []
94
96
  rubyforge_project:
95
- rubygems_version: 2.2.2
97
+ rubygems_version: 2.2.0
96
98
  signing_key:
97
99
  specification_version: 4
98
100
  summary: mosso
99
101
  test_files:
100
- - spec/mosso_spec.rb
102
+ - spec/mosso/mosso_spec.rb
101
103
  - spec/spec_helper.rb