amber_extension_generator 0.0.5

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.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +185 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.solargraph.yml +20 -0
  6. data/CHANGELOG.md +5 -0
  7. data/Gemfile +20 -0
  8. data/Gemfile.lock +116 -0
  9. data/LICENSE +21 -0
  10. data/README.md +37 -0
  11. data/Rakefile +16 -0
  12. data/amber_extension_generator.gemspec +46 -0
  13. data/exe/amber_extension_generator +6 -0
  14. data/lib/amber_extension_generator/cli/args.rb +47 -0
  15. data/lib/amber_extension_generator/cli/gem_generator.rb +406 -0
  16. data/lib/amber_extension_generator/cli.rb +17 -0
  17. data/lib/amber_extension_generator/gem_name.rb +6 -0
  18. data/lib/amber_extension_generator/templates/assets/stylesheets/components.scss +2 -0
  19. data/lib/amber_extension_generator/templates/assets/stylesheets/main.scss.erb +6 -0
  20. data/lib/amber_extension_generator/templates/bin/dev.erb +10 -0
  21. data/lib/amber_extension_generator/templates/bin/generate.erb +142 -0
  22. data/lib/amber_extension_generator/templates/components/base_component.rb.erb +11 -0
  23. data/lib/amber_extension_generator/templates/components.rb +4 -0
  24. data/lib/amber_extension_generator/templates/rails_dummy/Gemfile.erb +33 -0
  25. data/lib/amber_extension_generator/templates/railtie.rb.erb +13 -0
  26. data/lib/amber_extension_generator/templates/templates/component.rb.tt +11 -0
  27. data/lib/amber_extension_generator/templates/templates/component_test.rb.tt +17 -0
  28. data/lib/amber_extension_generator/templates/templates/style.scss.tt +5 -0
  29. data/lib/amber_extension_generator/templates/templates/view.html.erb.tt +8 -0
  30. data/lib/amber_extension_generator/templates/test/component_test_case.rb +7 -0
  31. data/lib/amber_extension_generator/version.rb +6 -0
  32. data/lib/amber_extension_generator.rb +16 -0
  33. data/lib/dummy_rails_app_template.rb +61 -0
  34. metadata +127 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 15d10a8130c52094e66843a00bc9bc2ab9fe4b4fc4334dbe1f35fc570a0e4484
