gen_mrconfig 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dd8b71a5b29b693cfbd3ee8898337fa136d5a261
4
+ data.tar.gz: 8aa513fce308b2e66b03c3baa2f09301b6e9af1e
5
+ SHA512:
6
+ metadata.gz: b65ed03299660d5df2798f262bb880904bbdf8eaf9274056812cd61a8492cb30ad0164e2a57f09ec37430bf806a2fa8a89e42d1c4179b4b5a074b7ad0d75fade
7
+ data.tar.gz: c3fb0b54fd0424219e9f28001d3a775e3f2911c81b4802c06e31eaa4c8cbc4ded36fc77c6deb118948220b7dff3a32997f77c8cc7792ed640c8046f8d3b04e37
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ .DS_Store
2
+ .sass-cache
3
+ Berksfile
4
+ Berksfile.lock
5
+ *_workdir
6
+ pkg/
7
+ .robotic-cook
8
+ coverage
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2016 Mathieu Sauve-Frankel
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # gen_mrconfig
2
+
3
+ Generate MyRepos configuration files using GitHub search
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
data/bin/gen_mrconfig ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+
5
+ require 'gen_mrconfig/cli'
6
+
7
+ GenMRConfig::CLI.new.run
@@ -0,0 +1,20 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/lib')
2
+ require 'gen_mrconfig/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'gen_mrconfig'
6
+ s.version = GenMRConfig::VERSION
7
+ s.licenses = 'MIT'
8
+ s.platform = Gem::Platform::RUBY
9
+ s.summary = 'generate myrepos configuration files'
10
+ s.description = 'generate myrepos configuration files'
11
+ s.authors = [ 'Mathieu Sauve-Frankel' ]
12
+ s.email = 'msf@kisoku.net'
13
+ s.files = `git ls-files`.split($/)
14
+ s.bindir = 'bin/'
15
+ s.executables = %w{
16
+ gen_mrconfig
17
+ }
18
+ s.add_dependency 'mixlib-cli'
19
+ s.add_dependency 'octokit'
20
+ end
@@ -0,0 +1,58 @@
1
+ require 'fileutils'
2
+ require 'mixlib/cli'
3
+ require 'octokit'
4
+
5
+ module GenMRConfig
6
+ class CLI
7
+ include Mixlib::CLI
8
+
9
+ option :build_dir,
10
+ short: '-b BUILD_DIR',
11
+ long: '--build_dir BUILD_DIR',
12
+ default: Dir.pwd,
13
+ required: true,
14
+ description: 'the directory the cookbook sources are in'
15
+
16
+ option :search_query,
17
+ short: '-s QUERY',
18
+ long: '--search-query QUERY',
19
+ required: true,
20
+ description: 'Github Code search query'
21
+
22
+ def build_dir
23
+ config[:build_dir]
24
+ end
25
+
26
+ def search_query
27
+ config[:search_query]
28
+ end
29
+
30
+ def run
31
+ parse_options
32
+
33
+ client = Octokit::Client.new(netrc: true, auto_paginate: true)
34
+
35
+ results = client.search_code(search_query)
36
+ repos = results[:items].map {|result| result[:repository] }
37
+
38
+ repo_urls = repos.map do |repo|
39
+ [ repo[:name], "git@github.com:#{repo[:full_name]}.git" ]
40
+ end.sort.to_h
41
+
42
+ buf = []
43
+ buf << "# gen_mrconfig: -s #{search_query}"
44
+
45
+ repo_urls.each do |name, url|
46
+ buf << "[#{name}]"
47
+ buf << "checkout = git clone #{url} #{name}"
48
+ buf << ""
49
+ end
50
+
51
+ unless Dir.exist?(build_dir)
52
+ FileUtils.mkdir_p(build_dir)
53
+ end
54
+
55
+ File.write(File.join(build_dir, '.mrconfig'), buf.join("\n"))
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,3 @@
1
+ module GenMRConfig
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gen_mrconfig
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mathieu Sauve-Frankel
8
+ autorequire:
9
+ bindir: bin/
10
+ cert_chain: []
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mixlib-cli
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: octokit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: generate myrepos configuration files
42
+ email: msf@kisoku.net
43
+ executables:
44
+ - gen_mrconfig
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - LICENSE
50
+ - README.md
51
+ - Rakefile
52
+ - bin/gen_mrconfig
53
+ - gen_mrconfig.gemspec
54
+ - lib/gen_mrconfig/cli.rb
55
+ - lib/gen_mrconfig/version.rb
56
+ homepage:
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.6.4
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: generate myrepos configuration files
80
+ test_files: []
81
+ has_rdoc: