work_timer 0.2.2 → 0.2.4

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
- SHA1:
3
- metadata.gz: bfe39e587fb65f8323f612fbc9fceed3a468a0b0
4
- data.tar.gz: 1fd10ca5195c93ceaa2f52e88f3a9b2139514129
2
+ SHA256:
3
+ metadata.gz: 15f24f1145ae7a9df6ea32f9e38e5c90a0623ef6a8b3ef07330173290f54865d
4
+ data.tar.gz: 5fad7e5d7a7893c8fa1f0500fe798b07b29e74f710b89a50c33a634f36627b40
5
5
  SHA512:
6
- metadata.gz: 9222a51a35d9cc68fabe99c7540f7f1d022029d02e761f841ae53d92e98a3e328106cd9e9d7ab0be07975efe80ff08a14a52c89b2d7c6cadea8e41a76065daf9
7
- data.tar.gz: e63d9ea88c1daca75fea90e2ae29037bdb27ad3ee3867f80eaf7f6f9bb4d6ddc8d62b74a4ba6dae96b341aacea644fcd93fe9c8342be38acb38c17e50e47f9e7
6
+ metadata.gz: 3ce2826f5ecbbfb6e96032d62537241527114c386e7241b7ce755f8c82405484e6c5f1ca8596df2b5813baa3318b4ef1be9801c379ecf9bb33c10086ff3f6393
7
+ data.tar.gz: 0c241127e540f582da9f9e1a6e8004629ab338d9ac8a0defefbf39c931f77729fc83ad495237d983962b3e1fa0bdfba5f62462c1b714b46f0426679ad3dffd57
@@ -0,0 +1,63 @@
1
+ version: 2 # use CircleCI 2.0
2
+ jobs: # a collection of steps
3
+ build: # runs not using Workflows must have a `build` job as entry point
4
+ parallelism: 3 # run three instances of this job in parallel
5
+ docker: # run the steps with Docker
6
+ - image: circleci/ruby:2.4.2-jessie-node # ...with this image as the primary container; this is where all `steps` will run
7
+ environment: # environment variables for primary container
8
+ BUNDLE_JOBS: 3
9
+ BUNDLE_RETRY: 3
10
+ BUNDLE_PATH: vendor/bundle
11
+ steps: # a collection of executable commands
12
+ - checkout # special step to check out source code to working directory
13
+
14
+ - run:
15
+ name: install Bundler
16
+ command: |
17
+ echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
18
+ source $BASH_ENV
19
+ gem install bundler
20
+
21
+ # Which version of bundler?
22
+ - run:
23
+ name: Which bundler?
24
+ command: bundle -v
25
+
26
+ # Restore bundle cache
27
+ # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
28
+ - restore_cache:
29
+ keys:
30
+ - gem-sample-{{ checksum "Gemfile.lock" }}
31
+ - gem-sample-
32
+
33
+ - run: # Install Ruby dependencies
34
+ name: Bundle Install
35
+ command: bundle check --path vendor/bundle || bundle install --deployment
36
+
37
+ # Store bundle cache for Ruby dependencies
38
+ - save_cache:
39
+ key: gem-sample-{{ checksum "Gemfile.lock" }}
40
+ paths:
41
+ - vendor/bundle
42
+
43
+ - run:
44
+ name: Run rspec in parallel
45
+ command: |
46
+ bundle exec rspec --profile 10 \
47
+ --format RspecJunitFormatter \
48
+ --out test_results/rspec.xml \
49
+ --format progress \
50
+ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
51
+
52
+ # Save test results for timing analysis
53
+ - store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
54
+ path: test_results
55
+ - store_artifacts:
56
+ # テスト結果をtest-resultsディレクトリに吐き出す
57
+ path: test_results
58
+ destination: test-results
59
+ - store_artifacts:
60
+ # カバレッジの結果をcoverage-resultsディレクトリに吐き出す
61
+ path: coverage
62
+ destination: coverage-results
63
+ # See https://circleci.com/docs/2.0/deployment-integrations/ for example deploy configs
data/Gemfile CHANGED
@@ -2,5 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
+ gem 'rspec_junit_formatter'
6
+ gem 'simplecov'
7
+
5
8
  # Specify your gem's dependencies in work_timer.gemspec
6
9
  gemspec
