agile_utils 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c20d4dfb448b9e3cf2276dd07eedc04bb3a5a129
4
- data.tar.gz: 64cd89c97cc468c8f531f4ccb85d9a0ca89cfe50
3
+ metadata.gz: c144b001bf9c9544bcae669d12f2fdbaf7da43d6
4
+ data.tar.gz: 95f42c351ccda135f8ee51c2b8c3f7ea118a22db
5
5
  SHA512:
6
- metadata.gz: 9d930c00dcad9f310a969035a9d00de2cd4c669c179847d5b67ec3d78f58e74ea50c2dd7dcfe47c3311786f3cfac337ae1e58b8dbef67fc52c0c915b07195a5d
7
- data.tar.gz: d64cdd6f67adf0d10dba3648efb07d537d3e56c9cf92c6f1d8f1917989bdbc872e5e0a10b408d70cdb82545ea6801d7dd2e229f9b9f13d6eabe041ec4f8f2f40
6
+ metadata.gz: 78a6d98c3941bfe41c1081486e0a3706e95b5295ff79960535f85008e7723e3f19c66a7c2a6537f306633c457d0b0933db2e14368869f1ef85f727f3b21cb83e
7
+ data.tar.gz: 4eed7fb17a589e4e6ed412a50bb448b44ef819425f1167ae70a6fcfc139ac1d3b174ea89f7e74a2e245f900484ddd04c7a1c6bbe25f37173dddbb37be8d8a053
data/.gitignore CHANGED
@@ -15,7 +15,6 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
-
19
18
  # Custom ignore files
20
19
  .ruby-version
21
20
 
data/.rubocop.yml CHANGED
@@ -1,3 +1,96 @@
1
- # This is the configuration used to check the rubocop source code.
1
+ AllCops:
2
+ Include:
3
+ - Gemfile
4
+ - Rakefile
5
+ - bin/*
6
+ - agile_utils.gemspec
7
+ - lib/**/*.rb
8
+ - test/**/*.rb
2
9
 
3
- inherit_from: rubocop-todo.yml
10
+ # Avoid long parameter lists
11
+ ParameterLists:
12
+ Max: 5
13
+ CountKeywordArgs: true
14
+
15
+ MethodLength:
16
+ CountComments: false
17
+ Max: 15
18
+
19
+ # Avoid more than `Max` levels of nesting.
20
+ BlockNesting:
21
+ Max: 4
22
+
23
+ # Align with the style guide.
24
+ CollectionMethods:
25
+ PreferredMethods:
26
+ collect: 'map'
27
+ inject: 'reduce'
28
+ find: 'detect'
29
+ find_all: 'select'
30
+
31
+ # Do not force public/protected/private keyword to be indented at the same
32
+ # level as the def keyword. My personal preference is to outdent these keywords
33
+ # because I think when scanning code it makes it easier to identify the
34
+ # sections of code and visually separate them. When the keyword is at the same
35
+ # level I think it sort of blends in with the def keywords and makes it harder
36
+ # to scan the code and see where the sections are.
37
+ AccessModifierIndentation:
38
+ Enabled: false
39
+
40
+ # Limit line length
41
+ LineLength:
42
+ Enabled: false
43
+
44
+ # Disable documentation checking until a class needs to be documented once
45
+ Documentation:
46
+ Enabled: false
47
+
48
+ # Enforce Ruby 1.8-compatible hash syntax
49
+ HashSyntax:
50
+ Enabled: true
51
+
52
+ # No spaces inside hash literals
53
+ SpaceInsideHashLiteralBraces:
54
+ EnforcedStyle: no_space
55
+
56
+ # Allow dots at the end of lines
57
+ DotPosition:
58
+ Enabled: false
59
+
60
+ # Don't require magic comment at the top of every file
61
+ Encoding:
62
+ Enabled: false
63
+
64
+ # Enforce outdenting of access modifiers (i.e. public, private, protected)
65
+ AccessModifierIndentation:
66
+ EnforcedStyle: outdent
67
+
68
+ EmptyLinesAroundAccessModifier:
69
+ Enabled: true
70
+
71
+ # Align ends correctly
72
+ EndAlignment:
73
+ AlignWith: variable
74
+
75
+ # Indentation of when/else
76
+ CaseIndentation:
77
+ IndentWhenRelativeTo: end
78
+ IndentOneStep: false
79
+
80
+ DoubleNegation:
81
+ Enabled: false
82
+
83
+ PercentLiteralDelimiters:
84
+ PreferredDelimiters:
85
+ '%': ()
86
+ '%i': ()
87
+ '%q': ()
88
+ '%Q': ()
89
+ '%r': '{}'
90
+ '%s': ()
91
+ '%w': '[]'
92
+ '%W': '[]'
93
+ '%x': ()
94
+
95
+ StringLiterals:
96
+ EnforcedStyle: double_quotes
@@ -1,4 +1,8 @@
1
- ### Changelogs
1
+ #### 0.1.2
2
+
3
+ - Style cleanup with rubocop
4
+ - Minor code cleanup
5
+ - Consistently use double quote for string
2
6
 
