rumr 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/rumr +5 -0
- data/lib/rumr.rb +57 -0
- metadata +60 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4336d2f8c584d8ecaba26ea64594e6979105781e
|
4
|
+
data.tar.gz: 161f7f5f7643bfa53873811d33839dc77b536f25
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 17befb6b95a66143496fc19c27b2161ea568b31d0578731fe5642d8c8d32fa62fc252e171631fdf356bf108012ab88d31fdab3e3050f57c6f6321a8b6856ae52
|
7
|
+
data.tar.gz: 8fdac461f656aec914630f4bf3945d92be25c96340f538f0c15662f90ede2d989ab29f0f75957f5cee2fc41b75db22bdc1a80169ddfe7b29012ba60a4c6b2475
|
data/bin/rumr
ADDED
data/lib/rumr.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'find'
|
2
|
+
require 'yaml'
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
# [Ru]by [m]ulti-[r]epository command line tool
|
6
|
+
class Rumr < Thor
|
7
|
+
desc 'register', 'Register a directory'
|
8
|
+
method_option :directory,
|
9
|
+
aliases: '-d',
|
10
|
+
type: :string,
|
11
|
+
default: './',
|
12
|
+
desc: 'Directory to register'
|
13
|
+
method_option :tag,
|
14
|
+
aliases: '-t',
|
15
|
+
type: :array,
|
16
|
+
default: 'default',
|
17
|
+
desc: 'Tag/s to register'
|
18
|
+
method_option :append,
|
19
|
+
type: :boolean,
|
20
|
+
desc: 'Append given tags to any existing tags?'
|
21
|
+
def register
|
22
|
+
new_tags = options[:tag]
|
23
|
+
rumr_file = File.join(options[:directory], '.rumr')
|
24
|
+
if options[:append] && File.exist?(rumr_file)
|
25
|
+
cur_tags = YAML.load_file(rumr_file)
|
26
|
+
new_tags = (new_tags + cur_tags).uniq
|
27
|
+
end
|
28
|
+
File.open(rumr_file, 'w') { |f| f.write new_tags.to_yaml }
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'exec COMMAND', 'Execute (run) a given command on registered directories'
|
32
|
+
method_option :basepath,
|
33
|
+
aliases: '-b',
|
34
|
+
type: :string,
|
35
|
+
default: './',
|
36
|
+
desc: 'Directory to begin search for rumr files.'
|
37
|
+
method_option :tag,
|
38
|
+
aliases: '-t',
|
39
|
+
type: :string,
|
40
|
+
default: 'default',
|
41
|
+
desc: 'Tag to match against'
|
42
|
+
method_option :dryrun,
|
43
|
+
type: :boolean,
|
44
|
+
desc: 'Display (do not execute) the commands to run.'
|
45
|
+
def exec(command)
|
46
|
+
Find.find(options[:basepath]) do |path|
|
47
|
+
next unless File.basename(path) == '.rumr'
|
48
|
+
next unless YAML.load_file(path).include? options[:tag]
|
49
|
+
if options['dryrun']
|
50
|
+
puts "Would execute #{command} in #{path}"
|
51
|
+
else
|
52
|
+
base_path = File.dirname(path)
|
53
|
+
puts `bash -c "cd #{base_path} && #{command}"`
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rumr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kyle W. Purdon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.19.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.19.1
|
27
|
+
description: "[Ru]by [m]ulti-[r]epository Tool"
|
28
|
+
email: kylepurdon@gmail.com
|
29
|
+
executables:
|
30
|
+
- rumr
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- bin/rumr
|
35
|
+
- lib/rumr.rb
|
36
|
+
homepage: http://rubygems.org/gems/rumr
|
37
|
+
licenses:
|
38
|
+
- GPLv3
|
39
|
+
metadata: {}
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 2.4.5
|
57
|
+
signing_key:
|
58
|
+
specification_version: 4
|
59
|
+
summary: Hola!
|
60
|
+
test_files: []
|