index_html 0.1.2 → 0.1.3

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: f9fe1b61b2b205fb5a038dc97cbc381d133bfe78
4
- data.tar.gz: 2a99fd50389fe228666b1129d807bd279e3a2e30
3
+ metadata.gz: 0dc0506496e64e1987a946e2ca3007d086c6429c
4
+ data.tar.gz: 4f574f9ef646d37aad326e8d54645c1aa4bd18d5
5
5
  SHA512:
6
- metadata.gz: 0bfcb95a89184d513f8118005e053aec89d6c8045b66f7b0a719c3ca3271a3dda19d5580975c442bab58b499514e8740c27062032eee685162a8177faeaed235
7
- data.tar.gz: cbd9a3ec2bdaf0e2b091dac447564f90c39561d4889d57e8833253b0ffd4bb1d0586a4e082ae8d5f74e52557e42a8a9860744e446990216155e9cd0da5eba3f1
6
+ metadata.gz: 06ebabd731486b63c72af5d73f3dad7800aa5df06b9b599fec82e9c5366706f353efcf11657bb35342ef53c72b5e0f57be15fc5c72ba94dfaf07276b8fff9239
7
+ data.tar.gz: 6eeae24f691eb6b957dda0b08993dcce9b22d2be982288e2a7f69b1eb9ea3a3da6200a15097cd6a6c2e92969a7b322717c41fdb680258b59e719dad0cebf013f
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 generated files
20
19
  index.html
21
- rubocop-todo.yml
20
+ .ruby-version
data/.rubocop.yml CHANGED
@@ -1,10 +1,96 @@
1
- # This is the configuration used to check the rubocop source code.
2
1
  AllCops:
3
2
  Include:
4
- - '**/Rakefile'
5
- - '**/Gemfile'
6
- - lib/**/*
3
+ - Gemfile
4
+ - Rakefile
7
5
  - bin/*
8
- Exclude:
9
- - .rubocop.yml
10
- inherit_from: rubocop-todo.yml
6
+ - index_html.gemspec
7
+ - lib/**/*.rb
8
+ - spec/index_html/**/*.rb
9
+ - spec/spec_helper.rb
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
data/CHANGELOGS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ### Changelogs
2
2
 
3
+ #### 0.1.3
4
+
5
+ - Simplify the CLI usage
6
+ - Cleanup style with rubocop
7
+ - Add `coveralls` badges
8
+
3
9
  #### 0.1.2
4
10
 
5
11
  - First release based on the [Semantic Versioning][] convention.
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in file_indexer.gemspec
4
4
  gemspec
