toys 0.3.7.1 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +19 -22
- data/builtins/system.rb +1 -1
- data/docs/guide.md +830 -105
- data/lib/toys.rb +5 -0
- data/lib/toys/standard_cli.rb +6 -1
- data/lib/toys/templates/clean.rb +85 -0
- data/lib/toys/templates/gem_build.rb +125 -0
- data/lib/toys/templates/minitest.rb +125 -0
- data/lib/toys/templates/rubocop.rb +86 -0
- data/lib/toys/templates/yardoc.rb +101 -0
- data/lib/toys/version.rb +1 -1
- metadata +9 -4
@@ -0,0 +1,101 @@
|
|
1
|
+
# Copyright 2018 Daniel Azuma
|
2
|
+
#
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer.
|
10
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
14
|
+
# contributors to this software, may be used to endorse or promote products
|
15
|
+
# derived from this software without specific prior written permission.
|
16
|
+
#
|
17
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
18
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
20
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
21
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
22
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
;
|
29
|
+
|
30
|
+
module Toys
|
31
|
+
module Templates
|
32
|
+
##
|
33
|
+
# A template for tools that run yardoc
|
34
|
+
#
|
35
|
+
class Yardoc
|
36
|
+
include Template
|
37
|
+
|
38
|
+
##
|
39
|
+
# Default tool name
|
40
|
+
# @return [String]
|
41
|
+
#
|
42
|
+
DEFAULT_TOOL_NAME = "yardoc".freeze
|
43
|
+
|
44
|
+
##
|
45
|
+
# Create the template settings for the Yardoc template.
|
46
|
+
#
|
47
|
+
# @param [String] name Name of the tool to create. Defaults to
|
48
|
+
# {DEFAULT_TOOL_NAME}.
|
49
|
+
# @param [Array<String>] files An array of globs indicating the files
|
50
|
+
# to document.
|
51
|
+
# @param [Array<String>] options Additional options passed to YARD
|
52
|
+
# @param [Array<String>] stats_options Additional options passed to YARD
|
53
|
+
# stats
|
54
|
+
#
|
55
|
+
def initialize(name: DEFAULT_TOOL_NAME,
|
56
|
+
files: [],
|
57
|
+
options: [],
|
58
|
+
stats_options: [])
|
59
|
+
@name = name
|
60
|
+
@files = files
|
61
|
+
@options = options
|
62
|
+
@stats_options = stats_options
|
63
|
+
end
|
64
|
+
|
65
|
+
attr_accessor :name
|
66
|
+
attr_accessor :files
|
67
|
+
attr_accessor :options
|
68
|
+
attr_accessor :stats_options
|
69
|
+
|
70
|
+
to_expand do |template|
|
71
|
+
tool(template.name) do
|
72
|
+
desc "Run yardoc on the current project."
|
73
|
+
|
74
|
+
include :exec
|
75
|
+
|
76
|
+
run do
|
77
|
+
require "yard"
|
78
|
+
files = []
|
79
|
+
patterns = Array(template.files)
|
80
|
+
patterns = ["lib/**/*.rb"] if patterns.empty?
|
81
|
+
patterns.each do |pattern|
|
82
|
+
files.concat(::Dir.glob(pattern))
|
83
|
+
end
|
84
|
+
files.uniq!
|
85
|
+
|
86
|
+
unless template.stats_options.empty?
|
87
|
+
template.options << "--no-stats"
|
88
|
+
template.stats_options << "--use-cache"
|
89
|
+
end
|
90
|
+
|
91
|
+
yardoc = ::YARD::CLI::Yardoc.new
|
92
|
+
yardoc.run(*(template.options + files))
|
93
|
+
unless template.stats_options.empty?
|
94
|
+
::YARD::CLI::Stats.run(*template.stats_options)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
data/lib/toys/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toys-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.3.
|
19
|
+
version: 0.3.8
|
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.3.
|
26
|
+
version: 0.3.8
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,6 +117,11 @@ files:
|
|
117
117
|
- docs/tutorial.md
|
118
118
|
- lib/toys.rb
|
119
119
|
- lib/toys/standard_cli.rb
|
120
|
+
- lib/toys/templates/clean.rb
|
121
|
+
- lib/toys/templates/gem_build.rb
|
122
|
+
- lib/toys/templates/minitest.rb
|
123
|
+
- lib/toys/templates/rubocop.rb
|
124
|
+
- lib/toys/templates/yardoc.rb
|
120
125
|
- lib/toys/version.rb
|
121
126
|
homepage: https://github.com/dazuma/toys
|
122
127
|
licenses:
|