data/Gemfile.lock CHANGED
@@ -1,16 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- work_timer (0.2.1)
4
+ work_timer (0.2.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- codeclimate-test-reporter (1.0.7)
10
- simplecov
11
9
  diff-lcs (1.3)
12
- docile (1.3.1)
13
- json (2.1.0)
10
+ docile (1.3.2)
11
+ json (2.2.0)
14
12
  rake (10.5.0)
15
13
  rspec (3.8.0)
16
14
  rspec-core (~> 3.8.0)
@@ -25,7 +23,9 @@ GEM
25
23
  diff-lcs (>= 1.2.0, < 2.0)
26
24
  rspec-support (~> 3.8.0)
27
25
  rspec-support (3.8.0)
28
- simplecov (0.16.1)
26
+ rspec_junit_formatter (0.4.1)
27
+ rspec-core (>= 2, < 4, != 2.12.0)
28
+ simplecov (0.17.0)
29
29
  docile (~> 1.1)
30
30
  json (>= 1.8, < 3)
31
31
  simplecov-html (~> 0.10.0)
@@ -36,11 +36,11 @@ PLATFORMS
36
36
 
37
37
  DEPENDENCIES
38
38
  bundler (~> 1.16)
39
- codeclimate-test-reporter
40
39
  rake (~> 10.0)
41
40
  rspec (~> 3.0)
41
+ rspec_junit_formatter
42
42
  simplecov
43
43
  work_timer!
44
44
 
45
45
  BUNDLED WITH
46
- 1.16.3
46
+ 1.17.3
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # work_timer
2
-
2
+ [![CircleCI](https://circleci.com/gh/9sako6/work_timer.svg?style=svg)](https://circleci.com/gh/9sako6/work_timer)
3
3
  [![Maintainability](https://api.codeclimate.com/v1/badges/c1aa0d29cfb926decd44/maintainability)](https://codeclimate.com/github/9sako6/work_timer/maintainability)
4
4
  [![Gem Version](https://badge.fury.io/rb/work_timer.svg)](https://badge.fury.io/rb/work_timer)
5
5
 
data/exe/work_timer CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'work_timer'
4
- require "io/console" # 改行なしで'q'を取得するのに必要
3
+ require("work_timer")
4
+ require("io/console") # 改行なしで'q'を取得するのに必要
5
5
 
6
- def setWork(workObj, fileName="Nil", logFlag=false)
6
+ def setWork(workObj, fileName = "Nil", logFlag = false)
7
7
  puts "quit : 'q'"
8
8
  puts "total: " + workObj.total_time if logFlag
9
9
  # 作業時間をリアルタイム表示
10
10
  workObj.view
11
11
  workObj.start_work
12
12
  # 'q'が入力されたら作業時間カウント終了
13
- while STDIN.getch != 'q'; end
13
+ while STDIN.getch != "q"; end
14
14
  puts
15
15
  workObj.end_work
16
16
  if logFlag
data/lib/work_timer.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "work_timer/version"
1
+ require("work_timer/version")
2
2
 
3
3
  module WorkTimer
4
4
  class Work
@@ -6,11 +6,11 @@ module WorkTimer
6
6
  @fileName = fileName
7
7
  end
8
8
 
9
- def start_work(startTime=nil)
9
+ def start_work(startTime = nil)
10
10
  @startTime ||= Time.now
11
11
  end
12
12
 
13
- def end_work(endTime=nil)
13
+ def end_work(endTime = nil)
14
14
  @endTime ||= Time.now
15
15
  stop_view
16
16
  end
@@ -27,7 +27,7 @@ module WorkTimer
27
27
  next if line =~ /^\d{4}-\d{2}-\d{2}/
28
28
  # **:**:**表示を秒に変換
29
29
  line.chomp.split(":").each_with_index do |time, i|
30
- totalTime += time.to_i*60**(2-i)
30
+ totalTime += time.to_i * 60 ** (2 - i)
31
31
  end
32
32
  end
33
33
  f.close
@@ -36,7 +36,7 @@ module WorkTimer
36
36
 
37
37
  def record_time
38
38
  File.open(@fileName, "a+") do |f|
39
- workTime = (@endTime.gmtime-@startTime.gmtime.to_i).strftime("%T")
39
+ workTime = (@endTime.gmtime - @startTime.gmtime.to_i).strftime("%T")
40
40
  f.puts @startTime.localtime, @endTime.localtime, workTime
41
41
  end
42
42
  end
@@ -45,7 +45,7 @@ module WorkTimer
45
45
  @view_thread = Thread.new do
46
46
  loop do
47
47
  workingTime = Time.now - @startTime.to_i
48
- print "\r\033[32m#{(workingTime+60*60*15).strftime("%T")}\033[0m"
48
+ print "\r\033[32m#{(workingTime + 60 * 60 * 15).strftime("%T")}\033[0m"
49
49
  sleep 1
50
50
  end
51
51
  end
@@ -55,15 +55,15 @@ module WorkTimer
55
55
  private
56
56
 
57
57
  def sec2seq(sec)
58
- hours = (sec/3600.0).to_i.to_s
59
- minutes = ((sec-(sec/3600.0).to_i*3600.0)/60).to_i.to_s
60
- seconds = (sec%60).to_i.to_s
58
+ hours = (sec / 3600.0).to_i.to_s
59
+ minutes = ((sec - (sec / 3600.0).to_i * 3600.0) / 60).to_i.to_s
60
+ seconds = (sec % 60).to_i.to_s
61
61
  "#{two_digits(hours)}:#{two_digits(minutes)}:#{two_digits(seconds)}"
62
62
  end
63
63
 
64
64
  # 1桁の数字(実際はStringクラス)を2桁にする (e.g.: 0:0:47 -> 00:00:47)
65
65
  def two_digits(time)
66
- time.size==1 ? "0"+time : time
66
+ time.size == 1 ? "0" + time : time
67
67
  end
68
68
 
69
69
  def stop_view
@@ -1,3 +1,3 @@
1
1
  module WorkTimer
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: work_timer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - 9sako6
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-12 00:00:00.000000000 Z
11
+ date: 2019-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,6 +60,7 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - ".circleci/config.yml"
63
64
  - ".gitignore"
64
65
  - ".rspec"
65
66
  - ".travis.yml"
@@ -96,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
97
  - !ruby/object:Gem::Version
97
98
  version: '0'
98
99
  requirements: []
99
- rubyforge_project:
100
- rubygems_version: 2.6.14.1
100
+ rubygems_version: 3.0.4
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: gem to measure working time