gemius 0.0.1 → 0.1.0
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 +4 -4
- data/README.md +9 -8
- data/gemius.gemspec +1 -0
- data/lib/gemius.rb +6 -2
- data/lib/gemius/gemfile_lock.rb +24 -22
- data/lib/gemius/version.rb +1 -1
- metadata +24 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f0a7db136857444420f38d99e518a7f710ea480c
|
|
4
|
+
data.tar.gz: cae82d781f94a9b9e548b1edb4827507f5cbd537
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e65dff24442cf8d92683c17cd266617fcbdce90689cf117320bc73df0e46e624413350e23616c25eacadc02673083f4fab9708d173ca6e89dd1654eb8a9d4556
|
|
7
|
+
data.tar.gz: e419dc1ea82f947ab93a433a6e3c0b194dec27c042c072378b5a965253e6f08fbe433f49de8be483485fa73c34d6096a74d89273ed078be853e1ecb87300d313
|
data/README.md
CHANGED
|
@@ -21,13 +21,15 @@ Or install it yourself as:
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
```ruby
|
|
24
|
-
gemfile_lock = Gemius.gemfile_lock('path to Gemfile.lock')
|
|
25
|
-
|
|
26
|
-
gemfile_lock.specs.first
|
|
27
|
-
=>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
gemfile_lock = Gemius.gemfile_lock('path to Gemfile.lock or its contents')
|
|
25
|
+
|
|
26
|
+
spec = gemfile_lock.specs.first
|
|
27
|
+
=> {
|
|
28
|
+
name: "aws-s3",
|
|
29
|
+
version: "0.6.3",
|
|
30
|
+
remote: "git://github.com/JeremyGeros/aws-s3.git",
|
|
31
|
+
revision: "bdf58c51f55bb16a7f2a83f01c34976333cc5f4c"
|
|
32
|
+
}
|
|
31
33
|
```
|
|
32
34
|
|
|
33
35
|
## Development
|
|
@@ -39,4 +41,3 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
39
41
|
## Contributing
|
|
40
42
|
|
|
41
43
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gemius.
|
|
42
|
-
|
data/gemius.gemspec
CHANGED
data/lib/gemius.rb
CHANGED
|
@@ -2,7 +2,11 @@ require "gemius/version"
|
|
|
2
2
|
require "gemius/gemfile_lock"
|
|
3
3
|
|
|
4
4
|
module Gemius
|
|
5
|
-
def self.gemfile_lock(
|
|
6
|
-
|
|
5
|
+
def self.gemfile_lock(path_or_content)
|
|
6
|
+
if File.file?(path_or_content)
|
|
7
|
+
GemfileLock.new(File.read path_or_content)
|
|
8
|
+
else
|
|
9
|
+
GemfileLock.new(path_or_content)
|
|
10
|
+
end
|
|
7
11
|
end
|
|
8
12
|
end
|
data/lib/gemius/gemfile_lock.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module Gemius
|
|
2
2
|
class GemfileLock
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
SPECS_SECTION_RE = /(?:\s{4}((?:\w|-|\.)+)\s\(((?:\w|\.)+)\))+\n?/
|
|
4
|
+
GIT_SECTION_RE = /\s{2}remote:\s(.+)\n\s{2}revision:\s(.+)\n(?:\s{2}ref:\s(.+))?\n?(?:\s{2}branch:\s(.+))?\n?(?:\s{2}tag:\s(.+))?/
|
|
5
|
+
REMOTE_RE = /\s{2}remote:\s(.+)/
|
|
6
6
|
|
|
7
7
|
def initialize(file_content)
|
|
8
8
|
@file_content = file_content
|
|
@@ -16,36 +16,38 @@ module Gemius
|
|
|
16
16
|
|
|
17
17
|
attr_reader :file_content
|
|
18
18
|
|
|
19
|
-
Spec = Struct.new :name, :version, :remote, :revision
|
|
20
|
-
|
|
21
19
|
def parse_section(section)
|
|
22
|
-
if section.start_with?("GIT
|
|
20
|
+
if section.start_with?("GIT")
|
|
23
21
|
parse_git_section(section)
|
|
24
|
-
elsif section.start_with?(
|
|
22
|
+
elsif section.start_with?("PATH")
|
|
23
|
+
parse_path_section(section)
|
|
24
|
+
elsif section.start_with?("GEM")
|
|
25
25
|
parse_gem_section(section)
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
def
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
def parse_git_section(section)
|
|
30
|
+
_, remote, revision, ref, branch, tag = section.match(GIT_SECTION_RE).to_a
|
|
31
|
+
additional_props = {remote: remote, revision: revision}
|
|
32
|
+
additional_props[:ref] = ref if ref
|
|
33
|
+
additional_props[:branch] = branch if branch
|
|
34
|
+
additional_props[:tag] = tag if tag
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
parse_specs_section(section, additional_props)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
parse_spec_section(specs_section, remote, revision) if specs_section
|
|
39
|
+
def parse_path_section(section)
|
|
40
|
+
parse_specs_section(section, remote: section.match(REMOTE_RE)[1])
|
|
43
41
|
end
|
|
44
42
|
|
|
45
|
-
def parse_gem_section(
|
|
46
|
-
|
|
43
|
+
def parse_gem_section(section)
|
|
44
|
+
parse_specs_section(section, remote: section.scan(REMOTE_RE).flatten.join(", "))
|
|
45
|
+
end
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
def parse_specs_section(section, additional_props)
|
|
48
|
+
section.scan(SPECS_SECTION_RE).map do |(name, version)|
|
|
49
|
+
{name: name, version: version}.merge!(additional_props)
|
|
50
|
+
end
|
|
49
51
|
end
|
|
50
52
|
end
|
|
51
|
-
end
|
|
53
|
+
end
|
data/lib/gemius/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,57 +1,71 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gemius
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Konstantin Lazarev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-07-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ~>
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.10'
|
|
19
|
+
name: bundler
|
|
14
20
|
requirement: !ruby/object:Gem::Requirement
|
|
15
21
|
requirements:
|
|
16
22
|
- - ~>
|
|
17
23
|
- !ruby/object:Gem::Version
|
|
18
24
|
version: '1.10'
|
|
19
25
|
type: :development
|
|
20
|
-
name: bundler
|
|
21
26
|
prerelease: false
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
22
28
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
29
|
requirements:
|
|
24
30
|
- - ~>
|
|
25
31
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
27
|
-
|
|
32
|
+
version: '10.0'
|
|
33
|
+
name: rake
|
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
|
29
35
|
requirements:
|
|
30
36
|
- - ~>
|
|
31
37
|
- !ruby/object:Gem::Version
|
|
32
38
|
version: '10.0'
|
|
33
39
|
type: :development
|
|
34
|
-
name: rake
|
|
35
40
|
prerelease: false
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
43
|
requirements:
|
|
38
|
-
- -
|
|
44
|
+
- - '>='
|
|
39
45
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
41
|
-
|
|
46
|
+
version: '0'
|
|
47
|
+
name: rspec
|
|
42
48
|
requirement: !ruby/object:Gem::Requirement
|
|
43
49
|
requirements:
|
|
44
50
|
- - '>='
|
|
45
51
|
- !ruby/object:Gem::Version
|
|
46
52
|
version: '0'
|
|
47
53
|
type: :development
|
|
48
|
-
name: rspec
|
|
49
54
|
prerelease: false
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
57
|
requirements:
|
|
52
58
|
- - '>='
|
|
53
59
|
- !ruby/object:Gem::Version
|
|
54
60
|
version: '0'
|
|
61
|
+
name: pry
|
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
- - '>='
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '0'
|
|
67
|
+
type: :development
|
|
68
|
+
prerelease: false
|
|
55
69
|
description:
|
|
56
70
|
email:
|
|
57
71
|
- le6oww5k1@gmail.com
|