3
7
  #### 0.1.0
4
8
 
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in agile_utils.gemspec
4
4
  gemspec
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
3
 
4
- project_name = 'agile_utils'
4
+ project_name = "agile_utils"
5
5
 
6
6
  Rake::TestTask.new do |t|
7
7
  t.libs << "lib/#{project_name}"
@@ -12,20 +12,20 @@ end
12
12
  task default: :test
13
13
 
14
14
  task :pry do
15
- require 'pry'
16
- require 'awesome_print'
17
- require_relative 'lib/agile_utils'
15
+ require "pry"
16
+ require "awesome_print"
17
+ require_relative "lib/agile_utils"
18
18
  include AgileUtils
19
19
  ARGV.clear
20
20
  Pry.start
21
21
  end
22
22
 
23
- require 'rubocop/rake_task'
24
- desc 'Run RuboCop on the lib directory'
23
+ require "rubocop/rake_task"
24
+ desc "Run RuboCop on the lib directory"
25
25
  Rubocop::RakeTask.new(:rubocop) do |task|
26
- task.patterns = ['lib/**/*.rb']
26
+ task.patterns = ["lib/**/*.rb"]
27
27
  # only show the files with failures
28
- task.formatters = ['files']
28
+ task.formatters = ["files"]
29
29
  # don't abort rake on failure
30
30
  task.fail_on_error = false
31
31
  end
data/agile_utils.gemspec CHANGED
@@ -1,39 +1,38 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'agile_utils/version'
4
+ require "agile_utils/version"
5
5
  Gem::Specification.new do |spec|
6
- spec.name = 'agile_utils'
6
+ spec.name = "agile_utils"
7
7
  spec.version = AgileUtils::VERSION
8
- spec.authors = ['Burin Choomnuan']
9
- spec.email = ['agilecreativity@gmail.com']
8
+ spec.authors = ["Burin Choomnuan"]
9
+ spec.email = ["agilecreativity@gmail.com"]
10
10
  spec.summary = %q(Collection of my ruby library that can be re-used across projects)
11
11
  spec.description = %q(My collection of library that I have used that can be shared across multiple projects)
