rfix 1.1.0.pre.149 → 1.1.0.pre.150

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. metadata +1 -3
  3. data/path.rb +0 -7
  4. data/rugged.rb +0 -206
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ee4030d1ce4edff85010c48d311687c118f875406c6191069296e59287bf92c
4
- data.tar.gz: d052536e2c5789b690f7c063d2b098c2be418de7b925c9778c0ce060b97ec87b
3
+ metadata.gz: ba1b01aead3561d573a0bc245182e5ce0f2f1e53d0b4159d1e3c1d2f6ff03809
4
+ data.tar.gz: 26cab53f17d158dcf08e316b60306093683c1524b3552c2e4a1d78a23d5125d1
5
5
  SHA512:
6
- metadata.gz: dae811bfdd02a5d81ac9b47cf0cbb7954a568d9de950242f3d5c946d52831f0898466bc93784b7c0e978d5d9fe57d3a5474ee75508eab99d43908c6ebcd328f4
7
- data.tar.gz: 5c9458afa7c3b84e8be22963f7aa62aef4b4a22f406590050f970eaa1b72605e1cd5c3dcd550d564fc490e36cc792087fbf29bdf19000561bc654d91da762ff7
6
+ metadata.gz: cbab7947f89dcf190b457d3839be471c1ba899ce742a7e25e0a5d769539aa26a242b9e216100c598d65633cdd3bf1aa934f88c1dd1bc5daca812e19240672769
7
+ data.tar.gz: efa32f2eaa52d9309571d0d782202961d270d8ae43a5c26845fd3b9a164942c1cb24ba737a72c86f1d0a7a1c95d630730cb3742a845e9d1be8e211138d766bd8
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.pre.149
4
+ version: 1.1.0.pre.150
5
5
  platform: ruby
6
6
  authors:
7
7
  - Linus Oleander
@@ -270,10 +270,8 @@ files:
270
270
  - lib/rfix/tracked_file.rb
271
271
  - lib/rfix/untracked.rb
272
272
  - lib/rfix/version.rb
273
- - path.rb
274
273
  - resources/ps.png
275
274
  - rfix.gemspec
276
- - rugged.rb
277
275
  - tasks/bump.rake
278
276
  - tasks/bundle.rake
279
277
  - tasks/complex.rake
data/path.rb DELETED
@@ -1,7 +0,0 @@
1
- require "jsonpath"
2
- require "json"
3
-
4
- json = JSON.parse(File.read("spec/fixtures/rubocop.json"))
5
- result = JsonPath.new("files[:][?(@.offenses[:].corrected==\"true\")].path").on(json)
6
-
7
- puts result
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