rfix 1.1.0.pre.149 → 1.1.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/lib/rfix.rb +1 -0
- data/lib/rfix/branch.rb +1 -0
- data/lib/rfix/version.rb +1 -1
- data/rfix.gemspec +1 -0
- metadata +18 -6
- data/path.rb +0 -7
- data/rugged.rb +0 -206
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd96e76cafc6a288cb5df13b2480059aa408abefab74c4fa10932d67d5f955f
|
4
|
+
data.tar.gz: e4a96eb5322a6782fe3dc2983c59789f60226a61c6b79e7e88c3805137e1cf67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 064f9537855fc01eeb0a584db2627518d6e49de21f6a057682ec18730afff08ea2abc8d1a61a5d47a812b442be711f6afca41c0cd88f381f7cd447ca8a7c03f4
|
7
|
+
data.tar.gz: 04d6c3383940faccfb95696b77fa97eaf5483b1c3c9dd579b022d2d4018e23857c081dc66aae6f3626f47fc13e22486c3e5acaaedfd8d80be68cc073383466e3
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rfix (1.1.
|
4
|
+
rfix (1.1.1.pre)
|
5
5
|
cri (~> 2.15.10)
|
6
6
|
listen (~> 3.0)
|
7
7
|
rainbow (~> 3.0)
|
8
|
+
require_all (~> 3.0.0)
|
8
9
|
rouge (~> 3.20)
|
9
10
|
rubocop (>= 0.80)
|
10
11
|
rugged (~> 1.0.0)
|
@@ -118,6 +119,7 @@ GEM
|
|
118
119
|
ffi (~> 1.0)
|
119
120
|
rchardet (1.8.0)
|
120
121
|
regexp_parser (1.7.1)
|
122
|
+
require_all (3.0.0)
|
121
123
|
rexml (3.2.4)
|
122
124
|
rouge (3.21.0)
|
123
125
|
rspec (3.9.0)
|
data/lib/rfix.rb
CHANGED
data/lib/rfix/branch.rb
CHANGED
data/lib/rfix/version.rb
CHANGED
data/rfix.gemspec
CHANGED
@@ -55,6 +55,7 @@ Gem::Specification.new do |spec|
|
|
55
55
|
spec.add_runtime_dependency "rouge", "~> 3.20"
|
56
56
|
spec.add_runtime_dependency "rubocop", ">= 0.80"
|
57
57
|
spec.add_runtime_dependency "rugged", "~> 1.0.0"
|
58
|
+
spec.add_runtime_dependency "require_all", "~> 3.0.0"
|
58
59
|
|
59
60
|
spec.add_development_dependency "rspec", "~> 3.0"
|
60
61
|
spec.add_development_dependency "aruba", "~> 1.0"
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linus Oleander
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-07-21 00:00:00.000000000 Z
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: require_all
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.0.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.0.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rspec
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -270,10 +284,8 @@ files:
|
|
270
284
|
- lib/rfix/tracked_file.rb
|
271
285
|
- lib/rfix/untracked.rb
|
272
286
|
- lib/rfix/version.rb
|
273
|
-
- path.rb
|
274
287
|
- resources/ps.png
|
275
288
|
- rfix.gemspec
|
276
|
-
- rugged.rb
|
277
289
|
- tasks/bump.rake
|
278
290
|
- tasks/bundle.rake
|
279
291
|
- tasks/complex.rake
|
@@ -310,7 +322,7 @@ licenses:
|
|
310
322
|
- MIT
|
311
323
|
metadata:
|
312
324
|
homepage_uri: https://github.com/oleander/rfix-rb
|
313
|
-
post_install_message:
|
325
|
+
post_install_message:
|
314
326
|
rdoc_options: []
|
315
327
|
require_paths:
|
316
328
|
- lib
|
@@ -328,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
340
|
requirements:
|
329
341
|
- git, v2.0+
|
330
342
|
rubygems_version: 3.0.3
|
331
|
-
signing_key:
|
343
|
+
signing_key:
|
332
344
|
specification_version: 4
|
333
345
|
summary: RuboCop CLI that only lints and auto-fixes code you committed by utilizing
|
334
346
|
`git-log` and `git-diff`
|
data/path.rb
DELETED
data/rugged.rb
DELETED
@@ -1,206 +0,0 @@
|
|
1
|
-
require "rugged"
|
2
|
-
require "fileutils"
|
3
|
-
require "rainbow"
|
4
|
-
require "tmpdir"
|
5
|
-
require "rfix"
|
6
|
-
require 'shellwords'
|
7
|
-
require "set"
|
8
|
-
|
9
|
-
extend Rfix::Log
|
10
|
-
|
11
|
-
# root_path = Dir.mktmpdir
|
12
|
-
# at_exit { FileUtils.remove_dir(root_path) }
|
13
|
-
|
14
|
-
|
15
|
-
# Dir.chdir(root_path) do
|
16
|
-
# File.write(".gitignore", "# empty")
|
17
|
-
# system "git init"
|
18
|
-
# system "git add .gitignore"
|
19
|
-
# system "git commit -a -m 'Test'"
|
20
|
-
# end
|
21
|
-
|
22
|
-
|
23
|
-
# class Git
|
24
|
-
#
|
25
|
-
# class Blob < Struct.new(:repo, :tree)
|
26
|
-
# def commit(msg)
|
27
|
-
# author = {:email=>"tanoku@gmail.com", :time=>Time.now, :name=>"Vicent Mart\303\255"}
|
28
|
-
#
|
29
|
-
# Rugged::Commit.create(repo,
|
30
|
-
# :author => author,
|
31
|
-
# :message => msg,
|
32
|
-
# :committer => author,
|
33
|
-
# :parents => parents,
|
34
|
-
# :tree => tree,
|
35
|
-
# :update_ref => "HEAD")
|
36
|
-
# end
|
37
|
-
#
|
38
|
-
# def parents
|
39
|
-
# repo.empty? ? [] : [ repo.head.target ].compact
|
40
|
-
# end
|
41
|
-
# end
|
42
|
-
#
|
43
|
-
# attr_reader :repo
|
44
|
-
#
|
45
|
-
# def initialize(root_path)
|
46
|
-
# @repo = Rugged::Repository.new(root_path)
|
47
|
-
# # @repo.index.read_tree(@repo.head.target.tree)
|
48
|
-
# # @repo.index.reload
|
49
|
-
# # @repo.index.write_tree(@repo)
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# def blob(params)
|
53
|
-
# abort "Must be a hash" unless params.is_a?(Hash)
|
54
|
-
# debug("New blob")
|
55
|
-
# index = repo.index
|
56
|
-
# index.reload
|
57
|
-
#
|
58
|
-
# params.each do |path, content|
|
59
|
-
# oid = repo.write(content, :blob)
|
60
|
-
# index.read_tree(repo.head.target.tree)
|
61
|
-
# index.add(path: path, oid: oid, mode: 0100644)
|
62
|
-
# end
|
63
|
-
#
|
64
|
-
# Blob.new(repo, index.write_tree(repo))
|
65
|
-
# end
|
66
|
-
#
|
67
|
-
# def has_branch?(name)
|
68
|
-
# repo.branches.each_name().include?(name)
|
69
|
-
# end
|
70
|
-
#
|
71
|
-
# def branch(name)
|
72
|
-
# debug("Checkout branch #{name}")
|
73
|
-
# if branch = repo.branches[name]
|
74
|
-
# return repo.checkout(branch)
|
75
|
-
# end
|
76
|
-
#
|
77
|
-
# repo.create_branch(name)
|
78
|
-
# end
|
79
|
-
#
|
80
|
-
# def tag(name)
|
81
|
-
# debug("Add tag #{name}")
|
82
|
-
# repo.tags.create(name, "HEAD")
|
83
|
-
# end
|
84
|
-
#
|
85
|
-
# def checkout(ref)
|
86
|
-
# debug "Checkout ref #{ref}"
|
87
|
-
# repo.checkout(ref)
|
88
|
-
# end
|
89
|
-
#
|
90
|
-
# def status
|
91
|
-
# debug "-- Get status"
|
92
|
-
# repo.status do |file, status|
|
93
|
-
# say "#{file} => #{status}"
|
94
|
-
# end
|
95
|
-
#
|
96
|
-
# repo.index.entries.each do |entry|
|
97
|
-
# say "Staged: #{entry}"
|
98
|
-
# end
|
99
|
-
# debug "-- End of status"
|
100
|
-
# end
|
101
|
-
#
|
102
|
-
# def say(msg)
|
103
|
-
# puts Rainbow("[LOG]").blue + " #{msg}"
|
104
|
-
# end
|
105
|
-
#
|
106
|
-
# def debug(msg)
|
107
|
-
# puts Rainbow("[DEBUG]").red + " #{msg}"
|
108
|
-
# end
|
109
|
-
#
|
110
|
-
# def new_file(file, content)
|
111
|
-
# debug "New file #{file}"
|
112
|
-
# Dir.chdir(repo.workdir) do
|
113
|
-
# File.write(file, content)
|
114
|
-
# end
|
115
|
-
#
|
116
|
-
# file
|
117
|
-
# end
|
118
|
-
#
|
119
|
-
# def add(file)
|
120
|
-
# debug "Add file #{file}"
|
121
|
-
# index = Rugged::Index.new(file)
|
122
|
-
# index.write_tree(repo)
|
123
|
-
# Blob.new(repo, index.write_tree(repo))
|
124
|
-
# end
|
125
|
-
# end
|
126
|
-
|
127
|
-
# repo = Git.new(root_path)
|
128
|
-
# repo.status
|
129
|
-
# puts "------"
|
130
|
-
# repo.branch("master")
|
131
|
-
# repo.tag("v2")
|
132
|
-
# repo.branch("mastsdkfjfsd")
|
133
|
-
# repo.blob("example.rb" => "This is content").commit("This is my message")
|
134
|
-
# repo.status
|
135
|
-
# repo.checkout("v2")
|
136
|
-
# repo.blob("valid.rb" => "This is content")
|
137
|
-
# .commit("This is my message")
|
138
|
-
# repo.blob("this.rb" => "This is content").commit("This is my message")
|
139
|
-
# file = repo.new_file("valid.rb", "this is content")
|
140
|
-
# repo.status
|
141
|
-
# blob = repo.add(file)
|
142
|
-
# repo.status
|
143
|
-
# puts "----"
|
144
|
-
# blob.commit("Okay!")
|
145
|
-
# repo.status
|
146
|
-
|
147
|
-
class AFile
|
148
|
-
include Rfix::Log
|
149
|
-
attr_reader :repo, :path
|
150
|
-
|
151
|
-
def initialize(path, repo)
|
152
|
-
@repo = repo
|
153
|
-
@path = Shellwords.escape(path)
|
154
|
-
refresh!
|
155
|
-
end
|
156
|
-
|
157
|
-
def include?(line)
|
158
|
-
return true unless @changes
|
159
|
-
@changes.include?(line)
|
160
|
-
end
|
161
|
-
|
162
|
-
def refresh!
|
163
|
-
@changes = changed_lines
|
164
|
-
rescue Rugged::TreeError
|
165
|
-
@changed = nil
|
166
|
-
end
|
167
|
-
|
168
|
-
private
|
169
|
-
|
170
|
-
def upstream
|
171
|
-
@repo.rev_parse("@{u}:#{@path}")
|
172
|
-
end
|
173
|
-
|
174
|
-
def head
|
175
|
-
@repo.rev_parse("HEAD:#{@path}")
|
176
|
-
end
|
177
|
-
|
178
|
-
def diff
|
179
|
-
upstream.diff(head)
|
180
|
-
end
|
181
|
-
|
182
|
-
def changed_lines
|
183
|
-
diff.each_hunk
|
184
|
-
.to_a
|
185
|
-
.map(&:lines)
|
186
|
-
.flatten
|
187
|
-
.map(&:new_lineno)
|
188
|
-
.to_set
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
repo = Rugged::Repository.new(".")
|
193
|
-
|
194
|
-
repo.diff("83800375874a5ebd55b48283cef9245c32103aef", "HEAD").each_delta do |delta|
|
195
|
-
pp delta.new_file.fetch(:path)
|
196
|
-
end
|
197
|
-
# files = `git ls-tree -r master --name-only`.lines.map(&:chomp)
|
198
|
-
#
|
199
|
-
# result = files.each_with_object({}) do |path, acc|
|
200
|
-
# acc[path] = AFile.new(path, repo)
|
201
|
-
# end
|
202
|
-
#
|
203
|
-
# pp reslt
|
204
|
-
|
205
|
-
# binding.pry
|
206
|
-
# repo.branches
|