12
- spec.homepage = 'https://github.com/agilecreativity/agile_utils'
13
- spec.license = 'MIT'
14
- spec.files = Dir.glob('{bin,lib}/**/*') + %w(Gemfile
12
+ spec.homepage = "https://github.com/agilecreativity/agile_utils"
13
+ spec.license = "MIT"
14
+ spec.files = Dir.glob("{bin,lib}/**/*") + %w[Gemfile
15
15
  Rakefile
16
16
  agile_utils.gemspec
17
17
  README.md
18
- CHANGELOGS.md
18
+ CHANGELOG.md
19
19
  LICENSE
20
20
  .rubocop.yml
21
- .gitignore
22
- rubocop-todo.yml)
21
+ .gitignore]
23
22
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
- spec.test_files = Dir.glob('{test}/**/*')
25
- spec.require_paths = ['lib']
26
- spec.add_runtime_dependency 'thor', '~> 0.19.1'
27
- spec.add_runtime_dependency 'minitar', '~> 0.5.4'
28
- spec.add_development_dependency 'bundler', '~> 1.5'
29
- spec.add_development_dependency 'rake', '~> 10.1'
30
- spec.add_development_dependency 'awesome_print', '~> 1.2'
31
- spec.add_development_dependency 'minitest-spec-context', '~> 0.0.3'
32
- spec.add_development_dependency 'guard-minitest', '~> 2.2'
33
- spec.add_development_dependency 'minitest', '~> 5.3'
34
- spec.add_development_dependency 'guard', '~> 2.6'
35
- spec.add_development_dependency 'pry', '~> 0.9'
36
- spec.add_development_dependency 'gem-ctags', '~> 1.0'
37
- spec.add_development_dependency 'yard', '~> 0.8'
38
- spec.add_development_dependency 'rubocop', '~> 0.20'
23
+ spec.test_files = Dir.glob("{test}/**/*")
24
+ spec.require_paths = ["lib"]
25
+ spec.add_runtime_dependency "thor", "~> 0.19"
26
+ spec.add_runtime_dependency "minitar", "~> 0.5.4"
27
+ spec.add_development_dependency "bundler", "~> 1.5"
28
+ spec.add_development_dependency "rake", "~> 10.1"
29
+ spec.add_development_dependency "awesome_print", "~> 1.2"
30
+ spec.add_development_dependency "minitest-spec-context", "~> 0.0.3"
31
+ spec.add_development_dependency "guard-minitest", "~> 2.2"
32
+ spec.add_development_dependency "minitest", "~> 5.3"
33
+ spec.add_development_dependency "guard", "~> 2.6"
34
+ spec.add_development_dependency "pry", "~> 0.9"
35
+ spec.add_development_dependency "gem-ctags", "~> 1.0"
36
+ spec.add_development_dependency "yard", "~> 0.8"
37
+ spec.add_development_dependency "rubocop", "~> 0.20"
39
38
  end
data/bin/agile_utils CHANGED
@@ -1,6 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Add the code for binary if we need one
3
- require_relative '../lib/agile_utils'
3
+ require_relative "../lib/agile_utils"
4
4
  puts "Welcome to #{AgileUtils::PROJECT_NAME} version #{AgileUtils::VERSION}"
5
5
  include AgileUtils
6
- AgileUtils::CLI.start(ARGV)
6
+ if ARGV.empty?
7
+ AgileUtils::CLI.start(%w[usage])
8
+ else
9
+ AgileUtils::CLI.start(%w[main].concat(ARGV))
10
+ end
@@ -1,68 +1,67 @@
1
1
  module AgileUtils
2
- # Store the options that will be shared by many CLI classes
3
2
  module Options
4
3
  BASE_DIR = [
5
4
  :base_dir,
6
- { type: :string,
7
- aliases: '-b',
8
- desc: 'Base directory',
9
- default: Dir.pwd }
5
+ {type: :string,
6
+ aliases: "-b",
7
+ desc: "Base directory",
8
+ default: Dir.pwd}
10
9
  ]
11
10
 
12
11
  EXTS = [
13
12
  :exts,
14
- { type: :array,
15
- aliases: '-e',
16
- desc: 'List of extensions to search for',
17
- default: [] }
13
+ {type: :array,
14
+ aliases: "-e",
15
+ desc: "List of extensions to search for",
16
+ default: []}
18
17
  ]
19
18
 
20
19
  NON_EXTS = [
21
20
  :non_exts,
22
- { type: :array,
23
- aliases: '-f',
24
- desc: 'List of files without extension to search for',
25
- default: [] }
21
+ {type: :array,
22
+ aliases: "-f",
23
+ desc: "List of files without extension to search for",
24
+ default: []}
26
25
  ]
27
26
 
28
27
  INC_WORDS = [
29
28
  :inc_words,
30
- { type: :array,
31
- aliases: '-n',
32
- desc: 'List of words to be included in the result if any',
33
- default: [] }
29
+ {type: :array,
30
+ aliases: "-n",
31
+ desc: "List of words to be included in the result if any",
32
+ default: []}
34
33
  ]
35
34
 
