gemius 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9e59990d6ca437f24c46c6afe207d06158fcfddc
4
+ data.tar.gz: da12cf9dd0a8b355ee2739c5c3a42560ea6bd7d4
5
+ SHA512:
6
+ metadata.gz: 89fc16549b8160179bd8ed37709695d7b0cc066408b37cc46b76f5b217221e826e51c2e55ff0731e46f4224ce37edad54c9920298e76d802d9b6bad567265b2d
7
+ data.tar.gz: a746ee2ffafe2281510f017a6978c1c3c70af7b5b6b462c6797008663234fbb48e7b95e2de7af8f40ebdcacdaf01c46a596fde6e01dafdfd93024562f23889f8
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gemius.gemspec
4
+ gemspec
@@ -0,0 +1,42 @@
1
+ # Gemius
2
+
3
+ Parses your Gemfile.lock file and lists all dependencies.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'gemius'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install gemius
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ gemfile_lock = Gemius.gemfile_lock('path to Gemfile.lock')
25
+
26
+ gemfile_lock.specs.first.name
27
+ => "aws-s3"
28
+
29
+ gemfile_lock.specs.first.version
30
+ => "0.6.3"
31
+ ```
32
+
33
+ ## Development
34
+
35
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
+
37
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gemius.
42
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gemius"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gemius/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gemius"
8
+ spec.version = Gemius::VERSION
9
+ spec.authors = ["Konstantin Lazarev"]
10
+ spec.email = ["le6oww5k1@gmail.com"]
11
+
12
+ spec.summary = %q{Parses your Gemfile.lock file and lists all dependencies.}
13
+ spec.homepage = "https://github.com/Le6ow5k1/gemius"
14
+
15
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
16
+ # delete this section to allow pushing this gem to any host.
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
+ else
20
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
21
+ end
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.10"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rspec"
31
+ end
@@ -0,0 +1,8 @@
1
+ require "gemius/version"
2
+ require "gemius/gemfile_lock"
3
+
4
+ module Gemius
5
+ def self.gemfile_lock(filename)
6
+ GemfileLock.new(File.read filename)
7
+ end
8
+ end
@@ -0,0 +1,51 @@
1
+ module Gemius
2
+ class GemfileLock
3
+ SPEC_PATTERN = /^\s*([\w-]+)\s{1}\(((\d|\.)+)\)/
4
+ GIT_SECTION_PATTERN = /^GIT\n\s+remote:\s(.+)\n\s+revision:\s(.*)\n\s+specs:\s((.|\n)*)/
5
+ GEM_SECTION_PATTERN = /^GEM\n((.|\n)*)/
6
+
7
+ def initialize(file_content)
8
+ @file_content = file_content
9
+ end
10
+
11
+ def specs
12
+ @specs ||= @file_content.split("\n\n").flat_map { |section| parse_section(section) }.compact
13
+ end
14
+
15
+ private
16
+
17
+ attr_reader :file_content
18
+
19
+ Spec = Struct.new :name, :version, :remote, :revision
20
+
21
+ def parse_section(section)
22
+ if section.start_with?("GIT\n")
23
+ parse_git_section(section)
24
+ elsif section.start_with?('GEM')
25
+ parse_gem_section(section)
26
+ end
27
+ end
28
+
29
+ def parse_spec_section(content, remote = nil, revision = nil)
30
+ content.split("\n").map { |line| parse_spec(line, remote, revision) }.compact
31
+ end
32
+
33
+ def parse_spec(line, remote = nil, revision = nil)
34
+ _, name, version = line.match(SPEC_PATTERN).to_a
35
+
36
+ Spec.new(name, version, remote, revision) if name && version
37
+ end
38
+
39
+ def parse_git_section(content)
40
+ _, remote, revision, specs_section = content.match(GIT_SECTION_PATTERN).to_a
41
+
42
+ parse_spec_section(specs_section, remote, revision) if specs_section
43
+ end
44
+
45
+ def parse_gem_section(content)
46
+ _, specs_section = content.match(GEM_SECTION_PATTERN).to_a
47
+
48
+ parse_spec_section(specs_section) if specs_section
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,3 @@
1
+ module Gemius
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gemius
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Konstantin Lazarev
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-11-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ~>
17
+ - !ruby/object:Gem::Version
18
+ version: '1.10'
19
+ type: :development
20
+ name: bundler
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '10.0'
33
+ type: :development
34
+ name: rake
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :development
48
+ name: rspec
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - le6oww5k1@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - .travis.yml
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - gemius.gemspec
71
+ - lib/gemius.rb
72
+ - lib/gemius/gemfile_lock.rb
73
+ - lib/gemius/version.rb
74
+ homepage: https://github.com/Le6ow5k1/gemius
75
+ licenses: []
76
+ metadata:
77
+ allowed_push_host: https://rubygems.org
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.8
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Parses your Gemfile.lock file and lists all dependencies.
98
+ test_files: []