5
+
6
+ gem "coveralls", require: false
data/README.md CHANGED
@@ -3,10 +3,14 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/index_html.svg)][gem]
4
4
  [![Dependency Status](https://gemnasium.com/agilecreativity/index_html.png)][gemnasium]
5
5
  [![Code Climate](https://codeclimate.com/github/agilecreativity/index_html.png)][codeclimate]
6
+ [![Build Status](https://secure.travis-ci.org/agilecreativity/index_html.png)][travis-ci]
7
+ [![Coverage Status](https://coveralls.io/repos/agilecreativity/index_html/badge.png)][coveralls]
6
8
 
7
9
  [gem]: http://badge.fury.io/rb/index_html
8
10
  [gemnasium]: https://gemnasium.com/agilecreativity/index_html
9
11
  [codeclimate]: https://codeclimate.com/github/agilecreativity/index_html
12
+ [travis-ci]: http://travis-ci.org/agilecreativity/index_html
13
+ [coveralls]: https://coveralls.io/r/agilecreativity/index_html
10
14
 
11
15
  Quickly generate the index.html files based on your simple criteria.
12
16
 
@@ -37,10 +41,10 @@ that have the specific word 'Android' in the title you could perhap try somethin
37
41
  ```sh
38
42
  gem install index_html
39
43
  cd ~/Dropbox/ebooks/
40
- index_html generate --base-dir . \
41
- --exts epub pdf mobi \
42
- --inc-words android \
43
- --recursive
44
+ index_html --base-dir . \
45
+ --exts epub pdf mobi \
46
+ --inc-words android \
47
+ --recursive
44
48
  ```
45
49
 
46
50
  ### Help/Usage:
@@ -80,7 +84,7 @@ This will generate the file `index.html` that you can open from your favourite b
80
84
  - Sample list of files from a given directory
81
85
 
82
86
  ```shell
83
- $index_html generate --base-dir=spec/fixtures --exts=rb java --recursive
87
+ $index_html --base-dir=spec/fixtures --exts=rb java --recursive
84
88
  ```
85
89
  The output file `index.html` should be generated with something like
86
90
 
@@ -105,7 +109,7 @@ The output file `index.html` should be generated with something like
105
109
  - Run with simple prefix option
106
110
 
107
111
  ```shell
108
- index_html generate --base-dir spec/fixtures --exts rb java --recursive --prefix http://localhost
112
+ index_html --base-dir spec/fixtures --exts rb java --recursive --prefix http://localhost
109
113
  ```
110
114
 
111
115
  The output file `index.html` should be something like
data/Rakefile CHANGED
@@ -1,15 +1,25 @@
1
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
- require 'rspec/core/rake_task'
4
+ require "rspec/core/rake_task"
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
  task default: :spec
7
7
 
8
8
  task :pry do
9
- require 'pry'
10
- require 'awesome_print'
11
- require 'index_html'
9
+ require "pry"
10
+ require "awesome_print"
11
+ require "index_html"
12
12
  include IndexHtml
13
13
  ARGV.clear
14
14
  Pry.start
15
15
  end
16
+
17
+ require "rubocop/rake_task"
18
+ desc "Run RuboCop on the lib directory"
19
+ Rubocop::RakeTask.new(:rubocop) do |task|
20
+ task.patterns = ["lib/**/*.rb"]
21
+ # only show the files with failures
22
+ task.formatters = ["files"]
23
+ # don't abort rake on failure
24
+ task.fail_on_error = false
25
+ end
data/bin/index_html CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- require 'code_lister'
3
- require_relative '../lib/index_html'
2
+ require "code_lister"
3
+ require_relative "../lib/index_html"
4
4
  include IndexHtml
5
- IndexHtml::CLI.start(ARGV)
5
+ if ARGV.empty?
6
+ IndexHtml::CLI.start(%w[usage])
7
+ else
8
+ IndexHtml::CLI.start(%w[generate].concat(ARGV))
9
+ end
data/index_html.gemspec CHANGED
@@ -1,38 +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 'index_html/version'
4
+ require "index_html/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = 'index_html'
7
+ spec.name = "index_html"
8
8
  spec.version = IndexHtml::VERSION
9
- spec.authors = ['Burin Choomnuan']
10
- spec.email = ['agilecreativity@gmail.com']
11
- spec.description = %q{Generate the index.html from list of files}
12
- spec.summary = %q{Generate simple index.html from list of files based on simple criteria}
13
- spec.homepage = 'https://github.com/agilecreativity/index_html'
14
- spec.license = 'MIT'
15
- spec.files = Dir.glob('{bin,lib}/**/*') + %w(Gemfile
9
+ spec.authors = ["Burin Choomnuan"]
10
+ spec.email = ["agilecreativity@gmail.com"]
11
+ spec.description = %q(Generate the index.html from list of files)
12
+ spec.summary = %q(Generate simple index.html from list of files based on simple criteria)
13
+ spec.homepage = "https://github.com/agilecreativity/index_html"
14
+ spec.license = "MIT"
15
+ spec.files = Dir.glob("{bin,lib}/**/*") + %w[Gemfile
16
16
  Rakefile
17
17
  index_html.gemspec
18
18
  README.md
19
19
  CHANGELOGS.md
20
20
  LICENSE
21
21
  .rubocop.yml
22
- .gitignore
23
- rubocop-todo.yml)
22
+ .gitignore]
24
23
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
25
24
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
26
- spec.require_paths = ['lib']
27
- spec.add_runtime_dependency 'thor', '~> 0.19'
28
- spec.add_runtime_dependency 'agile_utils', '~> 0.1'
29
- spec.add_runtime_dependency 'code_lister', '~> 0.1'
30
- spec.add_development_dependency 'awesome_print', '~> 1.2'
31
- spec.add_development_dependency 'bundler', '~> 1.3'
32
- spec.add_development_dependency 'fuubar', '~> 1.3'
33
- spec.add_development_dependency 'guard-rspec', '~> 4.2'
34
- spec.add_development_dependency 'pry', '~> 0.9'
35
- spec.add_development_dependency 'rake', '~> 10.3'
36
- spec.add_development_dependency 'rspec', '~> 2.14'
37
- spec.add_development_dependency 'rubocop', '~> 0.20'
25
+ spec.require_paths = ["lib"]
26
+ spec.add_runtime_dependency "thor", "~> 0.19"
27
+ spec.add_runtime_dependency "agile_utils", "~> 0.1"
28
+ spec.add_runtime_dependency "code_lister", "~> 0.1"
29
+ spec.add_development_dependency "awesome_print", "~> 1.2"
30
+ spec.add_development_dependency "bundler", "~> 1.3"
31
+ spec.add_development_dependency "fuubar", "~> 1.3"
32
+ spec.add_development_dependency "guard-rspec", "~> 4.2"
33
+ spec.add_development_dependency "pry", "~> 0.9"
34
+ spec.add_development_dependency "rake", "~> 10.3"
35
+ spec.add_development_dependency "rspec", "~> 2.14"
36
+ spec.add_development_dependency "rubocop", "~> 0.20"
37
+ spec.add_development_dependency "coveralls", "~> 0.7"
38
38
  end
@@ -1,10 +1,10 @@
1
- require 'thor'
2
- require 'agile_utils'
3
- require_relative '../index_html'
4
-
1
+ require "thor"
2
+ require "agile_utils"
3
+ require_relative "../index_html"
5
4
  module IndexHtml
6
5
  class CLI < Thor
7
- desc 'generate', 'Generate the index.html base on simple criteria'
6
+ # rubocop:disable AmbiguousOperator, LineLength
7
+ desc "generate", "Generate the index.html base on simple criteria"
8
8
  # Common shared options
9
9
  method_option *AgileUtils::Options::BASE_DIR
10
10
  method_option *AgileUtils::Options::EXTS
@@ -17,19 +17,19 @@ module IndexHtml
17
17
 
18
18
  # specific to this action only
19
19
  method_option :prefix,
20
- aliases: '-p',
21
- desc: 'Prefix string to the URL',
22
- default: '.'
20
+ aliases: "-p",
21
+ desc: "Prefix string to the URL",
22
+ default: "."
23
23
  method_option :indent,
24
- aliases: '-d',
25
- desc: 'Indentation to each list item in the output',
24
+ aliases: "-d",
25
+ desc: "Indentation to each list item in the output",
26
26
  type: :numeric,
27
27
  default: 6
28
28
  method_option :output,
29
- aliases: '-o',
30
- desc: 'Output file name',
29
+ aliases: "-o",
30
+ desc: "Output file name",
31
31
  type: :string,
32
- default: 'index.html'
32
+ default: "index.html"
33
33
  def generate
34
34
  opts = options.symbolize_keys
35
35
  if opts[:version]
@@ -39,11 +39,11 @@ module IndexHtml
39
39
  run(opts)
40
40
  end
41
41
 
42
- desc 'usage', 'Display help screen'
42
+ desc "usage", "Display help screen"
43
43
  def usage
44
44
  puts <<-EOS
45
45
  Usage:
46
- index_html generate
46
+ index_html
47
47
 
48
48
  Options:
49
49
  -b, [--base-dir=BASE_DIR] # Base directory
@@ -67,10 +67,11 @@ Options:
67
67
  Generate the index.html base on simple criteria
68
68
  EOS
69
69
  end
70
+ # rubocop:enable AmbiguousOperator, LineLength
70
71
 
71
72
  default_task :usage
72
73
 
73
- private
74
+ private
74
75
 
75
76
  def run(options = {})
76
77
  files = CodeLister.files options || []
@@ -1,3 +1,3 @@
1
1
  module IndexHtml
2
- VERSION = '0.1.2'
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/index_html.rb CHANGED
@@ -1,13 +1,13 @@
1
- require 'uri'
2
- require 'code_lister'
3
- require_relative './index_html/version'
4
- require_relative './index_html/cli'
1
+ require "uri"
2
+ require "code_lister"
3
+ require_relative "./index_html/version"
4
+ require_relative "./index_html/cli"
5
5
  module IndexHtml
6
6
  CustomError = Class.new(StandardError)
7
7
  class << self
8
8
  # Create html links to list of files
9
9
  def htmlify(file_list, args = {})
10
- header = <<-END.gsub(/^\s+\|/, '')
10
+ header = <<-END.gsub(/^\s+\|/, "")
11
11
  |<html>
12
12
  |<title>File Listing</title>
13
13
  |<header>File List</header>
@@ -15,20 +15,20 @@ module IndexHtml
15
15
  | <ol>
16
16
  END
17
17
 
18
- footer = <<-END.gsub(/^\s+\|/, '')
18
+ footer = <<-END.gsub(/^\s+\|/, "")
19
19
  | </ol>
20
20
  | </body>
21
21
  |</html>
22
22
  END
23
23
 
24
- prefix = args.fetch(:prefix, '.')
24
+ prefix = args.fetch(:prefix, ".")
25
25
  indent = args.fetch(:indent, 6)
26
- output = args.fetch(:output, 'index.html')
26
+ output = args.fetch(:output, "index.html")
27
27
 
28
- File.open(output, 'w') do |f|
28
+ File.open(output, "w") do |f|
29
29
  f.write(header)
30
30
  links = make_links file_list, prefix: prefix, base_dir: args[:base_dir]
31
- links.each { |i| f.write("#{' ' * indent}#{i}\n") }
31
+ links.each { |i| f.write("#{" " * indent}#{i}\n") }
32
32
  f.write(footer)
33
33
  end
34
34
  end
@@ -58,15 +58,15 @@ module IndexHtml
58
58
  #
59
59
  # @return [Array<String>] the list of valid <li> tags
60
60
  def make_links(file_list, args)
61
- prefix = args.fetch(:prefix, '.')
61
+ prefix = args.fetch(:prefix, ".")
62
62
  result = []
63
63
 
64
64
  file_list.each do |i|
65
- path = File.absolute_path(i).gsub(Dir.pwd, '')
65
+ path = File.absolute_path(i).gsub(Dir.pwd, "")
66
66
  if prefix
67
67
  link = %Q(<li><a href="#{prefix}#{path}" target='_blank'>#{prefix}#{path}</li>)
68
68
  else
69
- link = %Q(<li><a href=".#{path}" target='_blank'>#{path.gsub(/^\//, '')}</li>)
69
+ link = %Q(<li><a href=".#{path}" target='_blank'>#{path.gsub(/^\//, "")}</li>)
70
70
  end
71
71
  result << link
72
72
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: index_html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
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-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.20'
167
+ - !ruby/object:Gem::Dependency
168
+ name: coveralls
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.7'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.7'
167
181
  description: Generate the index.html from list of files
168
182
  email:
169
183
  - agilecreativity@gmail.com
@@ -184,7 +198,6 @@ files:
184
198
  - lib/index_html.rb
185
199
  - lib/index_html/cli.rb
186
200
  - lib/index_html/version.rb
187
- - rubocop-todo.yml
188
201
  homepage: https://github.com/agilecreativity/index_html
189
202
  licenses:
190
203
  - MIT
data/rubocop-todo.yml DELETED
@@ -1,67 +0,0 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-05-09 23:59:42 +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: 8
9
- AmbiguousOperator:
10
- Enabled: false
11
-
12
- # Offense count: 1
13
- # Cop supports --auto-correct.
14
- Blocks:
15
- Enabled: true
16
-
17
- # Offense count: 3
18
- Documentation:
19
- Enabled: false
20
-
21
- # Offense count: 1
22
- # Cop supports --auto-correct.
23
- EmptyLinesAroundBody:
24
- Enabled: true
25
-
26
- # Offense count: 1
27
- # Cop supports --auto-correct.
28
- # Configuration parameters: EnforcedStyle, SupportedStyles.
29
- HashSyntax:
30
- Enabled: true
31
-
32
- # Offense count: 2
33
- # Cop supports --auto-correct.
34
- LeadingCommentSpace:
35
- Enabled: true
36
-
37
- # Offense count: 40
38
- LineLength:
39
- Max: 182
40
-
41
- # Offense count: 3
42
- # Configuration parameters: CountComments.
43
- MethodLength:
44
- Max: 21
45
-
46
- # Offense count: 2
47
- # Cop supports --auto-correct.
48
- # Configuration parameters: PreferredDelimiters.
49
- PercentLiteralDelimiters:
50
- Enabled: true
51
-
52
- # Offense count: 1
53
- # Cop supports --auto-correct.
54
- SpaceAfterComma:
55
- Enabled: true
56
-
57
- # Offense count: 2
58
- # Cop supports --auto-correct.
59
- # Configuration parameters: EnforcedStyle, SupportedStyles.
60
- SpaceBeforeBlockBraces:
61
- Enabled: true
62
-
63
- # Offense count: 6
64
- # Cop supports --auto-correct.
65
- # Configuration parameters: EnforcedStyle, SupportedStyles.
66
- StringLiterals:
67
- Enabled: true