36
35
  EXC_WORDS = [
37
36
  :exc_words,
38
- { type: :array,
39
- aliases: '-x',
40
- desc: 'List of words to be excluded from the result if any',
41
- default: [] }
37
+ {type: :array,
38
+ aliases: "-x",
39
+ desc: "List of words to be excluded from the result if any",
40
+ default: []}
42
41
  ]
43
42
 
44
43
  IGNORE_CASE = [
45
44
  :ignore_case,
46
- { type: :boolean,
47
- aliases: '-i',
48
- desc: 'Match case insensitively',
49
- default: true }
45
+ {type: :boolean,
46
+ aliases: "-i",
47
+ desc: "Match case insensitively",
48
+ default: true}
50
49
  ]
51
50
 
52
51
  RECURSIVE = [
53
52
  :recursive,
54
- { type: :boolean,
55
- aliases: '-r',
56
- desc: 'Search for files recursively',
57
- default: true }
53
+ {type: :boolean,
54
+ aliases: "-r",
55
+ desc: "Search for files recursively",
56
+ default: true}
58
57
  ]
59
58
 
60
59
  VERSION = [
61
60
  :version,
62
- { type: :boolean,
63
- aliases: '-v',
64
- desc: 'Display version information',
65
- default: false }
61
+ {type: :boolean,
62
+ aliases: "-v",
63
+ desc: "Display version information",
64
+ default: false}
66
65
  ]
67
66
  end
68
67
  end
@@ -1,25 +1,23 @@
1
- require 'thor'
2
- require_relative '../agile_utils'
1
+ require "thor"
2
+ require_relative "../agile_utils"
3
3
  module AgileUtils
4
4
  class CLI < Thor
5
- desc 'main', 'Main entry point'
5
+ desc "main", "Main entry point"
6
6
  def main
7
7
  opts = options.symbolize_keys
8
8
  if opts[:version]
9
9
  puts "You are using #{AgileUtils::PROJECT_NAME} version #{AgileUtils::VERSION}"
10
10
  exit
11
11
  end
12
- execute(opts)
13
12
  end
14
-
15
- desc 'usage', 'Display help screen'
13
+ desc "usage", "Display help screen"
16
14
  def usage
17
15
  puts <<-EOS
18
16
  # List of available APIs
19
17
  require 'agile_utils'
20
18
  include AgileUtils
21
19
 
22
- # Make a call to any of the following
20
+ # General methods
23
21
  AgileUtils::Helper.capture
24
22
  AgileUtils::Helper.is_linux?
25
23
  AgileUtils::Helper.is_osx?
@@ -28,6 +26,7 @@ AgileUtils::Helper.shell
28
26
  AgileUtils::Helper.time
29
27
  AgileUtils::Helper.uname
30
28
 
29
+ # File and related methods
31
30
  AgileUtils::FileUtil.find()
32
31
  AgileUtils::FileUtils.delete()
33
32
  AgileUtils::FileUtils.gunzip()
@@ -36,12 +35,5 @@ AgileUtils::FileUtils.tar_gzip_files()
36
35
  end
37
36
 
38
37
  default_task :usage
39
-
40
- private
41
-
42
- # @param [Hash<Symbol, Object>] options the options argument
43
- def execute(options = {})
44
- puts "FYI: execute with options: #{options}"
45
- end
46
38
  end
47
39
  end
@@ -1,3 +1,3 @@
1
1
  module AgileUtils
2
- PROJECT_NAME = 'AgileUtils'
2
+ PROJECT_NAME = "AgileUtils"
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'tempfile'
1
+ require "tempfile"
2
2
  module Kernel
3
3
  # From: 'activesupport-4.1.0/lib/active_support/core_ext/kernel/reporting.rb
4
4
  #
@@ -1,30 +1,26 @@
1
- require 'zlib'
2
- require 'stringio'
3
- require 'find'
4
- require 'fileutils'
5
- require 'archive/tar/minitar'
6
-
1
+ require "zlib"
2
+ require "stringio"
3
+ require "find"
4
+ require "fileutils"
5
+ require "archive/tar/minitar"
7
6
  module AgileUtils
8
7
  include Archive::Tar
9
8
  include Archive::Tar::Minitar
