hexx-domains 0.0.1
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 +7 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +9 -0
- data/.metrics +5 -0
- data/.rspec +2 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +7 -0
- data/.yardopts +3 -0
- data/Gemfile +5 -0
- data/Guardfile +15 -0
- data/LICENSE +21 -0
- data/README.md +82 -0
- data/Rakefile +22 -0
- data/config/metrics/STYLEGUIDE +230 -0
- data/config/metrics/cane.yml +5 -0
- data/config/metrics/churn.yml +6 -0
- data/config/metrics/flay.yml +2 -0
- data/config/metrics/metric_fu.yml +15 -0
- data/config/metrics/reek.yml +1 -0
- data/config/metrics/roodi.yml +24 -0
- data/config/metrics/rubocop.yml +73 -0
- data/config/metrics/saikuro.yml +3 -0
- data/config/metrics/simplecov.yml +8 -0
- data/config/metrics/yardstick.yml +37 -0
- data/hexx-domains.gemspec +25 -0
- data/lib/hexx-domains.rb +13 -0
- data/lib/hexx/domains.rb +12 -0
- data/lib/hexx/domains/cli.rb +183 -0
- data/lib/hexx/domains/cli/gemspec.erb +23 -0
- data/lib/hexx/domains/cli/lib.erb +23 -0
- data/lib/hexx/domains/cli/module.erb +16 -0
- data/lib/hexx/domains/cli/root/LICENSE.erb +21 -0
- data/lib/hexx/domains/cli/root/README.md.erb +64 -0
- data/lib/hexx/domains/cli/root/_.coveralls.yml +2 -0
- data/lib/hexx/domains/cli/root/_.gitignore +9 -0
- data/lib/hexx/domains/cli/root/_.travis.yml.erb +8 -0
- data/lib/hexx/domains/cli/version.erb +19 -0
- data/lib/hexx/domains/version.rb +13 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/tests/cli_spec.rb +251 -0
- metadata +135 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
folders: # The list of folders to be used by any metric.
|
3
|
+
- lib
|
4
|
+
- app
|
5
|
+
metrics: # The list of allowed metrics. The other metrics are disabled.
|
6
|
+
- cane
|
7
|
+
- churn
|
8
|
+
- flay
|
9
|
+
- flog
|
10
|
+
- reek
|
11
|
+
- roodi
|
12
|
+
- saikuro
|
13
|
+
format: html
|
14
|
+
output: tmp/metric_fu
|
15
|
+
verbose: false
|
@@ -0,0 +1 @@
|
|
1
|
+
---
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
AssignmentInConditionalCheck:
|
3
|
+
CaseMissingElseCheck:
|
4
|
+
ClassLineCountCheck:
|
5
|
+
line_count: 300
|
6
|
+
ClassNameCheck:
|
7
|
+
pattern: !ruby/regexp /^[A-Z][a-zA-Z0-9]*$/
|
8
|
+
ClassVariableCheck:
|
9
|
+
CyclomaticComplexityBlockCheck:
|
10
|
+
complexity: 4
|
11
|
+
CyclomaticComplexityMethodCheck:
|
12
|
+
complexity: 8
|
13
|
+
EmptyRescueBodyCheck:
|
14
|
+
ForLoopCheck:
|
15
|
+
MethodLineCountCheck:
|
16
|
+
line_count: 20
|
17
|
+
MethodNameCheck:
|
18
|
+
pattern: !ruby/regexp /^[\||\^|\&|\!]$|^[_a-z<>=\[|+-\/\*`]+[_a-z0-9_<>=~@\[\]]*[=!\?]?$/
|
19
|
+
ModuleLineCountCheck:
|
20
|
+
line_count: 300
|
21
|
+
ModuleNameCheck:
|
22
|
+
pattern: !ruby/regexp /^[A-Z][a-zA-Z0-9]*$/
|
23
|
+
ParameterNumberCheck:
|
24
|
+
parameter_count: 5
|
@@ -0,0 +1,73 @@
|
|
1
|
+
---
|
2
|
+
# settings added by the 'hexx-suit' module
|
3
|
+
# output: "tmp/rubocop"
|
4
|
+
# format: "html"
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
Exclude:
|
8
|
+
- '**/db/schema.rb'
|
9
|
+
|
10
|
+
Lint/HandleExceptions:
|
11
|
+
Exclude:
|
12
|
+
- '**/*_spec.rb'
|
13
|
+
|
14
|
+
Lint/RescueException:
|
15
|
+
Exclude:
|
16
|
+
- '**/*_spec.rb'
|
17
|
+
|
18
|
+
Style/AccessorMethodName:
|
19
|
+
Exclude:
|
20
|
+
- '**/*_spec.rb'
|
21
|
+
|
22
|
+
Style/AsciiComments:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/ClassAndModuleChildren:
|
26
|
+
Exclude:
|
27
|
+
- '**/*_spec.rb'
|
28
|
+
|
29
|
+
Style/Documentation:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/EmptyLinesAroundBlockBody:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Style/EmptyLinesAroundClassBody:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Style/EmptyLinesAroundMethodBody:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Style/EmptyLinesAroundModuleBody:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/EmptyLineBetweenDefs:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Style/FileName:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Style/RaiseArgs:
|
51
|
+
EnforcedStyle: compact
|
52
|
+
|
53
|
+
Style/SingleLineMethods:
|
54
|
+
Exclude:
|
55
|
+
- '**/*_spec.rb'
|
56
|
+
|
57
|
+
Style/SingleSpaceBeforeFirstArg:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/SpecialGlobalVars:
|
61
|
+
Exclude:
|
62
|
+
- '**/Gemfile'
|
63
|
+
- '**/*.gemspec'
|
64
|
+
|
65
|
+
Style/StringLiterals:
|
66
|
+
EnforcedStyle: double_quotes
|
67
|
+
|
68
|
+
Style/StringLiteralsInInterpolation:
|
69
|
+
EnforcedStyle: double_quotes
|
70
|
+
|
71
|
+
Style/TrivialAccessors:
|
72
|
+
Exclude:
|
73
|
+
- '**/*_spec.rb'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
# Settings added by the 'hexx-suit' gem
|
3
|
+
output: "tmp/yardstick/output.log"
|
4
|
+
path: "lib/**/*.rb"
|
5
|
+
rules:
|
6
|
+
ApiTag::Presence:
|
7
|
+
enabled: true
|
8
|
+
exclude: []
|
9
|
+
ApiTag::Inclusion:
|
10
|
+
enabled: true
|
11
|
+
exclude: []
|
12
|
+
ApiTag::ProtectedMethod:
|
13
|
+
enabled: true
|
14
|
+
exclude: []
|
15
|
+
ApiTag::PrivateMethod:
|
16
|
+
enabled: false
|
17
|
+
exclude: []
|
18
|
+
ExampleTag:
|
19
|
+
enabled: true
|
20
|
+
exclude: []
|
21
|
+
ReturnTag:
|
22
|
+
enabled: true
|
23
|
+
exclude: []
|
24
|
+
Summary::Presence:
|
25
|
+
enabled: true
|
26
|
+
exclude: []
|
27
|
+
Summary::Length:
|
28
|
+
enabled: true
|
29
|
+
exclude: []
|
30
|
+
Summary::Delimiter:
|
31
|
+
enabled: true
|
32
|
+
exclude: []
|
33
|
+
Summary::SingleLine:
|
34
|
+
enabled: true
|
35
|
+
exclude: []
|
36
|
+
threshold: 100
|
37
|
+
verbose: false
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "hexx/domains/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
|
6
|
+
gem.name = "hexx-domains"
|
7
|
+
gem.version = Hexx::Domains::VERSION.dup
|
8
|
+
gem.author = "Andrew Kozin"
|
9
|
+
gem.email = "andrew.kozin@gmail.com"
|
10
|
+
gem.homepage = "https://github.com/nepalez/hexx-domains"
|
11
|
+
gem.summary = "Domain model scaffolder."
|
12
|
+
gem.description = "Scaffolds the domain model as a separate gem."
|
13
|
+
gem.license = "MIT"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
16
|
+
gem.test_files = Dir["spec/**/*.rb"]
|
17
|
+
gem.extra_rdoc_files = Dir["README.md", "LICENSE"]
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.required_ruby_version = "~> 2.0"
|
21
|
+
gem.add_runtime_dependency "hexx-cli", "~> 0.0"
|
22
|
+
gem.add_runtime_dependency "hexx-dependencies", "~> 0.0", ">= 0.0.3"
|
23
|
+
gem.add_runtime_dependency "hexx-suit", "~> 2.1"
|
24
|
+
|
25
|
+
end # Gem::Specification
|
data/lib/hexx-domains.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "hexx-cli"
|
4
|
+
require "hexx-suit"
|
5
|
+
require "hexx-dependencies"
|
6
|
+
|
7
|
+
# The shared namespace for hexx-based modules
|
8
|
+
module Hexx
|
9
|
+
|
10
|
+
require_relative "hexx/domains/version"
|
11
|
+
require_relative "hexx/domains"
|
12
|
+
|
13
|
+
end # module Hexx
|
data/lib/hexx/domains.rb
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Hexx
|
4
|
+
|
5
|
+
module Domains
|
6
|
+
|
7
|
+
# Scaffolder of new domain model as a separate gem
|
8
|
+
class CLI < Hexx::CLI::Base
|
9
|
+
|
10
|
+
# @private
|
11
|
+
def self.source_root
|
12
|
+
::File.expand_path "../cli", __FILE__
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Scaffolds a domain model."
|
16
|
+
namespace :domain
|
17
|
+
|
18
|
+
argument(
|
19
|
+
:name,
|
20
|
+
banner: "NAME",
|
21
|
+
desc: "The name of the module",
|
22
|
+
required: true,
|
23
|
+
type: :string
|
24
|
+
)
|
25
|
+
|
26
|
+
class_option(
|
27
|
+
:author,
|
28
|
+
aliases: "-a",
|
29
|
+
banner: "Name Family",
|
30
|
+
desc: "The name of the author",
|
31
|
+
default: [],
|
32
|
+
type: :array
|
33
|
+
)
|
34
|
+
|
35
|
+
class_option(
|
36
|
+
:username,
|
37
|
+
aliases: "-u",
|
38
|
+
banner: "username",
|
39
|
+
desc: "The username of the author on Github",
|
40
|
+
type: :string
|
41
|
+
)
|
42
|
+
|
43
|
+
class_option(
|
44
|
+
:email,
|
45
|
+
aliases: "-e",
|
46
|
+
banner: "email",
|
47
|
+
desc: "The email of the author on Github",
|
48
|
+
type: :string
|
49
|
+
)
|
50
|
+
|
51
|
+
class_option(
|
52
|
+
:ruby,
|
53
|
+
aliases: "-r",
|
54
|
+
banner: "2.1",
|
55
|
+
desc: "The ruby API to support: 1.9, 2.0, 2.1",
|
56
|
+
default: "2.1",
|
57
|
+
type: :string
|
58
|
+
)
|
59
|
+
|
60
|
+
class_option(
|
61
|
+
:dummy,
|
62
|
+
aliases: "-d",
|
63
|
+
desc: "Use a dummy app",
|
64
|
+
default: false,
|
65
|
+
type: :boolean
|
66
|
+
)
|
67
|
+
|
68
|
+
class_option(
|
69
|
+
:git,
|
70
|
+
aliases: "-g",
|
71
|
+
desc: "Initialize new git repository",
|
72
|
+
default: false,
|
73
|
+
type: :boolean
|
74
|
+
)
|
75
|
+
|
76
|
+
class_option(
|
77
|
+
:bundle,
|
78
|
+
aliases: "-b",
|
79
|
+
desc: "Run bundler",
|
80
|
+
default: false,
|
81
|
+
type: :boolean
|
82
|
+
)
|
83
|
+
|
84
|
+
# @private
|
85
|
+
def populate_core_files
|
86
|
+
copy_folder "root", project.file
|
87
|
+
self.destination_root = "#{ destination_root }/#{ project.file }"
|
88
|
+
end
|
89
|
+
|
90
|
+
# @private
|
91
|
+
def add_gemspec
|
92
|
+
template "gemspec.erb", "#{ project.file }.gemspec"
|
93
|
+
end
|
94
|
+
|
95
|
+
# @private
|
96
|
+
def add_version
|
97
|
+
template "version.erb", "lib/#{ project.path }/version.rb"
|
98
|
+
end
|
99
|
+
|
100
|
+
# @private
|
101
|
+
def add_loader
|
102
|
+
template "lib.erb", "lib/#{ project.file }.rb"
|
103
|
+
end
|
104
|
+
|
105
|
+
# @private
|
106
|
+
def add_module
|
107
|
+
return unless project.namespaces.any?
|
108
|
+
template "module.erb", "lib/#{ project.path }.rb"
|
109
|
+
end
|
110
|
+
|
111
|
+
# @private
|
112
|
+
def add_suit
|
113
|
+
in_root { `hexx-suit install` }
|
114
|
+
empty_directory "spec/tests"
|
115
|
+
end
|
116
|
+
|
117
|
+
# @private
|
118
|
+
def add_dummy
|
119
|
+
return unless options["dummy"]
|
120
|
+
in_root { Hexx::Dependencies::CLI.start %w() }
|
121
|
+
end
|
122
|
+
|
123
|
+
# @private
|
124
|
+
def add_git_repository
|
125
|
+
return unless options["git"]
|
126
|
+
in_root { `git init` }
|
127
|
+
end
|
128
|
+
|
129
|
+
# @private
|
130
|
+
def run_bundler
|
131
|
+
return unless options["bundle"]
|
132
|
+
in_root { `bundle` }
|
133
|
+
end
|
134
|
+
|
135
|
+
private
|
136
|
+
|
137
|
+
def year
|
138
|
+
@year ||= Time.now.strftime("%Y")
|
139
|
+
end
|
140
|
+
|
141
|
+
def project
|
142
|
+
@project ||= Hexx::CLI::Name.new name
|
143
|
+
end
|
144
|
+
|
145
|
+
def author
|
146
|
+
@author ||= begin
|
147
|
+
value = options["author"]
|
148
|
+
value.any? ? value.map(&:capitalize).join(" ") : "@todo: author"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def user
|
153
|
+
@user ||= (options["username"] || "@todo: username").downcase
|
154
|
+
end
|
155
|
+
|
156
|
+
def email
|
157
|
+
@email ||= (options["email"] || "@todo: email").downcase
|
158
|
+
end
|
159
|
+
|
160
|
+
def ruby
|
161
|
+
@ruby ||= begin
|
162
|
+
value = options["ruby"].split(".")[0..1].join(".")
|
163
|
+
%w(1.9 2.0 2.1).include?(value) ? value : "2.1"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def rubies
|
168
|
+
{
|
169
|
+
"1.9" => [
|
170
|
+
"1.9.3", "ruby-head",
|
171
|
+
"rbx-2 --1.9", "rbx-2 --2.0",
|
172
|
+
"jruby-1.7-19mode", "jruby-head-21mode"
|
173
|
+
],
|
174
|
+
"2.0" => ["2.0", "ruby-head", "rbx-2 --2.0", "jruby-head-20mode"],
|
175
|
+
"2.1" => ["2.1", "ruby-head", "rbx-2 --2.0", "jruby-head-21mode"]
|
176
|
+
}[ruby]
|
177
|
+
end
|
178
|
+
|
179
|
+
end # module Hexx
|
180
|
+
|
181
|
+
end # module Domains
|
182
|
+
|
183
|
+
end # class CLI
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "<%= project.path %>/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
|
6
|
+
gem.name = "<%= project.file %>"
|
7
|
+
gem.version = <%= project.type %>::VERSION.dup
|
8
|
+
gem.author = "<%= author %>"
|
9
|
+
gem.email = "<%= email %>"
|
10
|
+
gem.homepage = "https://github.com/<%= user %>/<%= project.file %>"
|
11
|
+
gem.summary = "@todo"
|
12
|
+
gem.description = "@todo"
|
13
|
+
gem.license = "MIT"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
16
|
+
gem.test_files = Dir["spec/**/*.rb"]
|
17
|
+
gem.extra_rdoc_files = Dir["README.md", "LICENSE"]
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.required_ruby_version = "~> <%= ruby %>"
|
21
|
+
gem.add_development_dependency "hexx-rspec"
|
22
|
+
|
23
|
+
end # Gem::Specification
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
<% tabs = 0 -%>
|
3
|
+
<% project.namespaces.each do |item| -%>
|
4
|
+
|
5
|
+
<%= " " * tabs %># @todo
|
6
|
+
<%= " " * tabs %>module <%= item %>
|
7
|
+
<% tabs += 1 -%>
|
8
|
+
<% end -%>
|
9
|
+
|
10
|
+
<%= " " * tabs %>require_relative "<%= project.path %>/version"
|
11
|
+
<% if project.namespaces.any? -%>
|
12
|
+
<%= " " * tabs %>require_relative "<%= project.path %>"
|
13
|
+
<% else -%>
|
14
|
+
|
15
|
+
<%= " " * tabs %># Namespace for the code of the '<%= project.file %>' gem
|
16
|
+
<%= " " * tabs %>module <%= project.const %>
|
17
|
+
|
18
|
+
<%= " " * tabs %>end # module <%= project.const %>
|
19
|
+
<% end -%>
|
20
|
+
<% project.namespaces.reverse.each do |item| -%>
|
21
|
+
<% tabs -= 1 %>
|
22
|
+
<%= " " * tabs %>end # module <%= item %>
|
23
|
+
<% end -%>
|