bundly 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 777c942427a322c74a8987b54d470bf3a7056a1b
4
+ data.tar.gz: d8c1bca8e92754b296d6264f842aac2eda642a64
5
+ SHA512:
6
+ metadata.gz: 747229560f5226582ee118bbc55cbbabff3e1093cfaf3bd4b63c713b074afdddccfddcf1fd6e04b9a2d5653066611f65c45a090429364371ddadf8d3e14522d4
7
+ data.tar.gz: e9526e5b6f9ee4db7ef47f5488d18c9b3077d69454cb741200f8917eb6b71baaacbac296d20f77c8f739c66726c51ef8ba3217b0531aa1567a6f26cca3962914
data/.gitignore ADDED
@@ -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/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bundly.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Bundly - Bundle gems from YAML file
2
+
3
+ I really like that Bundler is using Ruby as its configuration file syntax.
4
+ We don't have to learn new syntax.
5
+ We love the syntax.
6
+
7
+ However, it also involves a difficulty that it is not very easy to maintain dependency list via programs.
8
+ So, let's use a YAML file instead!
9
+
10
+ ## Installation
11
+
12
+ Install Bundly using `gem`.
13
+
14
+ ```
15
+ $ gem install bundly
16
+ ```
17
+
18
+ Run setup command in your repository.
19
+
20
+ ```
21
+ $ bundly setup
22
+ ```
23
+
24
+ It will generate a initializer file in `lib/bundly.rb`.
25
+ I recommend checking in the file in your repository so that your teammate can continue working without Bundly.
26
+
27
+ Put some dependencies in `gems.yaml` file.
28
+
29
+ ```yaml
30
+ - name: super_private
31
+ git: git@github.com:acme_corp/super_private_gem.git
32
+ tag: 0.2.3
33
+ ```
34
+
35
+ And then install.
36
+
37
+ ```
38
+ $ bundle install
39
+ ```
40
+
41
+ ## Updating Gems in YAML
42
+
43
+ Bundly provides command to update YAML file.
44
+
45
+ ```
46
+ $ bundly gem super_private tag=0.2.3
47
+ $ bundle install
48
+ ```
49
+
50
+ ## Development
51
+
52
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+
54
+ 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).
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at https://github.com/soutaro/bundly.
59
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bundly"
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
data/bin/setup ADDED
@@ -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
data/bundly.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundly/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bundly"
8
+ spec.version = Bundly::VERSION
9
+ spec.authors = ["Soutaro Matsumoto"]
10
+ spec.email = ["matsumoto@soutaro.com"]
11
+
12
+ spec.summary = %q{Bundle gems from YAML file}
13
+ spec.description = %q{Bundle gems from YAML file}
14
+ spec.homepage = "https://github.com/soutaro/bundly"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.12"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "minitest", "~> 5.0"
24
+
25
+ spec.add_runtime_dependency "thor", "~> 0.19.0"
26
+ spec.add_runtime_dependency "erubis", "~> 2.7.0"
27
+ end
data/example/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ require_relative 'lib/bundly.rb'
4
+ gems File.join(__dir__, 'gems.yaml')
@@ -0,0 +1,22 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ ast (2.3.0)
5
+ parser (2.3.3.1)
6
+ ast (~> 2.2)
7
+ querly (0.3.1)
8
+ parser (~> 2.3.1)
9
+ rainbow (~> 2.1)
10
+ thor (~> 0.19)
11
+ rainbow (2.2.1)
12
+ thor (0.19.4)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ querly (~> 0.3.0)
19
+ thor
20
+
21
+ BUNDLED WITH
22
+ 1.12.5
data/example/gems.yaml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ - name: thor
3
+ - name: querly
4
+ version: "~> 0.3.0"
@@ -0,0 +1,21 @@
1
+ require "yaml"
2
+
3
+ module Bundly
4
+ VERSION = "0.1.0"
5
+
6
+ def gems(file)
7
+ YAML.load(Pathname(file).read).each do |gem|
8
+ name = gem["name"]
9
+ version = gem["version"]
10
+ git = gem["git"]
11
+ branch = gem["branch"]
12
+ tag = gem["tag"]
13
+
14
+ gem name, version, git: git, branch: branch, tag: tag
15
+ end
16
+ end
17
+ end
18
+
19
+ class Bundler::Dsl
20
+ include Bundly
21
+ end
data/exe/bundly ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "pathname"
4
+
5
+ $LOAD_PATH << Pathname(__dir__) + "../lib"
6
+
7
+ require "bundly"
8
+ require "bundly/cli"
9
+
10
+ Bundly::CLI.start(ARGV)
data/lib/bundly/cli.rb ADDED
@@ -0,0 +1,59 @@
1
+ require "thor"
2
+
3
+ module Bundly
4
+ class CLI < Thor
5
+ class_option "--yaml", type: :string, desc: "Yaml file name to list gems", default: "gems.yaml"
6
+
7
+ desc "setup", "Setup your Bundly for your project"
8
+ option "--init", type: :string, desc: "File name to put Bundly initialization code", default: "lib/bundly.rb"
9
+ def setup
10
+ template = Pathname(__dir__) + "template.rb.erb"
11
+ init_script = Pathname(options[:init])
12
+
13
+ init_script.open("w") do |io|
14
+ io.write Erubis::Eruby.new(template.read).result
15
+ end
16
+
17
+ yaml_path = Pathname(options[:yaml])
18
+ yaml_path.write("") unless yaml_path.file?
19
+
20
+ puts "1. Add the following line in your Gemfile to load gems from #{yaml_path}:"
21
+ puts
22
+ puts "require_relative '#{init_script}'"
23
+ puts "gems File.join(__dir__, '#{yaml_path}')"
24
+ puts
25
+ puts "2. Declare your dependencies in #{yaml_path} like:"
26
+ puts
27
+ puts "- name: thor"
28
+ puts " version: ~> 0.1.0"
29
+ puts " git: https://github.com/rails/rails.git"
30
+ puts " branch: foobarbaz"
31
+ puts " tag: 9edd6f54315fbf29bdce4c662329f620ded0badf"
32
+ puts
33
+ end
34
+
35
+ desc "gem GEM PARAMETERS...", "Set gem parameters"
36
+ def gem(gem, *params)
37
+ yaml_path = Pathname(options[:yaml])
38
+ content = YAML.load(yaml_path.read)
39
+
40
+ if content.is_a?(Array)
41
+ gem_hash = content.find {|hash| hash["name"] == gem }
42
+
43
+ if gem_hash
44
+ params.map {|param| param.split(/=/, 2) }.each do |(key, value)|
45
+ if value.size > 0
46
+ gem_hash[key] = value
47
+ else
48
+ gem_hash.delete key
49
+ end
50
+ end
51
+ else
52
+ puts "Could not find gem: #{gem}"
53
+ end
54
+ end
55
+
56
+ yaml_path.write(YAML.dump(content))
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,21 @@
1
+ require "yaml"
2
+
3
+ module Bundly
4
+ VERSION = "<%= Bundly::VERSION %>"
5
+
6
+ def gems(file)
7
+ YAML.load(Pathname(file).read).each do |gem|
8
+ name = gem["name"]
9
+ version = gem["version"]
10
+ git = gem["git"]
11
+ branch = gem["branch"]
12
+ tag = gem["tag"]
13
+
14
+ gem name, version, git: git, branch: branch, tag: tag
15
+ end
16
+ end
17
+ end
18
+
19
+ class Bundler::Dsl
20
+ include Bundly
21
+ end
@@ -0,0 +1,3 @@
1
+ module Bundly
2
+ VERSION = "0.1.0"
3
+ end
data/lib/bundly.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "bundly/version"
2
+
3
+ require "erubis"
4
+ require "yaml"
5
+
6
+ module Bundly
7
+ # Your code goes here...
8
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundly
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Soutaro Matsumoto
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
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
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.19.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.19.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: erubis
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.7.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.7.0
83
+ description: Bundle gems from YAML file
84
+ email:
85
+ - matsumoto@soutaro.com
86
+ executables:
87
+ - bundly
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - README.md
95
+ - Rakefile
96
+ - bin/console
97
+ - bin/setup
98
+ - bundly.gemspec
99
+ - example/Gemfile
100
+ - example/Gemfile.lock
101
+ - example/gems.yaml
102
+ - example/lib/bundly.rb
103
+ - exe/bundly
104
+ - lib/bundly.rb
105
+ - lib/bundly/cli.rb
106
+ - lib/bundly/template.rb.erb
107
+ - lib/bundly/version.rb
108
+ homepage: https://github.com/soutaro/bundly
109
+ licenses: []
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.5.1
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Bundle gems from YAML file
131
+ test_files: []