gitwakatime 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -11
- data/Rakefile +1 -1
- data/bin/{gitlog.rb → gitwakatime} +0 -0
- data/gitwakatime.gemspec +19 -17
- data/lib/gitwakatime/actions.rb +8 -2
- data/lib/gitwakatime/cli.rb +23 -7
- data/lib/gitwakatime/commit.rb +15 -5
- data/lib/gitwakatime/commited_file.rb +28 -12
- data/lib/gitwakatime/mapper.rb +3 -6
- data/lib/gitwakatime/query.rb +48 -0
- data/lib/gitwakatime/timer.rb +22 -29
- data/lib/gitwakatime/version.rb +1 -1
- data/lib/gitwakatime.rb +1 -0
- data/spec/fixtures/actions.json +29854 -0
- data/spec/mapper_spec.rb +21 -0
- data/spec/query_spec.rb +23 -0
- data/spec/spec_helper.rb +2 -1
- data/spec/timer_spec.rb +19 -0
- metadata +45 -9
- data/spec/commit_spec.rb +0 -5
data/spec/mapper_spec.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gitwakatime'
|
3
|
+
require 'gitwakatime/mapper'
|
4
|
+
|
5
|
+
describe 'description' do
|
6
|
+
let(:path) { File.join(File.dirname(__FILE__), 'dummy') }
|
7
|
+
it 'can be run on dummy' do
|
8
|
+
expect(GitWakaTime::Mapper.new(path).commits.size).to eq 8 # 9ths is lonely
|
9
|
+
end
|
10
|
+
it 'can be run on dummy' do
|
11
|
+
expect(GitWakaTime::Mapper.new(path).commits.last.raw_commit.message).to eq 'created readme'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'maps files dependent commits' do
|
15
|
+
expect(GitWakaTime::Mapper.new(path).commits.first.files.first.dependent_commit.sha).to eq 'dcd748bd06b8a0f239d779bee4f1eaf1f4aa500d'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'maps files dependent commits' do
|
19
|
+
expect(GitWakaTime::Mapper.new(path).commits.select { |c| c.sha == 'dcd748bd06b8a0f239d779bee4f1eaf1f4aa500d' }.first.files.first.dependent_commit.sha).to eq '2254dd56976b5f32a2289438842e42a35a18ff86'
|
20
|
+
end
|
21
|
+
end
|
data/spec/query_spec.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gitwakatime'
|
3
|
+
|
4
|
+
describe 'description' do
|
5
|
+
let(:path) { File.join(File.dirname(__FILE__), 'dummy') }
|
6
|
+
let (:map) { GitWakaTime::Mapper.new(path) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
stub_request(:get, 'https://wakatime.com/api/v1/actions')
|
10
|
+
.with(query: hash_including(:start, :end))
|
11
|
+
.to_return(body: File.read('./spec/fixtures/actions.json'), status: 200)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'can be run on dummy' do
|
15
|
+
|
16
|
+
timer = GitWakaTime::Query.new(map.commits, File.basename(path)).get
|
17
|
+
|
18
|
+
expect(timer.size).to eq 6 # 9ths is lonely
|
19
|
+
expect(timer).to be_a Array
|
20
|
+
expect(timer.last).to be_a Wakatime::Models::Action
|
21
|
+
expect(timer.last.branch).to eq 'master'
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
#
|
6
6
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
7
|
RSpec.configure do |config|
|
8
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
8
|
config.run_all_when_everything_filtered = true
|
10
9
|
config.filter_run :focus
|
11
10
|
|
@@ -15,3 +14,5 @@ RSpec.configure do |config|
|
|
15
14
|
# --seed 1234
|
16
15
|
config.order = 'random'
|
17
16
|
end
|
17
|
+
|
18
|
+
require 'webmock/rspec'
|
data/spec/timer_spec.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gitwakatime'
|
3
|
+
|
4
|
+
describe 'description' do
|
5
|
+
let(:path) { File.join(File.dirname(__FILE__), 'dummy') }
|
6
|
+
let (:map) { GitWakaTime::Mapper.new(path) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
stub_request(:get, 'https://wakatime.com/api/v1/actions')
|
10
|
+
.with(query: hash_including(:start, :end))
|
11
|
+
.to_return(body: File.read('./spec/fixtures/actions.json'), status: 200)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'can be run on dummy' do
|
15
|
+
actions = GitWakaTime::Query.new(map.commits, File.basename(path)).get
|
16
|
+
timer = GitWakaTime::Timer.new(map.commits, actions, File.basename(path)).process
|
17
|
+
expect(timer.size).to eq 2
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitwakatime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Osborne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.0.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.0.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: logger
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activesupport
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: bundler
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,12 +150,26 @@ dependencies:
|
|
136
150
|
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: webmock
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
139
167
|
description: 'A Tool that will compile git data with wakatime data to establish time
|
140
168
|
per commit '
|
141
169
|
email:
|
142
170
|
- russosborn@gmail.com
|
143
171
|
executables:
|
144
|
-
-
|
172
|
+
- gitwakatime
|
145
173
|
extensions: []
|
146
174
|
extra_rdoc_files: []
|
147
175
|
files:
|
@@ -151,7 +179,7 @@ files:
|
|
151
179
|
- LICENSE.txt
|
152
180
|
- README.md
|
153
181
|
- Rakefile
|
154
|
-
- bin/
|
182
|
+
- bin/gitwakatime
|
155
183
|
- gitwakatime.gemspec
|
156
184
|
- lib/gitwakatime.rb
|
157
185
|
- lib/gitwakatime/actions.rb
|
@@ -160,10 +188,14 @@ files:
|
|
160
188
|
- lib/gitwakatime/commited_file.rb
|
161
189
|
- lib/gitwakatime/log.rb
|
162
190
|
- lib/gitwakatime/mapper.rb
|
191
|
+
- lib/gitwakatime/query.rb
|
163
192
|
- lib/gitwakatime/timer.rb
|
164
193
|
- lib/gitwakatime/version.rb
|
165
|
-
- spec/
|
194
|
+
- spec/fixtures/actions.json
|
195
|
+
- spec/mapper_spec.rb
|
196
|
+
- spec/query_spec.rb
|
166
197
|
- spec/spec_helper.rb
|
198
|
+
- spec/timer_spec.rb
|
167
199
|
homepage: ''
|
168
200
|
licenses:
|
169
201
|
- MIT
|
@@ -184,11 +216,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
216
|
version: '0'
|
185
217
|
requirements: []
|
186
218
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
219
|
+
rubygems_version: 2.4.5
|
188
220
|
signing_key:
|
189
221
|
specification_version: 4
|
190
222
|
summary: A Tool that will compile git data with wakatime data to establish time per
|
191
223
|
commit
|
192
224
|
test_files:
|
193
|
-
- spec/
|
225
|
+
- spec/fixtures/actions.json
|
226
|
+
- spec/mapper_spec.rb
|
227
|
+
- spec/query_spec.rb
|
194
228
|
- spec/spec_helper.rb
|
229
|
+
- spec/timer_spec.rb
|
230
|
+
has_rdoc:
|