lg_pod_plugin 1.0.4 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/lib/git/author.rb +14 -0
  3. data/lib/git/base/factory.rb +101 -0
  4. data/lib/git/base.rb +670 -0
  5. data/lib/git/branch.rb +126 -0
  6. data/lib/git/branches.rb +71 -0
  7. data/lib/git/config.rb +22 -0
  8. data/lib/git/diff.rb +155 -0
  9. data/lib/git/encoding_utils.rb +33 -0
  10. data/lib/git/escaped_path.rb +77 -0
  11. data/lib/git/index.rb +5 -0
  12. data/lib/git/lib.rb +1215 -0
  13. data/lib/git/log.rb +135 -0
  14. data/lib/git/object.rb +312 -0
  15. data/lib/git/path.rb +31 -0
  16. data/lib/git/remote.rb +36 -0
  17. data/lib/git/repository.rb +6 -0
  18. data/lib/git/stash.rb +27 -0
  19. data/lib/git/stashes.rb +55 -0
  20. data/lib/git/status.rb +199 -0
  21. data/lib/git/url.rb +127 -0
  22. data/lib/git/version.rb +5 -0
  23. data/lib/git/working_directory.rb +4 -0
  24. data/lib/git/worktree.rb +38 -0
  25. data/lib/git/worktrees.rb +47 -0
  26. data/lib/git.rb +326 -0
  27. data/lib/lg_pod_plugin/database.rb +104 -104
  28. data/lib/lg_pod_plugin/{download.rb → downloader.rb} +1 -1
  29. data/lib/lg_pod_plugin/file_path.rb +1 -1
  30. data/lib/lg_pod_plugin/git_util.rb +154 -50
  31. data/lib/lg_pod_plugin/install.rb +27 -21
  32. data/lib/lg_pod_plugin/l_cache.rb +13 -14
  33. data/lib/lg_pod_plugin/l_util.rb +39 -0
  34. data/lib/lg_pod_plugin/request.rb +9 -10
  35. data/lib/lg_pod_plugin/version.rb +1 -1
  36. data/lib/lg_pod_plugin.rb +1 -3
  37. data/lib/rchardet/big5freq.rb +927 -0
  38. data/lib/rchardet/big5prober.rb +42 -0
  39. data/lib/rchardet/chardistribution.rb +250 -0
  40. data/lib/rchardet/charsetgroupprober.rb +110 -0
  41. data/lib/rchardet/charsetprober.rb +70 -0
  42. data/lib/rchardet/codingstatemachine.rb +67 -0
  43. data/lib/rchardet/constants.rb +42 -0
  44. data/lib/rchardet/escprober.rb +90 -0
  45. data/lib/rchardet/escsm.rb +245 -0
  46. data/lib/rchardet/eucjpprober.rb +88 -0
  47. data/lib/rchardet/euckrfreq.rb +597 -0
  48. data/lib/rchardet/euckrprober.rb +42 -0
  49. data/lib/rchardet/euctwfreq.rb +431 -0
  50. data/lib/rchardet/euctwprober.rb +42 -0
  51. data/lib/rchardet/gb18030freq.rb +474 -0
  52. data/lib/rchardet/gb18030prober.rb +42 -0
  53. data/lib/rchardet/hebrewprober.rb +289 -0
  54. data/lib/rchardet/jisfreq.rb +571 -0
  55. data/lib/rchardet/jpcntx.rb +229 -0
  56. data/lib/rchardet/langbulgarianmodel.rb +229 -0
  57. data/lib/rchardet/langcyrillicmodel.rb +330 -0
  58. data/lib/rchardet/langgreekmodel.rb +227 -0
  59. data/lib/rchardet/langhebrewmodel.rb +202 -0
  60. data/lib/rchardet/langhungarianmodel.rb +226 -0
  61. data/lib/rchardet/langthaimodel.rb +201 -0
  62. data/lib/rchardet/latin1prober.rb +147 -0
  63. data/lib/rchardet/mbcharsetprober.rb +89 -0
  64. data/lib/rchardet/mbcsgroupprober.rb +47 -0
  65. data/lib/rchardet/mbcssm.rb +542 -0
  66. data/lib/rchardet/sbcharsetprober.rb +122 -0
  67. data/lib/rchardet/sbcsgroupprober.rb +58 -0
  68. data/lib/rchardet/sjisprober.rb +88 -0
  69. data/lib/rchardet/universaldetector.rb +179 -0
  70. data/lib/rchardet/utf8prober.rb +87 -0
  71. data/lib/rchardet/version.rb +3 -0
  72. data/lib/rchardet.rb +67 -0
  73. data/lib/zip/central_directory.rb +212 -0
  74. data/lib/zip/compressor.rb +9 -0
  75. data/lib/zip/constants.rb +115 -0
  76. data/lib/zip/crypto/decrypted_io.rb +40 -0
  77. data/lib/zip/crypto/encryption.rb +11 -0
  78. data/lib/zip/crypto/null_encryption.rb +43 -0
  79. data/lib/zip/crypto/traditional_encryption.rb +99 -0
  80. data/lib/zip/decompressor.rb +31 -0
  81. data/lib/zip/deflater.rb +34 -0
  82. data/lib/zip/dos_time.rb +53 -0
  83. data/lib/zip/entry.rb +719 -0
  84. data/lib/zip/entry_set.rb +88 -0
  85. data/lib/zip/errors.rb +19 -0
  86. data/lib/zip/extra_field/generic.rb +44 -0
  87. data/lib/zip/extra_field/ntfs.rb +94 -0
  88. data/lib/zip/extra_field/old_unix.rb +46 -0
  89. data/lib/zip/extra_field/universal_time.rb +77 -0
  90. data/lib/zip/extra_field/unix.rb +39 -0
  91. data/lib/zip/extra_field/zip64.rb +70 -0
  92. data/lib/zip/extra_field/zip64_placeholder.rb +15 -0
  93. data/lib/zip/extra_field.rb +103 -0
  94. data/lib/zip/file.rb +468 -0
  95. data/lib/zip/filesystem.rb +643 -0
  96. data/lib/zip/inflater.rb +54 -0
  97. data/lib/zip/input_stream.rb +180 -0
  98. data/lib/zip/ioextras/abstract_input_stream.rb +122 -0
  99. data/lib/zip/ioextras/abstract_output_stream.rb +43 -0
  100. data/lib/zip/ioextras.rb +36 -0
  101. data/lib/zip/null_compressor.rb +15 -0
  102. data/lib/zip/null_decompressor.rb +19 -0
  103. data/lib/zip/null_input_stream.rb +10 -0
  104. data/lib/zip/output_stream.rb +198 -0
  105. data/lib/zip/pass_thru_compressor.rb +23 -0
  106. data/lib/zip/pass_thru_decompressor.rb +31 -0
  107. data/lib/zip/streamable_directory.rb +15 -0
  108. data/lib/zip/streamable_stream.rb +52 -0
  109. data/lib/zip/version.rb +3 -0
  110. data/lib/zip.rb +72 -0
  111. metadata +103 -31