10
-
11
9
  module FileUtil
12
10
  class << self
13
- # @todo use me when you have to!
14
11
  CustomError = Class.new(StandardError)
15
-
16
12
  # Find list of files based on certain extension
17
13
  #
18
14
  # @param [String] base_dir the starting directory
19
15
  # @param [String] extension the file extension to search for
20
16
  #
21
17
  # @return [Array<String>] list of matching files or empty list
22
- def find(base_dir, extension = 'xhtml')
18
+ def find(base_dir, extension = "xhtml")
23
19
  file_paths = []
24
20
  Find.find(base_dir) do |path|
25
21
  file_paths << path if path =~ /.*\.#{extension}$/
26
22
  end
27
- file_paths || []
23
+ file_paths
28
24
  end
29
25
 
30
26
  # Tar and gzip list of files
@@ -32,8 +28,8 @@ module AgileUtils
32
28
  # @param [Array<String>] files list of input files
33
29
  # @param [String] output the output file in .tar.gz format
34
30
  # @todo rename to tar_gzip(..)
35
- def tar_gzip_files(files, output = 'output.tar.gz')
36
- sgz = Zlib::GzipWriter.new(File.open(output, 'wb'))
31
+ def tar_gzip_files(files, output = "output.tar.gz")
32
+ sgz = Zlib::GzipWriter.new(File.open(output, "wb"))
37
33
  tar = Archive::Tar::Minitar::Output.new(sgz)
38
34
  files.each do |file|
39
35
  Archive::Tar::Minitar.pack_file(file, tar)
@@ -49,12 +45,9 @@ module AgileUtils
49
45
  # @param [String] filename input file in the 'tar.gzip' format
50
46
  # @param [String] output_dir the output directory
51
47
  def gunzip(filename, output_dir)
52
- input_file = File.open(filename, 'rb')
48
+ input_file = File.open(filename, "rb")
53
49
  tgz = Zlib::GzipReader.new(input_file)
54
- # Warning: tgz will be closed!
55
50
  Archive::Tar::Minitar.unpack(tgz, output_dir)
56
- # ensure
57
- # input_file = nil unless input_file.nil?
58
51
  end
59
52
 
60
53
  # Delete the files from the given list
@@ -1,5 +1,5 @@
1
- require 'open3'
2
- require 'stringio'
1
+ require "open3"
2
+ require "stringio"
3
3
  module AgileUtils
4
4
  module Helper
5
5
  class << self
@@ -9,24 +9,24 @@ module AgileUtils
9
9
  # @return [String] result of the command as the string
10
10
  def shell(commands = [])
11
11
  begin
12
- command = commands.join(' ')
12
+ command = commands.join(" ")
13
13
  stdin, _stderr, _status = Open3.capture3(command)
14
- rescue Exception => e
14
+ rescue => e
15
15
  raise "Problem processing #{command}, #{e.message}"
16
16
  end
17
17
  stdin
18
18
  end
19
19
 
20
20
  def is_osx?
21
- uname && uname.strip.downcase == 'darwin'
21
+ uname && uname.strip.downcase == "darwin"
22
22
  end
23
23
 
24
24
  def is_linux?
25
- uname && uname.strip.downcase == 'linux'
25
+ uname && uname.strip.downcase == "linux"
26
26
  end
27
27
 
28
28
  def uname
29
- shell(%w(uname))
29
+ shell(%w[uname])
30
30
  end
31
31
 
32
32
  # Extract "key1: value1\nkey2: value 2" to
@@ -40,8 +40,8 @@ module AgileUtils
40
40
  hash = {}
41
41
  input.split('\n').each do |i|
42
42
  # TODO: code smell?
43
- item = i.split(':') if is_linux?
44
- item = i.split('=') if is_osx?
43
+ item = i.split(":") if is_linux?
44
+ item = i.split("=") if is_osx?
45
45
  next if item.empty? || item.size != 2
46
46
  hash[item[0].strip] = item[1].strip
47
47
  end
@@ -87,8 +87,8 @@ module AgileUtils
87
87
  # @return [Array<String>] the list of options for use with Thor
88
88
  def make_list(options)
