paquet 0.1.0

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: bf85e0be99fffc4220472f97d3091b4b97770a62
4
+ data.tar.gz: 13f88a1c078e1a9b0d8786dc5e5885db5282ddc8
5
+ SHA512:
6
+ metadata.gz: 8f60ad2025a1569b56b0a768f8fdcb4e972beb1ce9d87278700c4bae32abdabc62db29f21a74d37605d5c32e854debcdf4731f1c6825cb1196ae3ac3c45a6039
7
+ data.tar.gz: df9ed2b03e730fbd02890442323731656cfd627ce1cc6e40e82bc8a26a25af5367dbc3ad2b06b83b422b5770e6f3e450b4aa67f257dcc825b5de392e6ab0352e
@@ -0,0 +1,3 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at phpellerin@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in paquet.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,36 @@
1
+ # Paquet
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/paquet`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'paquet'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install paquet
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/paquet. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "paquet"
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,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+ require "paquet/version"
3
+ require "paquet/rspec/tasks"
4
+
5
+ module Paquet
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,147 @@
1
+ # encoding: utf-8
2
+ require "bundler"
3
+ require "rake"
4
+ require "rake/tasklib"
5
+ require "fileutils"
6
+ require "net/http"
7
+
8
+ #
9
+ # Uses bundler/fetcher to download stuff
10
+ module Paquet
11
+ class Gem
12
+ RUBYGEMS_URI = "https://rubygems.org/downloads"
13
+
14
+ attr_reader :gems, :ignores
15
+
16
+ def initialize(target_path)
17
+ @target_path = target_path
18
+ @gems = []
19
+ @ignores = []
20
+ end
21
+
22
+ def add(name)
23
+ @gems << name
24
+ end
25
+
26
+ def ignore(name)
27
+ @ignores << name
28
+ end
29
+
30
+ def pack
31
+ FileUtils.rm_rf(@target_path)
32
+ FileUtils.mkdir_p(@target_path)
33
+
34
+ # need to get the current version and dependencies
35
+ required_gems = collect_required_gems
36
+ download_gems(required_gems)
37
+ end
38
+
39
+ def size
40
+ @gems.size
41
+ end
42
+
43
+ private
44
+ class Dependency
45
+ attr_reader :name, :version, :platform
46
+
47
+ def initialize(name, version, platform)
48
+ @name = name
49
+ @version = version
50
+ @platform = platform
51
+ end
52
+
53
+ def to_s
54
+ "#{name}-#{version}"
55
+ end
56
+
57
+ def ruby?
58
+ platform == "ruby"
59
+ end
60
+ end
61
+
62
+ def ignore?(name)
63
+ ignores.include?(name)
64
+ end
65
+
66
+ def collect_required_gems()
67
+ candidates = []
68
+ @gems.each do |name|
69
+ candidates += resolve_dependencies(name)
70
+ end
71
+ candidates.flatten
72
+ end
73
+
74
+ def resolve_dependencies(name)
75
+ return [] if ignore?(name)
76
+
77
+ spec = ::Gem::Specification.find_by_name(name)
78
+ current_dependency = Dependency.new(name, spec.version, spec.platform)
79
+ dependencies = spec.dependencies.select { |dep| dep.type == :runtime }
80
+
81
+ if dependencies.size == 0
82
+ [current_dependency]
83
+ else
84
+ [dependencies.collect { |spec| resolve_dependencies(spec.name) }, current_dependency].flatten.uniq { |s| s.name }
85
+ end
86
+ end
87
+
88
+ def download_gems(required_gems)
89
+ required_gems
90
+ .collect { |gem| gem.ruby? ? "#{gem.name}-#{gem.version}.gem" : "#{gem.name}-#{gem.version}-#{gem.platform}.gem" }
91
+ .uniq
92
+ .each do |name|
93
+ source = "#{RUBYGEMS_URI}/#{name}"
94
+ destination = File.join(@target_path, name)
95
+
96
+ puts "Vendoring: #{name}, downloading: #{source}"
97
+ download_file(source, destination)
98
+ end
99
+ end
100
+
101
+ def download_file(source, destination, counter = 10)
102
+ raise "Too many redirection" if counter == 0
103
+
104
+ f = File.open(destination, "w")
105
+
106
+ begin
107
+ uri = URI.parse(source)
108
+ http = Net::HTTP.new(uri.host, uri.port)
109
+ http.use_ssl = true
110
+ response = http.get(uri.path)
111
+
112
+ case response
113
+ when Net::HTTPSuccess
114
+ f.write(response.body)
115
+ when Net::HTTPRedirection
116
+ download_file(response['location'], destination, counter)
117
+ end
118
+
119
+ ensure
120
+ f.close
121
+ end
122
+ end
123
+ end
124
+
125
+ class Task < Rake::TaskLib
126
+ def initialize(target_path, &block)
127
+ @gem = Gem.new(target_path)
128
+
129
+ instance_eval(&block)
130
+
131
+ namespace :paquet do
132
+ desc "Build a pack with #{@gem.size} gems: #{@gem.gems.join(",")}"
133
+ task :vendor do
134
+ @gem.pack
135
+ end
136
+ end
137
+ end
138
+
139
+ def pack(name)
140
+ @gem.add(name)
141
+ end
142
+
143
+ def ignore(name)
144
+ @gem.ignore(name)
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,3 @@
1
+ module Paquet
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'paquet/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "paquet"
8
+ spec.version = Paquet::VERSION
9
+ spec.authors = ["Elastic"]
10
+ spec.email = ["info@elastic.co"]
11
+ spec.license = "Apache License (2.0)"
12
+
13
+ spec.summary = %q{Rake helpers to create a uber gem}
14
+ spec.description = %q{This gem add a few rake tasks to create a uber gems that will be shipped as a zip}
15
+ spec.homepage = "https://github.com/elastic/paquet"
16
+
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.13"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_runtime_dependency "pry"
28
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: paquet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Elastic
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-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.13'
19
+ name: bundler
20
+ prerelease: false
21
+ type: :development
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '10.0'
33
+ name: rake
34
+ prerelease: false
35
+ type: :development
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
+ name: pry
48
+ prerelease: false
49
+ type: :runtime
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: This gem add a few rake tasks to create a uber gems that will be shipped as a zip
56
+ email:
57
+ - info@elastic.co
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - CODE_OF_CONDUCT.md
64
+ - Gemfile
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - lib/paquet.rb
71
+ - lib/paquet/rspec/tasks.rb
72
+ - lib/paquet/version.rb
73
+ - paquet.gemspec
74
+ homepage: https://github.com/elastic/paquet
75
+ licenses:
76
+ - Apache License (2.0)
77
+ metadata: {}
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: Rake helpers to create a uber gem
98
+ test_files: []