data/lib/git/status.rb ADDED
@@ -0,0 +1,199 @@
1
+ module Git
2
+ #
3
+ # A class for git status
4
+ #
5
+ class Status
6
+ include Enumerable
7
+
8
+ def initialize(base)
9
+ @base = base
10
+ construct_status
11
+ end
12
+
13
+ #
14
+ # Returns an Enumerable containing files that have changed from the
15
+ # git base directory
16
+ #
17
+ # @return [Enumerable]
18
+ def changed
19
+ @files.select { |_k, f| f.type == 'M' }
20
+ end
21
+
22
+ #
23
+ # Determines whether the given file has been changed.
24
+ # File path starts at git base directory
25
+ #
26
+ # @param file [String] The name of the file.
27
+ # @example Check if lib/git.rb has changed.
28
+ # changed?('lib/git.rb')
29
+ # @return [Boolean]
30
+ def changed?(file)
31
+ changed.member?(file)
32
+ end
33
+
34
+ #
35
+ # Returns an Enumerable containing files that have been added.
36
+ # File path starts at git base directory
37
+ #
38
+ # @return [Enumerable]
39
+ def added
40
+ @files.select { |_k, f| f.type == 'A' }
41
+ end
42
+
43
+ #
44
+ # Determines whether the given file has been added to the repository
45
+ # File path starts at git base directory
46
+ #
47
+ # @param file [String] The name of the file.
48
+ # @example Check if lib/git.rb is added.
49
+ # added?('lib/git.rb')
50
+ # @return [Boolean]
51
+ def added?(file)
52
+ added.member?(file)
53
+ end
54
+
55
+ #
56
+ # Returns an Enumerable containing files that have been deleted.
57
+ # File path starts at git base directory
58
+ #
59
+ # @return [Enumerable]
60
+ def deleted
61
+ @files.select { |_k, f| f.type == 'D' }
62
+ end
63
+
64
+ #
65
+ # Determines whether the given file has been deleted from the repository
66
+ # File path starts at git base directory
67
+ #
68
+ # @param file [String] The name of the file.
69
+ # @example Check if lib/git.rb is deleted.
70
+ # deleted?('lib/git.rb')
71
+ # @return [Boolean]
72
+ def deleted?(file)
73
+ deleted.member?(file)
74
+ end
75
+
76
+ #
77
+ # Returns an Enumerable containing files that are not tracked in git.
78
+ # File path starts at git base directory
79
+ #
80
+ # @return [Enumerable]
81
+ def untracked
82
+ @files.select { |_k, f| f.untracked }
83
+ end
84
+
85
+ #
86
+ # Determines whether the given file has is tracked by git.
87
+ # File path starts at git base directory
88
+ #
89
+ # @param file [String] The name of the file.
90
+ # @example Check if lib/git.rb is an untracked file.
91
+ # untracked?('lib/git.rb')
92
+ # @return [Boolean]
93
+ def untracked?(file)
94
+ untracked.member?(file)
95
+ end
96
+
97
+ def pretty
98
+ out = ''
99
+ each do |file|
100
+ out << pretty_file(file)
101
+ end
102
+ out << "\n"
103
+ out
104
+ end
105
+
106
+ def pretty_file(file)
107
+ <<~FILE
108
+ #{file.path}
109
+ \tsha(r) #{file.sha_repo} #{file.mode_repo}
110
+ \tsha(i) #{file.sha_index} #{file.mode_index}
111
+ \ttype #{file.type}
112
+ \tstage #{file.stage}
113
+ \tuntrac #{file.untracked}
114
+ FILE
115
+ end
116
+
117
+ # enumerable method
118
+
119
+ def [](file)
120
+ @files[file]
121
+ end
122
+
123
+ def each(&block)
124
+ @files.values.each(&block)
125
+ end
126
+
127
+ # subclass that does heavy lifting
128
+ class StatusFile
129
+ attr_accessor :path, :type, :stage, :untracked
130
+ attr_accessor :mode_index, :mode_repo
131
+ attr_accessor :sha_index, :sha_repo
132
+
133
+ def initialize(base, hash)
134
+ @base = base
135
+ @path = hash[:path]
136
+ @type = hash[:type]
137
+ @stage = hash[:stage]
138
+ @mode_index = hash[:mode_index]
139
+ @mode_repo = hash[:mode_repo]
140
+ @sha_index = hash[:sha_index]
141
+ @sha_repo = hash[:sha_repo]
142
+ @untracked = hash[:untracked]
143
+ end
144
+
145
+ def blob(type = :index)
146
+ if type == :repo
147
+ @base.object(@sha_repo)
148
+ else
149
+ begin
150
+ @base.object(@sha_index)
151
+ rescue
152
+ @base.object(@sha_repo)
153
+ end
154
+ end
155
+ end
156
+ end
157
+
158
+ private
159
+
160
+ def construct_status
161
+ @files = @base.lib.ls_files
162
+
163
+ fetch_untracked
164
+ fetch_modified
165
+ fetch_added
166
+
167
+ @files.each do |k, file_hash|
168
+ @files[k] = StatusFile.new(@base, file_hash)
169
+ end
170
+ end
171
+
172
+ def fetch_untracked
173
+ ignore = @base.lib.ignored_files
174
+
175
+ Dir.chdir(@base.dir.path) do
176
+ Dir.glob('**/*', File::FNM_DOTMATCH) do |file|
177
+ next if @files[file] || File.directory?(file) ||
178
+ ignore.include?(file) || file =~ %r{^.git\/.+}
179
+
180
+ @files[file] = { path: file, untracked: true }
181
+ end
182
+ end
183
+ end
184
+
185
+ def fetch_modified
186
+ # find modified in tree
187
+ @base.lib.diff_files.each do |path, data|
188
+ @files[path] ? @files[path].merge!(data) : @files[path] = data
189
+ end
190
+ end
191
+
192
+ def fetch_added
193
+ # find added but not committed - new files
194
+ @base.lib.diff_index('HEAD').each do |path, data|
195
+ @files[path] ? @files[path].merge!(data) : @files[path] = data
196
+ end
197
+ end
198
+ end
199
+ end
data/lib/git/url.rb ADDED
@@ -0,0 +1,127 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'addressable/uri'
4
+
5
+ module Git
6
+ # Methods for parsing a Git URL
7
+ #
8
+ # Any URL that can be passed to `git clone` can be parsed by this class.
9
+ #
10
+ # @see https://git-scm.com/docs/git-clone#_git_urls GIT URLs
11
+ # @see https://github.com/sporkmonger/addressable Addresable::URI
12
+ #
13
+ # @api public
14
+ #
15
+ class URL
16
+ # Regexp used to match a Git URL with an alternative SSH syntax
17
+ # such as `user@host:path`
18
+ #
19
+ GIT_ALTERNATIVE_SSH_SYNTAX = %r{
20
+ ^
21
+ (?:(?<user>[^@/]+)@)? # user or nil
22
+ (?<host>[^:/]+) # host is required
23
+ :(?!/) # : serparator is required, but must not be followed by /
24
+ (?<path>.*?) # path is required
25
+ $
26
+ }x.freeze
27
+
28
+ # Parse a Git URL and return an Addressable::URI object
29
+ #
30
+ # The URI returned can be converted back to a string with 'to_s'. This is
31
+ # guaranteed to return the same URL string that was parsed.
32
+ #
33
+ # @example
34
+ # uri = Git::URL.parse('https://github.com/ruby-git/ruby-git.git')
35
+ # #=> #<Addressable::URI:0x44c URI:https://github.com/ruby-git/ruby-git.git>
36
+ # uri.scheme #=> "https"
37
+ # uri.host #=> "github.com"
38
+ # uri.path #=> "/ruby-git/ruby-git.git"
39
+ #
40
+ # Git::URL.parse('/Users/James/projects/ruby-git')
41
+ # #=> #<Addressable::URI:0x438 URI:/Users/James/projects/ruby-git>
42
+ #
43
+ # @param url [String] the Git URL to parse
44
+ #
45
+ # @return [Addressable::URI] the parsed URI
46
+ #
47
+ def self.parse(url)
48
+ if !url.start_with?('file:') && (m = GIT_ALTERNATIVE_SSH_SYNTAX.match(url))
49
+ GitAltURI.new(user: m[:user], host: m[:host], path: m[:path])
50
+ else
51
+ Addressable::URI.parse(url)
52
+ end
53
+ end
54
+
55
+ # The directory `git clone` would use for the repository directory for the given URL
56
+ #
57
+ # @example
58
+ # Git::URL.clone_to('https://github.com/ruby-git/ruby-git.git') #=> 'ruby-git'
59
+ #
60
+ # @param url [String] the Git URL containing the repository directory
61
+ #
62
+ # @return [String] the name of the repository directory
63
+ #
64
+ def self.clone_to(url, bare: false, mirror: false)
65
+ uri = parse(url)
66
+ path_parts = uri.path.split('/')
67
+ path_parts.pop if path_parts.last == '.git'
68
+ directory = path_parts.last
69
+ if bare || mirror
70
+ directory += '.git' unless directory.end_with?('.git')
71
+ elsif directory.end_with?('.git')
72
+ directory = directory[0..-5]
73
+ end
74
+ directory
75
+ end
76
+ end
77
+
78
+ # The URI for git's alternative scp-like syntax
79
+ #
80
+ # This class is necessary to ensure that #to_s returns the same string
81
+ # that was passed to the initializer.
82
+ #
83
+ # @api public
84
+ #
85
+ class GitAltURI < Addressable::URI
86
+ # Create a new GitAltURI object
87
+ #
88
+ # @example
89
+ # uri = Git::GitAltURI.new(user: 'james', host: 'github.com', path: 'james/ruby-git')
90
+ # uri.to_s #=> 'james@github.com/james/ruby-git'
91
+ #
92
+ # @param user [String, nil] the user from the URL or nil
93
+ # @param host [String] the host from the URL
94
+ # @param path [String] the path from the URL
95
+ #
96
+ def initialize(user:, host:, path:)
97
+ super(scheme: 'git-alt', user: user, host: host, path: path)
98
+ end
99
+
100
+ # Convert the URI to a String
101
+ #
102
+ # Addressible::URI forces path to be absolute by prepending a '/' to the
103
+ # path. This method removes the '/' when converting back to a string
104
+ # since that is what is expected by git. The following is a valid git URL:
105
+ #
106
+ # `james@github.com:ruby-git/ruby-git.git`
107
+ #
108
+ # and the following (with the initial '/'' in the path) is NOT a valid git URL:
109
+ #
110
+ # `james@github.com:/ruby-git/ruby-git.git`
111
+ #
112
+ # @example
113
+ # uri = Git::GitAltURI.new(user: 'james', host: 'github.com', path: 'james/ruby-git')
114
+ # uri.path #=> '/james/ruby-git'
115
+ # uri.to_s #=> 'james@github.com:james/ruby-git'
116
+ #
117
+ # @return [String] the URI as a String
118
+ #
119
+ def to_s
120
+ if user
121
+ "#{user}@#{host}:#{path[1..-1]}"
122
+ else
123
+ "#{host}:#{path[1..-1]}"
124
+ end
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,5 @@
1
+ module Git
2
+ # The current gem version
3
+ # @return [String] the current gem version.
4
+ VERSION='1.12.0'
5
+ end
@@ -0,0 +1,4 @@
1
+ module Git
2
+ class WorkingDirectory < Git::Path
3
+ end
4
+ end
@@ -0,0 +1,38 @@
1
+ require 'git/path'
2
+
3
+ module Git
4
+
5
+ class Worktree < Path
6
+
7
+ attr_accessor :full, :dir, :gcommit
8
+
9
+ def initialize(base, dir, gcommit = nil)
10
+ @full = dir
11
+ @full += ' ' + gcommit if !gcommit.nil?
12
+ @base = base
13
+ @dir = dir
14
+ @gcommit = gcommit
15
+ end
16
+
17
+ def gcommit
18
+ @gcommit ||= @base.gcommit(@full)
19
+ @gcommit
20
+ end
21
+
22
+ def add
23
+ @base.lib.worktree_add(@dir, @gcommit)
24
+ end
25
+
26
+ def remove
27
+ @base.lib.worktree_remove(@dir)
28
+ end
29
+
30
+ def to_a
31
+ [@full]
32
+ end
33
+
34
+ def to_s
35
+ @full
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,47 @@
1
+ module Git
2
+ # object that holds all the available worktrees
3
+ class Worktrees
4
+
5
+ include Enumerable
6
+
7
+ def initialize(base)
8
+ @worktrees = {}
9
+
10
+ @base = base
11
+
12
+ # Array contains [dir, git_hash]
13
+ @base.lib.worktrees_all.each do |w|
14
+ @worktrees[w[0]] = Git::Worktree.new(@base, w[0], w[1])
15
+ end
16
+ end
17
+
18
+ # array like methods
19
+
20
+ def size
21
+ @worktrees.size
22
+ end
23
+
24
+ def each(&block)
25
+ @worktrees.values.each(&block)
26
+ end
27
+
28
+ def [](worktree_name)
29
+ @worktrees.values.inject(@worktrees) do |worktrees, worktree|
30
+ worktrees[worktree.full] ||= worktree
31
+ worktrees
32
+ end[worktree_name.to_s]
33
+ end
34
+
35
+ def to_s
36
+ out = ''
37
+ @worktrees.each do |k, b|
38
+ out << b.to_s << "\n"
39
+ end
40
+ out
41
+ end
42
+
43
+ def prune
44
+ @base.lib.worktree_prune
45
+ end
46
+ end
47
+ end