89
89
  list = []
90
- to_switches(options).split(' ').each do |a|
91
- list << a.gsub('"', '')
90
+ to_switches(options).split(" ").each do |a|
91
+ list << a.gsub('"', "")
92
92
  end
93
93
  list
94
94
  end
@@ -103,8 +103,8 @@ module AgileUtils
103
103
  # which('/usr/bin/ruby') #=> nil
104
104
  # which('bad-executable') #=> nil
105
105
  def which(command)
106
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
107
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
106
+ exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
107
+ ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
108
108
  exts.each do |ext|
109
109
  exe = File.join(path, "#{command}#{ext}")
110
110
  return exe if File.executable? exe
@@ -113,7 +113,7 @@ module AgileUtils
113
113
  nil
114
114
  end
115
115
 
116
- private
116
+ private
117
117
 
118
118
  # https://github.com/erikhuda/thor/blob/master/lib/thor/parser/options.rb
119
119
  #
@@ -124,15 +124,15 @@ module AgileUtils
124
124
  when true
125
125
  "--#{key}"
126
126
  when Array
127
- "--#{key} #{value.map { |v| v.inspect }.join(' ')}" unless value.empty?
127
+ "--#{key} #{value.map { |v| v.inspect }.join(" ")}" unless value.empty?
128
128
  when Hash
129
- "--#{key} #{value.map { |k, v| "#{k}:#{v}" }.join(' ')}" unless value.empty?
129
+ "--#{key} #{value.map { |k, v| "#{k}:#{v}" }.join(" ")}" unless value.empty?
130
130
  when nil, false
131
- ''
131
+ ""
132
132
  else
133
133
  "--#{key} #{value.inspect}"
134
134
  end
135
- end.join(' ')
135
+ end.join(" ")
136
136
  end
137
137
  end
138
138
  end
@@ -1,4 +1,4 @@
1
- require 'logger'
1
+ require "logger"
2
2
  module AgileUtils
3
3
  class << self
4
4
  attr_writer :logger
@@ -1,3 +1,3 @@
1
1
  module AgileUtils
2
- VERSION = '0.1.1'
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/agile_utils.rb CHANGED
@@ -1,9 +1,9 @@
1
- require_relative './agile_utils/core_ext/hash/hash'
2
- require_relative './agile_utils/core_ext/kernel/reporting'
3
- require_relative './agile_utils/constant'
4
- require_relative './agile_utils/version'
5
- require_relative './agile_utils/logger'
6
- require_relative './agile_utils/cli'
7
- require_relative './agile_utils/helper'
8
- require_relative './agile_utils/file_util'
9
- require_relative './agile_utils/base_option'
1
+ require_relative "./agile_utils/core_ext/hash/hash"
2
+ require_relative "./agile_utils/core_ext/kernel/reporting"
3
+ require_relative "./agile_utils/constant"
4
+ require_relative "./agile_utils/version"
5
+ require_relative "./agile_utils/logger"
6
+ require_relative "./agile_utils/cli"
7
+ require_relative "./agile_utils/helper"
8
+ require_relative "./agile_utils/file_util"
9
+ require_relative "./agile_utils/base_option"
@@ -1,22 +1,18 @@
1
- require_relative '../../test_helper'
2
- require 'fileutils'
3
-
1
+ require_relative "../../test_helper"
2
+ require "fileutils"
4
3
  describe AgileUtils do
5
-
6
- context '#tar_gzip_files' do
4
+ context "#tar_gzip_files" do
7
5
  before do
8
- FileUtils.rm_rf('test/fixtures/output.tar.gz')
9
- @files = AgileUtils::FileUtil.find('test/fixtures/outputs', 'xhtml')
6
+ FileUtils.rm_rf("test/fixtures/output.tar.gz")
7
+ @files = AgileUtils::FileUtil.find("test/fixtures/outputs", "xhtml")
10
8
  end
11
-
12
9
  after do
13
- FileUtils.rm_rf('test/fixtures/output.tar.gz')
10
+ FileUtils.rm_rf("test/fixtures/output.tar.gz")
14
11
  end
