agile_utils 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/README.md +18 -23
- data/Rakefile +10 -0
- data/agile_utils.gemspec +19 -18
- data/lib/agile_utils/base_option.rb +99 -0
- data/lib/agile_utils/cli.rb +0 -10
- data/lib/agile_utils/file_util.rb +27 -25
- data/lib/agile_utils/helper.rb +81 -7
- data/lib/agile_utils/logger.rb +4 -4
- data/lib/agile_utils/version.rb +1 -1
- data/lib/agile_utils.rb +1 -0
- data/rubocop-todo.yml +92 -0
- data/test/lib/agile_utils/test_helper.rb +10 -3
- metadata +23 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb264c2409c9d987dc4047e74a706b8af6fd51de
|
4
|
+
data.tar.gz: 45aa72279caed54a4e090d80ba97267946f7650c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b74a8421a3ca5ba677e1d90ad5b0f9ee50f5416cf57c7446b0bad2c9f45ea2f38334b69de8fcd03b838a41aaa66ac006c0570b85cdf44d4a0f86d3f5e0d5bb
|
7
|
+
data.tar.gz: 0280f0d4a578fae6e76d7ba0b1c81c978a4d1d31b5143f49bbc8bbdab2616cda0feaddca283565b7849b548a3c28d2d01fa09b6ade7add51ade7cc553d1e3259
|
data/.rubocop.yml
ADDED
data/README.md
CHANGED
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/agile_utils.svg)](http://badge.fury.io/rb/agile_utils)
|
4
4
|
|
5
|
-
My collection of ruby library that I have
|
6
|
-
|
7
|
-
|
8
|
-
interesting project.
|
5
|
+
My collection of ruby library that I have used in more than one project.
|
6
|
+
To promote the code re-use I move them all to this gem.
|
7
|
+
I hope you will find some of them useful for your interesting project.
|
9
8
|
|
10
9
|
### Installation
|
11
10
|
|
@@ -23,36 +22,32 @@ Or install it yourself as:
|
|
23
22
|
|
24
23
|
### Usage
|
25
24
|
|
26
|
-
#### Use as CLI
|
27
|
-
|
28
|
-
As this gem is intended to be used as a library in other application.
|
29
|
-
I plan to show the available command/api when the command is executed.
|
30
|
-
|
31
|
-
```sh
|
32
|
-
# to show list of all available api
|
33
|
-
agile_utils
|
34
|
-
```
|
35
|
-
|
36
|
-
#### Use as standard ruby library
|
37
|
-
|
38
|
-
This is how the gem supposed to be used.
|
39
|
-
|
40
25
|
```rb
|
41
26
|
# Require and include the library in your code
|
42
27
|
require 'agile_utils'
|
43
28
|
include AgileUtils
|
44
29
|
|
45
|
-
# call
|
30
|
+
# Then call the right method to use.
|
31
|
+
AgileUtils::Helper.capture
|
32
|
+
AgileUtils::Helper.is_linux?
|
33
|
+
AgileUtils::Helper.is_osx?
|
34
|
+
AgileUtils::Helper.make_list
|
35
|
+
AgileUtils::Helper.shell
|
36
|
+
AgileUtils::Helper.time
|
37
|
+
AgileUtils::Helper.uname
|
38
|
+
|
46
39
|
AgileUtils::FileUtil.find()
|
47
|
-
AgileUtils::FileUtils.tar_gzip_files()
|
48
40
|
AgileUtils::FileUtils.delete()
|
41
|
+
AgileUtils::FileUtils.gunzip()
|
42
|
+
AgileUtils::FileUtils.tar_gzip_files()
|
49
43
|
```
|
50
44
|
|
51
|
-
###
|
45
|
+
### Changelogs
|
52
46
|
|
53
|
-
-
|
47
|
+
#### 0.0.3 - 0.0.4
|
54
48
|
|
55
|
-
|
49
|
+
- Add more functions
|
50
|
+
- Code refactoring and cleanup
|
56
51
|
|
57
52
|
#### 0.0.2
|
58
53
|
|
data/Rakefile
CHANGED
@@ -19,3 +19,13 @@ task :pry do
|
|
19
19
|
ARGV.clear
|
20
20
|
Pry.start
|
21
21
|
end
|
22
|
+
|
23
|
+
require 'rubocop/rake_task'
|
24
|
+
desc 'Run RuboCop on the lib directory'
|
25
|
+
Rubocop::RakeTask.new(:rubocop) do |task|
|
26
|
+
task.patterns = ['lib/**/*.rb']
|
27
|
+
# only show the files with failures
|
28
|
+
task.formatters = ['files']
|
29
|
+
# don't abort rake on failure
|
30
|
+
task.fail_on_error = false
|
31
|
+
end
|
data/agile_utils.gemspec
CHANGED
@@ -4,32 +4,33 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'agile_utils/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'agile_utils'
|
8
8
|
spec.version = AgileUtils::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Burin Choomnuan']
|
10
|
+
spec.email = ['agilecreativity@gmail.com']
|
11
11
|
spec.summary = %q{Collection of my library that can be re-used across project}
|
12
12
|
spec.description = %q{My collection of library that I have used that can be shared across multiple project.}
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/agilecreativity/agile_utils'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_runtime_dependency
|
22
|
-
spec.add_runtime_dependency
|
21
|
+
spec.add_runtime_dependency 'thor', '~> 0.18'
|
22
|
+
spec.add_runtime_dependency 'minitar', '~> 0.5.4'
|
23
23
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.5'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.1'
|
26
|
+
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
27
|
+
spec.add_development_dependency 'minitest-spec-context', '~> 0.0.3'
|
28
|
+
spec.add_development_dependency 'guard-minitest', '~> 2.2'
|
29
|
+
spec.add_development_dependency 'minitest', '~> 4.2'
|
30
|
+
spec.add_development_dependency 'guard', '~> 2.6'
|
31
|
+
spec.add_development_dependency 'pry', '~> 0.9'
|
32
|
+
spec.add_development_dependency 'gem-ctags', '~> 1.0'
|
33
|
+
spec.add_development_dependency 'yard', '~> 0.8'
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 0.20'
|
34
35
|
|
35
36
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# General library that can be re-use by multiple projects.
|
2
|
+
module AgileUtils
|
3
|
+
# Store the options that will be shared by many CLI classes
|
4
|
+
module Options
|
5
|
+
# Common options {{{
|
6
|
+
BASE_DIR = [
|
7
|
+
:base_dir,
|
8
|
+
{ type: :string,
|
9
|
+
aliases: '-b',
|
10
|
+
desc: 'Base directory',
|
11
|
+
default: Dir.pwd }
|
12
|
+
]
|
13
|
+
|
14
|
+
EXTS = [
|
15
|
+
:exts,
|
16
|
+
{ type: :array,
|
17
|
+
aliases: '-e',
|
18
|
+
desc: 'List of extensions to search for',
|
19
|
+
default: [] }
|
20
|
+
]
|
21
|
+
|
22
|
+
NON_EXTS = [
|
23
|
+
:non_exts,
|
24
|
+
{ type: :array,
|
25
|
+
aliases: '-f',
|
26
|
+
desc: 'List of extensions to search for',
|
27
|
+
default: [] }
|
28
|
+
]
|
29
|
+
|
30
|
+
INC_WORDS = [
|
31
|
+
:inc_words,
|
32
|
+
{ type: :array,
|
33
|
+
aliases: '-n',
|
34
|
+
desc: 'List of words to be included in the result',
|
35
|
+
default: [] }
|
36
|
+
]
|
37
|
+
|
38
|
+
EXC_WORDS = [
|
39
|
+
:exc_words,
|
40
|
+
{ type: :array,
|
41
|
+
aliases: '-n',
|
42
|
+
desc: 'List of words to be included in the result',
|
43
|
+
default: [] }
|
44
|
+
]
|
45
|
+
|
46
|
+
IGNORE_CASE = [
|
47
|
+
:ignore_case,
|
48
|
+
{ type: :boolean,
|
49
|
+
aliases: '-i',
|
50
|
+
desc: 'Match case insensitively',
|
51
|
+
default: true }
|
52
|
+
]
|
53
|
+
|
54
|
+
RECURSIVE = [
|
55
|
+
:recursive,
|
56
|
+
{ type: :boolean,
|
57
|
+
aliases: '-r',
|
58
|
+
desc: 'Search for files recursively',
|
59
|
+
default: true }
|
60
|
+
]
|
61
|
+
|
62
|
+
VERSION = [
|
63
|
+
:version,
|
64
|
+
{ type: :boolean,
|
65
|
+
aliases: '-v',
|
66
|
+
desc: 'Display version information',
|
67
|
+
default: false }
|
68
|
+
]
|
69
|
+
# }}}
|
70
|
+
|
71
|
+
# Options related to 'VimPrinter' only {{{
|
72
|
+
THEME = [
|
73
|
+
:theme,
|
74
|
+
{ type: :string,
|
75
|
+
aliases: '-t',
|
76
|
+
desc: 'Vim colorscheme to use',
|
77
|
+
default: 'default' }
|
78
|
+
]
|
79
|
+
# }}}
|
80
|
+
|
81
|
+
# The default options text from the above options
|
82
|
+
def default_usage
|
83
|
+
<<-EOT
|
84
|
+
Options:
|
85
|
+
-b, [--base-dir=BASE_DIR] # Base directory
|
86
|
+
# Default: . (current directory)
|
87
|
+
-e, [--exts=one two three] # List of extensions to search for
|
88
|
+
-f, [--non-exts=one two three] # List of extensions to search for
|
89
|
+
-n, [--inc-words=one two three] # List of words to be included in the result
|
90
|
+
-x, [--exc-words=one two three] # List of words to be excluded from the result
|
91
|
+
-i, [--ignore-case], [--no-ignore-case] # Match case insensitively
|
92
|
+
# Default: true
|
93
|
+
-r, [--recursive], [--no-recursive] # Search for files recursively
|
94
|
+
# Default: true
|
95
|
+
-v, [--version], [--no-version] # Display version information
|
96
|
+
EOT
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
data/lib/agile_utils/cli.rb
CHANGED
@@ -3,26 +3,17 @@ require_relative '../agile_utils'
|
|
3
3
|
module AgileUtils
|
4
4
|
class CLI < Thor
|
5
5
|
desc 'main', 'Main entry point'
|
6
|
-
# method_option :commit,
|
7
|
-
# aliases: "-c",
|
8
|
-
# desc: "commit your changes",
|
9
|
-
# default: false
|
10
6
|
def main
|
11
7
|
opts = options.symbolize_keys
|
12
|
-
|
13
8
|
if opts[:version]
|
14
9
|
puts "You are using #{AgileUtils::PROJECT_NAME} version #{AgileUtils::VERSION}"
|
15
10
|
exit
|
16
11
|
end
|
17
|
-
|
18
|
-
puts "FYI: your options #{opts}"
|
19
12
|
execute(opts)
|
20
13
|
end
|
21
14
|
|
22
15
|
desc "usage", "Display help screen"
|
23
16
|
def usage
|
24
|
-
# Add your usage here (How to automate this task from Vim?)
|
25
|
-
# try running :r !./bin/agile_utils help run
|
26
17
|
puts <<-EOS
|
27
18
|
Add your usage here.
|
28
19
|
EOS
|
@@ -34,7 +25,6 @@ module AgileUtils
|
|
34
25
|
|
35
26
|
# @param [Hash<Symbol, Object>] options the options argument
|
36
27
|
def execute(options = {})
|
37
|
-
# TODO: just a place holder for now!
|
38
28
|
puts "FYI: execute with options: #{options}"
|
39
29
|
end
|
40
30
|
|
@@ -32,26 +32,38 @@ module AgileUtils
|
|
32
32
|
#
|
33
33
|
# @param [Array<String>] files list of input files
|
34
34
|
# @param [String] output the output file in .tar.gz format
|
35
|
+
# @todo rename to tar_gzip(..)
|
35
36
|
def tar_gzip_files(files, output = 'output.tar.gz')
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
Minitar.pack_file(file, tar)
|
41
|
-
end
|
42
|
-
ensure
|
43
|
-
# Closes both tar and sgz.
|
44
|
-
tar.close unless tar.nil?
|
45
|
-
tar = nil
|
37
|
+
sgz = Zlib::GzipWriter.new(File.open(output, 'wb'))
|
38
|
+
tar = Archive::Tar::Minitar::Output.new(sgz)
|
39
|
+
files.each do |file|
|
40
|
+
Archive::Tar::Minitar.pack_file(file, tar)
|
46
41
|
end
|
42
|
+
ensure
|
43
|
+
# Closes both tar and sgz.
|
44
|
+
tar.close unless tar.nil?
|
45
|
+
tar = nil
|
46
|
+
end
|
47
|
+
|
48
|
+
# Uncompress 'input.tar.gz' file
|
49
|
+
#
|
50
|
+
# @param [String] filename input file in the 'tar.gzip' format
|
51
|
+
# @param [String] output_dir the output directory
|
52
|
+
def gunzip(filename, output_dir)
|
53
|
+
input_file = File.open(filename, 'rb')
|
54
|
+
tgz = Zlib::GzipReader.new(input_file)
|
55
|
+
# Warning: tgz will be closed!
|
56
|
+
Archive::Tar::Minitar.unpack(tgz, output_dir)
|
57
|
+
# ensure
|
58
|
+
# input_file = nil unless input_file.nil?
|
47
59
|
end
|
48
60
|
|
49
61
|
# Delete the files from the given list
|
62
|
+
#
|
63
|
+
# @param files list of files to be deleted
|
64
|
+
# @todo add ! to flag it as destructive!
|
50
65
|
def delete(files)
|
51
|
-
# Note: should we remove the files and be done with it?
|
52
66
|
files.each do |file|
|
53
|
-
#puts "FYI: about to delete file #{file}"
|
54
|
-
# Note: name clash!!!
|
55
67
|
FileUtils.rm_rf(file)
|
56
68
|
end
|
57
69
|
end
|
@@ -62,8 +74,8 @@ module AgileUtils
|
|
62
74
|
# @param [String] suffix the suffix string
|
63
75
|
#
|
64
76
|
# @return [Array<String>] new list with the suffix added to each element
|
65
|
-
def add_suffix(extensions =
|
66
|
-
extensions.map {|e| "#{e}.#{suffix}" }
|
77
|
+
def add_suffix(extensions = [], suffix)
|
78
|
+
extensions.map { |e| "#{e}.#{suffix}" }
|
67
79
|
end
|
68
80
|
|
69
81
|
# Time the operation before and after the operation for tuning purpose
|
@@ -76,13 +88,3 @@ module AgileUtils
|
|
76
88
|
end
|
77
89
|
end
|
78
90
|
end
|
79
|
-
|
80
|
-
if __FILE__ == $0
|
81
|
-
include AgileUtils
|
82
|
-
files = AgileUtils::FileUtil.find('test/fixtures/inputs', 'rb')
|
83
|
-
puts files
|
84
|
-
AgileUtils::FileUtil.tar_gzip_files files, 'test/fixtures/output.tar.gz'
|
85
|
-
puts "Your output is at #{File.absolute_path('test/fixtures/output.tar.gz')}"
|
86
|
-
puts "About to delete your file.."
|
87
|
-
#AgileUtils::FileUtil.delete ['test/fixtures/output.tar.gz']
|
88
|
-
end
|
data/lib/agile_utils/helper.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'open3'
|
2
|
+
require 'stringio'
|
3
|
+
|
2
4
|
module AgileUtils
|
3
5
|
module Helper
|
4
6
|
class << self
|
@@ -8,17 +10,21 @@ module AgileUtils
|
|
8
10
|
# @param [Array<String>] commands list of command
|
9
11
|
# @return [String] result of the command as the string
|
10
12
|
def shell(commands = [])
|
11
|
-
|
12
|
-
|
13
|
+
begin
|
14
|
+
command = commands.join(' ')
|
15
|
+
stdin, _stderr, _status = Open3.capture3(command)
|
16
|
+
rescue Exception => e
|
17
|
+
raise "Problem processing #{command}, #{e.message}"
|
18
|
+
end
|
13
19
|
stdin
|
14
20
|
end
|
15
21
|
|
16
22
|
def is_osx?
|
17
|
-
uname && uname.strip.downcase ==
|
23
|
+
uname && uname.strip.downcase == 'darwin'
|
18
24
|
end
|
19
25
|
|
20
26
|
def is_linux?
|
21
|
-
uname && uname.strip.downcase ==
|
27
|
+
uname && uname.strip.downcase == 'linux'
|
22
28
|
end
|
23
29
|
|
24
30
|
def uname
|
@@ -34,10 +40,10 @@ module AgileUtils
|
|
34
40
|
# as fast as we get the specific list of keys
|
35
41
|
def string_to_hash(input)
|
36
42
|
hash = {}
|
37
|
-
input.split(
|
43
|
+
input.split('\n').each do |i|
|
38
44
|
#TODO: code smell?
|
39
|
-
item = i.split(
|
40
|
-
item = i.split(
|
45
|
+
item = i.split(':') if is_linux?
|
46
|
+
item = i.split('=') if is_osx?
|
41
47
|
next if item.empty? || item.size != 2
|
42
48
|
hash[item[0].strip] = item[1].strip
|
43
49
|
end
|
@@ -62,6 +68,74 @@ module AgileUtils
|
|
62
68
|
end_time - beg_time
|
63
69
|
end
|
64
70
|
|
71
|
+
# Good for capturing output from the :stdout
|
72
|
+
# e.g. sample usage
|
73
|
+
# output = capture(:stdout) { puts "Hello" }
|
74
|
+
def capture(stream)
|
75
|
+
begin
|
76
|
+
stream = stream.to_s
|
77
|
+
eval "$#{stream} = StringIO.new"
|
78
|
+
yield
|
79
|
+
result = eval("$#{stream}").string
|
80
|
+
ensure
|
81
|
+
eval("$#{stream} = #{stream.upcase}")
|
82
|
+
end
|
83
|
+
result
|
84
|
+
end
|
85
|
+
|
86
|
+
# Convert the hash options to list for use with Thor
|
87
|
+
#
|
88
|
+
# @param [Hash<Objects, Object>] options the option hash
|
89
|
+
# @return [Array<String>] the list of options for use with Thor
|
90
|
+
def make_list(options)
|
91
|
+
list = []
|
92
|
+
to_switches(options).split(" ").each do |a|
|
93
|
+
list << a.gsub('"', "")
|
94
|
+
end
|
95
|
+
list
|
96
|
+
end
|
97
|
+
|
98
|
+
# Cross-platform way of finding an executable in the $PATH.
|
99
|
+
#
|
100
|
+
# @param command [String] the command to look up
|
101
|
+
# @return [String, NilClass] full path to the executable file or nil if the
|
102
|
+
# executable is not valid or available.
|
103
|
+
# Example:
|
104
|
+
# which('ruby') #=> /usr/bin/ruby
|
105
|
+
# which('/usr/bin/ruby') #=> nil
|
106
|
+
# which('bad-executable') #=> nil
|
107
|
+
def which(command)
|
108
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
109
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
110
|
+
exts.each do |ext|
|
111
|
+
exe = File.join(path, "#{command}#{ext}")
|
112
|
+
return exe if File.executable? exe
|
113
|
+
end
|
114
|
+
end
|
115
|
+
return nil
|
116
|
+
end
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
# https://github.com/erikhuda/thor/blob/master/lib/thor/parser/options.rb
|
121
|
+
#
|
122
|
+
# Receives a hash and makes it switches.
|
123
|
+
def to_switches(options)
|
124
|
+
options.map do |key, value|
|
125
|
+
case value
|
126
|
+
when true
|
127
|
+
"--#{key}"
|
128
|
+
when Array
|
129
|
+
"--#{key} #{value.map { |v| v.inspect }.join(' ')}" unless value.empty?
|
130
|
+
when Hash
|
131
|
+
"--#{key} #{value.map { |k, v| "#{k}:#{v}" }.join(' ')}" unless value.empty?
|
132
|
+
when nil, false
|
133
|
+
""
|
134
|
+
else
|
135
|
+
"--#{key} #{value.inspect}"
|
136
|
+
end
|
137
|
+
end.join(" ")
|
138
|
+
end
|
65
139
|
end
|
66
140
|
end
|
67
141
|
end
|
data/lib/agile_utils/logger.rb
CHANGED
@@ -2,9 +2,9 @@ require 'logger'
|
|
2
2
|
module AgileUtils
|
3
3
|
class << self
|
4
4
|
attr_writer :logger
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
# @return [Logger] the Logger for the project
|
6
|
+
def logger
|
7
|
+
@logger ||= Logger.new STDOUT
|
8
|
+
end
|
9
9
|
end
|
10
10
|
end
|
data/lib/agile_utils/version.rb
CHANGED
data/lib/agile_utils.rb
CHANGED
data/rubocop-todo.yml
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-04-23 16:41:01 +1000 using RuboCop version 0.19.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 2
|
9
|
+
# Cop supports --auto-correct.
|
10
|
+
DeprecatedClassMethods:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
# Offense count: 9
|
14
|
+
Documentation:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
# Offense count: 6
|
18
|
+
# Cop supports --auto-correct.
|
19
|
+
EmptyLinesAroundBody:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
Eval:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
# Offense count: 2
|
27
|
+
# Configuration parameters: Exclude.
|
28
|
+
FileName:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
# Offense count: 1
|
32
|
+
# Cop supports --auto-correct.
|
33
|
+
IndentationConsistency:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
# Offense count: 2
|
37
|
+
# Cop supports --auto-correct.
|
38
|
+
LeadingCommentSpace:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
# Offense count: 5
|
42
|
+
LineLength:
|
43
|
+
Max: 89
|
44
|
+
|
45
|
+
# Offense count: 1
|
46
|
+
# Configuration parameters: CountComments.
|
47
|
+
MethodLength:
|
48
|
+
Max: 12
|
49
|
+
|
50
|
+
# Offense count: 2
|
51
|
+
# Configuration parameters: NamePrefixBlacklist.
|
52
|
+
PredicateName:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
# Offense count: 1
|
56
|
+
RedundantBegin:
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
# Offense count: 1
|
60
|
+
RescueException:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
# Offense count: 2
|
64
|
+
RescueModifier:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
# Offense count: 2
|
68
|
+
# Cop supports --auto-correct.
|
69
|
+
SpaceAfterComma:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
# Offense count: 2
|
73
|
+
# Cop supports --auto-correct.
|
74
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
75
|
+
SpaceBeforeBlockBraces:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
# Offense count: 1
|
79
|
+
# Cop supports --auto-correct.
|
80
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
81
|
+
SpaceInsideBlockBraces:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
# Offense count: 16
|
85
|
+
# Cop supports --auto-correct.
|
86
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
87
|
+
StringLiterals:
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
# Offense count: 2
|
91
|
+
UselessAssignment:
|
92
|
+
Enabled: true
|
@@ -1,8 +1,15 @@
|
|
1
1
|
require_relative '../../test_helper'
|
2
2
|
describe AgileUtils::Helper do
|
3
|
-
context '#
|
4
|
-
it '
|
5
|
-
|
3
|
+
context '#shell' do
|
4
|
+
it 'returns result for valid command' do
|
5
|
+
#TODO: very system specific, please mock/stub this out!
|
6
|
+
# or use something like FakeFS?
|
7
|
+
result = AgileUtils::Helper.shell(%w(ls))
|
8
|
+
result.wont_be_nil
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'raises error on invalid command' do
|
12
|
+
assert_raises(RuntimeError) { AgileUtils::Helper.shell(%w(bad-command)) }
|
6
13
|
end
|
7
14
|
end
|
8
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agile_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burin Choomnuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '10.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '10.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: awesome_print
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0.8'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rubocop
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.20'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.20'
|
181
195
|
description: My collection of library that I have used that can be shared across multiple
|
182
196
|
project.
|
183
197
|
email:
|
@@ -188,6 +202,7 @@ extensions: []
|
|
188
202
|
extra_rdoc_files: []
|
189
203
|
files:
|
190
204
|
- ".gitignore"
|
205
|
+
- ".rubocop.yml"
|
191
206
|
- ".travis.yml"
|
192
207
|
- ".yardopts"
|
193
208
|
- Gemfile
|
@@ -198,6 +213,7 @@ files:
|
|
198
213
|
- agile_utils.gemspec
|
199
214
|
- bin/agile_utils
|
200
215
|
- lib/agile_utils.rb
|
216
|
+
- lib/agile_utils/base_option.rb
|
201
217
|
- lib/agile_utils/cli.rb
|
202
218
|
- lib/agile_utils/constant.rb
|
203
219
|
- lib/agile_utils/core_ext/hash/hash.rb
|
@@ -206,6 +222,7 @@ files:
|
|
206
222
|
- lib/agile_utils/helper.rb
|
207
223
|
- lib/agile_utils/logger.rb
|
208
224
|
- lib/agile_utils/version.rb
|
225
|
+
- rubocop-todo.yml
|
209
226
|
- test/fixtures/inputs/demo1.xxx.rb
|
210
227
|
- test/fixtures/inputs/demo2.xxx.rb
|
211
228
|
- test/fixtures/outputs/demo1.xhtml
|