4
+ data.tar.gz: df2207bfb0b12c9bdfe53f8434f088cf63f288050d06f75909a38e76a52e16d1
5
+ SHA512:
6
+ metadata.gz: 356f150dc0790a08e3bb60c5a457b5ff4775eec9aa1ca4a785371e1278a533b997089652eff5f1fb9c95f73a144e76df7b6ce30f481bb466b7871375084b8ee5
7
+ data.tar.gz: 75d0869b3f22559ad2ba18bb5bef438f1dcb98694816c0dcb824c15b98e5686f7b3b9e220b625ebd35343be75c5f56eda427bd86f1d095a69e774f9421832584
data/.rubocop.yml ADDED
@@ -0,0 +1,185 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.7
3
+ SuggestExtensions: false
4
+ EnabledByDefault: true
5
+ Exclude:
6
+ - 'bin/*'
7
+ - 'vendor/bundle/**/*'
8
+ - 'spec/**/*'
9
+ - 'test/**/*'
10
+ - 'dummy-app/**/*'
11
+
12
+ Style/ClassMethodsDefinitions:
13
+ EnforcedStyle: self_class
14
+
15
+ Style/StringLiterals:
16
+ Enabled: false
17
+
18
+ Layout/RedundantLineBreak:
19
+ Enabled: false
20
+
21
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
22
+ Enabled: false
23
+
24
+ Layout/EmptyLinesAroundBlockBody:
25
+ Enabled: false
26
+
27
+ Layout/EmptyLines:
28
+ Enabled: false
29
+
30
+ Layout/EmptyLinesAroundClassBody:
31
+ Enabled: false
32
+
33
+ Layout/EmptyLinesAroundModuleBody:
34
+ Enabled: false
35
+
36
+ Layout/HashAlignment:
37
+ Enabled: false
38
+
39
+ Metrics/AbcSize:
40
+ Enabled: false
41
+
42
+ Metrics/MethodLength:
43
+ Max: 30
44
+
45
+ Metrics/ClassLength:
46
+ Max: 200
47
+
48
+ Metrics/CyclomaticComplexity:
49
+ Max: 12
50
+
51
+ Style/Alias:
52
+ Enabled: false
53
+
54
+ Style/DisableCopsWithinSourceCodeDirective:
55
+ Enabled: false
56
+
57
+ Layout/ExtraSpacing:
58
+ Enabled: false
59
+
60
+ Layout/SingleLineBlockChain:
61
+ Enabled: false
62
+
63
+ Metrics/PerceivedComplexity:
64
+ Max: 12
65
+
66
+ Layout/ClassStructure:
67
+ Enabled: false
68
+
69
+ Style/OpenStructUse:
70
+ Enabled: true
71
+
72
+ Style/MethodCalledOnDoEndBlock:
73
+ Enabled: true
74
+
75
+ Style/LambdaCall:
76
+ Enabled: false
77
+
78
+ Style/OptionHash:
79
+ Enabled: false
80
+
81
+ Style/QuotedSymbols:
82
+ Enabled: true
83
+
84
+ Style/ReturnNil:
85
+ Enabled: true
86
+ EnforcedStyle: return
87
+
88
+ Style/ArrayCoercion:
89
+ Enabled: true
90
+
91
+ Style/AutoResourceCleanup:
92
+ Enabled: true
93
+
94
+ Style/StringChars:
95
+ Enabled: true
96
+
97
+ Style/TopLevelMethodDefinition:
98
+ Enabled: true
99
+
100
+ Style/RedundantArgument:
101
+ Enabled: true
102
+
103
+ Lint/MissingSuper:
104
+ Enabled: false
105
+
106
+ Style/Documentation:
107
+ Enabled: true
108
+
109
+ Style/ClassAndModuleChildren:
110
+ Enabled: false
111
+
112
+ Naming/BlockForwarding:
113
+ Enabled: true
114
+
115
+ Style/ImplicitRuntimeError:
116
+ Enabled: false
117
+
118
+ Style/InPatternThen:
119
+ Enabled: true
120
+
121
+ Style/MethodCallWithArgsParentheses:
122
+ Enabled: false
123
+
124
+ Style/ModuleFunction:
125
+ EnforcedStyle: extend_self
126
+
127
+ Style/MissingElse:
128
+ Enabled: false
129
+
130
+ Lint/NumberConversion:
131
+ Enabled: false
132
+
133
+ Lint/ConstantResolution:
134
+ Enabled: false
135
+
136
+ Style/RescueStandardError:
137
+ Enabled: false
138
+
139
+ Style/FormatStringToken:
140
+ Enabled: false
141
+
142
+ Style/FormatString:
143
+ Enabled: false
144
+
145
+ Style/DocumentationMethod:
146
+ Enabled: false
147
+
148
+ Style/Copyright:
149
+ Enabled: false
150
+
151
+ Style/StringHashKeys:
152
+ Enabled: false
153
+
154
+ Style/InlineComment:
155
+ Enabled: false
156
+
157
+ Layout/FirstHashElementLineBreak:
158
+ Enabled: false
159
+
160
+ Layout/FirstMethodArgumentLineBreak:
161
+ Enabled: false
162
+
163
+ Style/ConstantVisibility:
164
+ Enabled: false
165
+
166
+ Layout/FirstArrayElementLineBreak:
167
+ Enabled: false
168
+
169
+ Layout/MultilineMethodArgumentLineBreaks:
170
+ Enabled: false
171
+
172
+ Layout/MultilineAssignmentLayout:
173
+ Enabled: false
174
+
175
+ Bundler/GemComment:
176
+ Enabled: false
177
+
178
+ Bundler/GemVersion:
179
+ Enabled: false
180
+
181
+ Layout/LineLength:
182
+ Max: 120
183
+
184
+ Style/IfUnlessModifier:
185
+ Enabled: false
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ amber_extension_generator
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.2
data/.solargraph.yml ADDED
@@ -0,0 +1,20 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ exclude:
5
+ - spec/**/*
6
+ - test/**/*
7
+ - vendor/**/*
8
+ - ".bundle/**/*"
9
+ require: []
10
+ domains: []
11
+ reporters: []
12
+ formatter:
13
+ rubocop:
14
+ cops: safe
15
+ except: []
16
+ only: []
17
+ extra_args: []
18
+ require_paths: []
19
+ plugins: []
20
+ max_files: 5000
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-09-02
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in amber_extension_generator.gemspec
6
+ gemspec
7
+
8
+ # Development dependencies
9
+ gem 'debug'
10
+ gem 'rake', '~> 13.0'
11
+ gem 'rubocop'
12
+ gem 'solargraph', '~> 0.45'
13
+ gem 'yard'
14
+
15
+ # Testing dependencies
16
+ gem 'bundler-audit'
17
+ gem 'minitest', '~> 5.0'
18
+ gem 'shoulda-context', '~> 2.0'
19
+ gem 'simplecov', require: false
20
+ gem 'simplecov-cobertura', require: false
data/Gemfile.lock ADDED
@@ -0,0 +1,116 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ amber_extension_generator (0.0.5)
5
+ cli-ui (~> 1)
6
+ rainbow (>= 3.0)
7
+ tty-command (~> 0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ ast (2.4.2)
13
+ backport (1.2.0)
14
+ benchmark (0.2.0)
15
+ bundler-audit (0.9.1)
16
+ bundler (>= 1.2.0, < 3)
17
+ thor (~> 1.0)
18
+ cli-ui (1.5.1)
19
+ debug (1.6.2)
20
+ irb (>= 1.3.6)
21
+ reline (>= 0.3.1)
22
+ diff-lcs (1.5.0)
23
+ docile (1.4.0)
24
+ e2mmap (0.1.0)
25
+ io-console (0.5.11)
26
+ irb (1.4.2)
27
+ reline (>= 0.3.0)
28
+ jaro_winkler (1.5.4)
29
+ json (2.6.2)
30
+ kramdown (2.4.0)
31
+ rexml
32
+ kramdown-parser-gfm (1.1.0)
33
+ kramdown (~> 2.0)
34
+ minitest (5.16.3)
35
+ nokogiri (1.13.9-arm64-darwin)
36
+ racc (~> 1.4)
37
+ parallel (1.22.1)
38
+ parser (3.1.2.1)
39
+ ast (~> 2.4.1)
40
+ pastel (0.8.0)
41
+ tty-color (~> 0.5)
42
+ racc (1.6.0)
43
+ rainbow (3.1.1)
44
+ rake (13.0.6)
45
+ regexp_parser (2.6.0)
46
+ reline (0.3.1)
47
+ io-console (~> 0.5)
48
+ reverse_markdown (2.1.1)
49
+ nokogiri
50
+ rexml (3.2.5)
51
+ rubocop (1.38.0)
52
+ json (~> 2.3)
53
+ parallel (~> 1.10)
54
+ parser (>= 3.1.2.1)
55
+ rainbow (>= 2.2.2, < 4.0)
56
+ regexp_parser (>= 1.8, < 3.0)
57
+ rexml (>= 3.2.5, < 4.0)
58
+ rubocop-ast (>= 1.23.0, < 2.0)
59
+ ruby-progressbar (~> 1.7)
60
+ unicode-display_width (>= 1.4.0, < 3.0)
61
+ rubocop-ast (1.23.0)
62
+ parser (>= 3.1.1.0)
63
+ ruby-progressbar (1.11.0)
64
+ shoulda-context (2.0.0)
65
+ simplecov (0.21.2)
66
+ docile (~> 1.1)
67
+ simplecov-html (~> 0.11)
68
+ simplecov_json_formatter (~> 0.1)
69
+ simplecov-cobertura (2.1.0)
70
+ rexml
71
+ simplecov (~> 0.19)
72
+ simplecov-html (0.12.3)
73
+ simplecov_json_formatter (0.1.4)
74
+ solargraph (0.47.2)
75
+ backport (~> 1.2)
76
+ benchmark
77
+ bundler (>= 1.17.2)
78
+ diff-lcs (~> 1.4)
79
+ e2mmap
80
+ jaro_winkler (~> 1.5)
81
+ kramdown (~> 2.3)
82
+ kramdown-parser-gfm (~> 1.1)
83
+ parser (~> 3.0)
84
+ reverse_markdown (>= 1.0.5, < 3)
85
+ rubocop (>= 0.52)
86
+ thor (~> 1.0)
87
+ tilt (~> 2.0)
88
+ yard (~> 0.9, >= 0.9.24)
89
+ thor (1.2.1)
90
+ tilt (2.0.11)
91
+ tty-color (0.6.0)
92
+ tty-command (0.10.1)
93
+ pastel (~> 0.8)
94
+ unicode-display_width (2.3.0)
95
+ webrick (1.7.0)
96
+ yard (0.9.28)
97
+ webrick (~> 1.7.0)
98
+
99
+ PLATFORMS
100
+ arm64-darwin-20
101
+
102
+ DEPENDENCIES
103
+ amber_extension_generator!
104
+ bundler-audit
105
+ debug
106
+ minitest (~> 5.0)
107
+ rake (~> 13.0)
108
+ rubocop
109
+ shoulda-context (~> 2.0)
110
+ simplecov
111
+ simplecov-cobertura
112
+ solargraph (~> 0.45)
113
+ yard
114
+
115
+ BUNDLED WITH
116
+ 2.3.23
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Amber Ruby
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ [![license](https://img.shields.io/badge/License-MIT-purple.svg)](LICENSE)
2
+ [![CI badge](https://github.com/amber-ruby/amber_extension_generator/actions/workflows/ci_ruby.yml/badge.svg)](https://github.com/amber-ruby/amber_extension_generator/actions/workflows/ci_ruby.yml)
3
+ [![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Verseth/82fd98743c74c8c36a9b04c9e325755e/raw/197794be336cde2bdaa3bccec99ebfc4660a3186/amber_extension_generator__heads_main.json)](https://github.com/amber-ruby/amber_extension_generator/actions/workflows/ci_ruby.yml)
4
+
5
+ # AmberExtensionGenerator
6
+
7
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/amber_extension_generator`. To experiment with that code, run `bin/console` for an interactive prompt.
8
+
9
+ TODO: Delete this and the text above, and describe your gem
10
+
11
+ ## Installation
12
+
13
+ Install the gem and add to the application's Gemfile by executing:
14
+
15
+ $ bundle add amber_extension_generator
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ $ gem install amber_extension_generator
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/amber_extension_generator.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ ::Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = ::FileList['test/**/*_test.rb']
10
+ end
11
+
12
+ require 'rubocop/rake_task'
13
+
14
+ ::RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/amber_extension_generator/version'
4
+ require_relative 'lib/amber_extension_generator/gem_name'
5
+
6
+ ::Gem::Specification.new do |spec|
7
+ spec.name = ::AmberExtensionGenerator::GEM_NAME
8
+ spec.version = ::AmberExtensionGenerator::VERSION
9
+ spec.authors = ['Ruby-Amber', 'Mateusz Drewniak', 'Garbus Beach']
10
+ spec.email = ['matmg24@gmail.com', 'piotr.garbus.garbicz@gmail.com']
11
+
12
+ spec.summary = 'A utility for generating new extensions or component libraries which hook into `amber_component`'
13
+ spec.description = <<~DESC
14
+ A utility for generating new extensions or component libraries which hook into `amber_component`.
15
+ Create your own themes!
16
+ DESC
17
+ spec.homepage = 'https://github.com/amber-ruby/amber_extension_generator'
18
+ spec.license = 'MIT'
19
+ spec.required_ruby_version = ">= 2.7.0"
20
+
21
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
22
+
23
+ spec.metadata['homepage_uri'] = spec.homepage
24
+ spec.metadata['source_code_uri'] = spec.homepage
25
+ spec.metadata['rubygems_mfa_required'] = 'true'
26
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
27
+
28
+ # Specify which files should be added to the gem when it is released.
29
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
30
+ spec.files = ::Dir.chdir(__dir__) do
31
+ `git ls-files -z`.split("\x0").reject do |f|
32
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
33
+ end
34
+ end
35
+ spec.bindir = 'exe'
36
+ spec.executables = %w[amber_extension_generator]
37
+ spec.require_paths = %w[lib]
38
+
39
+ # Uncomment to register a new dependency of your gem
40
+ spec.add_dependency 'cli-ui', '~> 1'
41
+ spec.add_dependency 'rainbow', '>= 3.0'
42
+ spec.add_dependency 'tty-command', '~> 0'
43
+
44
+ # For more information and examples about making a new gem, check out our
45
+ # guide at: https://bundler.io/guides/creating_gem.html
46
+ end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../lib/amber_extension_generator'
5
+
6
+ ::AmberExtensionGenerator::CLI.run
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ module ::AmberExtensionGenerator
6
+ module CLI
7
+ # Parses and wraps all provided CLI arguments.
8
+ class Args
9
+ BANNER = <<~DOC
10
+ Usage:
11
+ amber_extension_generator GEM_PATH
12
+ amber_extension_generator [options]
13
+
14
+ DOC
15
+
16
+ class << self
17
+ # @param argv [Array<String>]
18
+ # @return [self]
19
+ def parse(argv = ::ARGV)
20
+ args = new
21
+
22
+ opt_parser = ::OptionParser.new do |opts|
23
+ opts.banner = BANNER
24
+
25
+ opts.on('-v', '--version', 'Show the version of the gem') do |_val|
26
+ puts VERSION
27
+ exit
28
+ end
29
+
30
+ opts.on('-h', '--help', 'Show this help') do |_val|
31
+ puts opts
32
+ exit
33
+ end
34
+ end
35
+
36
+ args.gem_path = ::Pathname.new(::File.expand_path(argv.first))
37
+ opt_parser.parse(argv)
38
+
39
+ args
40
+ end
41
+ end
42
+
43
+ # @return [Pathname] Path of the newly generated gem
44
+ attr_accessor :gem_path
45
+ end
46
+ end
47
+ end