15
-
16
- it 'compresses list of files' do
17
- refute File.exist?('test/fixtures/output.tar.gz'), 'Output file must not exist'
18
- AgileUtils::FileUtil.tar_gzip_files(@files, 'test/fixtures/output.tar.gz')
19
- assert File.exist?('test/fixtures/output.tar.gz'), 'Output file must be generated'
12
+ it "compresses list of files" do
13
+ refute File.exist?("test/fixtures/output.tar.gz"), "Output file must not exist"
14
+ AgileUtils::FileUtil.tar_gzip_files(@files, "test/fixtures/output.tar.gz")
15
+ assert File.exist?("test/fixtures/output.tar.gz"), "Output file must be generated"
20
16
  end
21
17
  end
22
18
  end
@@ -1,15 +1,12 @@
1
- require_relative '../../test_helper'
1
+ require_relative "../../test_helper"
2
2
  describe AgileUtils::Helper do
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))
3
+ context "#shell" do
4
+ it "returns result for valid command" do
5
+ result = AgileUtils::Helper.shell(%w[ls])
8
6
  result.wont_be_nil
9
7
  end
10
-
11
- it 'raises error on invalid command' do
12
- assert_raises(RuntimeError) { AgileUtils::Helper.shell(%w(bad-command)) }
8
+ it "raises error on invalid command" do
9
+ assert_raises(RuntimeError) { AgileUtils::Helper.shell(%w[bad-command]) }
13
10
  end
14
11
  end
15
12
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
- require 'minitest/autorun'
2
- require 'minitest/pride'
3
- require 'minitest-spec-context'
4
- require 'pry'
5
- require 'awesome_print'
6
- require_relative '../lib/agile_utils'
1
+ require "minitest/autorun"
2
+ require "minitest/pride"
3
+ require "minitest-spec-context"
4
+ require "pry"
5
+ require "awesome_print"
6
+ require_relative "../lib/agile_utils"
7
7
  include AgileUtils
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.1.1
4
+ version: 0.1.2
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-05-12 00:00:00.000000000 Z
11
+ date: 2014-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.19.1
19
+ version: '0.19'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.19.1
26
+ version: '0.19'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitar
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -203,7 +203,7 @@ extra_rdoc_files: []
203
203
  files:
204
204
  - ".gitignore"
205
205
  - ".rubocop.yml"
206
- - CHANGELOGS.md
206
+ - CHANGELOG.md
207
207
  - Gemfile
208
208
  - LICENSE
209
209
  - README.md
@@ -220,7 +220,6 @@ files:
220
220
  - lib/agile_utils/helper.rb
221
221
  - lib/agile_utils/logger.rb
222
222
  - lib/agile_utils/version.rb
223
- - rubocop-todo.yml
224
223
  - test/fixtures/inputs/demo1.xxx.rb
225
224
  - test/fixtures/inputs/demo2.xxx.rb
226
225
  - test/fixtures/outputs/demo1.xhtml
data/rubocop-todo.yml DELETED
@@ -1,50 +0,0 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-05-12 22:19:37 +1000 using RuboCop version 0.21.0.
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: 1
9
- CyclomaticComplexity:
10
- Max: 7
11
-
12
- # Offense count: 9
13
- Documentation:
14
- Enabled: false
15
-
16
- # Offense count: 4
17
- Eval:
18
- Enabled: false
19
-
20
- # Offense count: 10
21
- LineLength:
22
- Max: 112
23
-
24
- # Offense count: 3
25
- # Configuration parameters: CountComments.
26
- MethodLength:
27
- Max: 15
28
-
29
- # Offense count: 2
30
- # Configuration parameters: NamePrefixBlacklist.
31
- PredicateName:
32
- Enabled: false
33
-
34
- # Offense count: 1
35
- # Configuration parameters: MaxSlashes.
36
- RegexpLiteral:
37
- Enabled: false
38
-
39
- # Offense count: 1
40
- # Cop supports --auto-correct.
41
- RescueException:
42
- Enabled: false
43
-
44
- # Offense count: 2
45
- RescueModifier:
46
- Enabled: false
47
-
48
- # Offense count: 2
49
- UnusedBlockArgument:
50
- Enabled: false