arsenic 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gem_release.yml +3 -0
  3. data/.github/CODEOWNERS +1 -0
  4. data/.github/FUNDING.yml +12 -0
  5. data/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
  6. data/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
  7. data/.github/PULL_REQUEST_TEMPLATE.md +23 -0
  8. data/.github/workflows/linters.yml +34 -0
  9. data/.github/workflows/tests.yml +34 -0
  10. data/.gitignore +11 -0
  11. data/.rspec +3 -0
  12. data/.standard.yml +9 -0
  13. data/CODE_OF_CONDUCT.md +74 -0
  14. data/Gemfile +10 -0
  15. data/Gemfile.lock +72 -0
  16. data/LICENSE.txt +21 -0
  17. data/README.md +42 -0
  18. data/Rakefile +6 -0
  19. data/arsenic.gemspec +32 -0
  20. data/bin/console +14 -0
  21. data/bin/format +3 -0
  22. data/bin/rspec +29 -0
  23. data/bin/setup +8 -0
  24. data/bin/standardrb +29 -0
  25. data/exe/arsenic +13 -0
  26. data/lib/arsenic.rb +100 -0
  27. data/lib/arsenic/templates/newgem/.gem_release.yml.tt +3 -0
  28. data/lib/arsenic/templates/newgem/.github/ISSUE_TEMPLATE/bug_report.md.tt +24 -0
  29. data/lib/arsenic/templates/newgem/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  30. data/lib/arsenic/templates/newgem/.github/PULL_REQUEST_TEMPLATE.md +23 -0
  31. data/lib/arsenic/templates/newgem/.github/workflows/docs-lint.yml.tt +72 -0
  32. data/lib/arsenic/templates/newgem/.github/workflows/rspec-jruby.yml.tt +35 -0
  33. data/lib/arsenic/templates/newgem/.github/workflows/rspec.yml.tt +61 -0
  34. data/lib/arsenic/templates/newgem/.github/workflows/rubocop.yml.tt +21 -0
  35. data/lib/arsenic/templates/newgem/.gitignore +43 -0
  36. data/lib/arsenic/templates/newgem/.mdlrc +1 -0
  37. data/lib/arsenic/templates/newgem/.rubocop-md.yml +16 -0
  38. data/lib/arsenic/templates/newgem/.rubocop.yml +29 -0
  39. data/lib/arsenic/templates/newgem/Gemfile.tt +19 -0
  40. data/lib/arsenic/templates/newgem/LICENSE.txt +22 -0
  41. data/lib/arsenic/templates/newgem/README.md +43 -0
  42. data/lib/arsenic/templates/newgem/RELEASING.md.tt +43 -0
  43. data/lib/arsenic/templates/newgem/Rakefile +20 -0
  44. data/lib/arsenic/templates/newgem/gemfiles/jruby.gemfile +5 -0
  45. data/lib/arsenic/templates/newgem/gemfiles/rails5.gemfile +5 -0
  46. data/lib/arsenic/templates/newgem/gemfiles/rails6.gemfile +5 -0
  47. data/lib/arsenic/templates/newgem/gemfiles/railsmaster.gemfile +6 -0
  48. data/lib/arsenic/templates/newgem/gemfiles/rubocop.gemfile +4 -0
  49. data/lib/arsenic/templates/newgem/lefthook.yml +18 -0
  50. data/lib/arsenic/templates/newgem/lib/dir/railtie.rb.tt +6 -0
  51. data/lib/arsenic/templates/newgem/lib/dir/version.rb.tt +5 -0
  52. data/lib/arsenic/templates/newgem/lib/name.rb.tt +6 -0
  53. data/lib/arsenic/templates/newgem/newgem.gemspec.tt +34 -0
  54. data/lib/arsenic/templates/newgem/spec/spec_helper.rb.tt +30 -0
  55. data/lib/arsenic/version.rb +3 -0
  56. metadata +103 -0
@@ -0,0 +1,32 @@
1
+ require_relative "lib/arsenic/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "arsenic"
5
+ spec.license = "MIT"
6
+ spec.version = Arsenic::VERSION
7
+ spec.authors = ["Andrew Mason"]
8
+ spec.email = %w[andrewmcodes@protonmail.com]
9
+
10
+ spec.summary = "andrewmcodes gem generator"
11
+ spec.description = "originally forked from Palkan. https://github.com/palkan/new-gem-generator"
12
+ spec.homepage = "https://github.com/andrewmcodes/arsenic"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata = {
16
+ # "allowed_push_host" => "TODO: Set to 'http://mygemserver.com'"
17
+ "bug_tracker_uri" => "#{spec.homepage}/issues",
18
+ "changelog_uri" => "#{spec.homepage}/blob/main/CHANGELOG.md",
19
+ "documentation_uri" => spec.homepage,
20
+ "homepage_uri" => spec.homepage,
21
+ "source_code_uri" => spec.homepage
22
+ }
23
+
24
+ spec.files =
25
+ Dir.chdir(File.expand_path("..", __FILE__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
+ end
28
+
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = %w[lib]
32
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "arsenic"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bin/standardrb
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'standardrb' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("standard", "standardrb")
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ lib_path = File.expand_path("../lib", __dir__)
5
+ $:.unshift(lib_path) unless $:.include?(lib_path)
6
+ require "arsenic"
7
+
8
+ Signal.trap("INT") do
9
+ warn("\n#{caller.join("\n")}: interrupted")
10
+ exit(1)
11
+ end
12
+
13
+ Arsenic.start
@@ -0,0 +1,100 @@
1
+ begin
2
+ require "thor"
3
+ require "bundler"
4
+ require "pry-byebug"
5
+ rescue LoadError
6
+ require "bundler/inline"
7
+ require "thor"
8
+ end
9
+
10
+ require "arsenic/version"
11
+
12
+ module Arsenic
13
+ class Newgem < Thor::Group
14
+ include Thor::Actions
15
+
16
+ COPY_FILES = %w[
17
+ .gem_release.yml
18
+ .gitignore
19
+ .mdlrc
20
+ .rspec
21
+ .rubocop-md.yml
22
+ .rubocop.yml
23
+ lefthook.yml
24
+ Gemfile
25
+ LICENSE.txt
26
+ Rakefile
27
+ README.md
28
+ RELEASING.md
29
+ ].freeze
30
+
31
+ COPY_DIRS = %w[
32
+ .github
33
+ spec
34
+ ].freeze
35
+
36
+ argument :name
37
+
38
+ def self.source_root
39
+ ENV.fetch("TEMPLATE", File.join(__dir__, "arsenic", "templates", "newgem"))
40
+ end
41
+
42
+ def self.exit_on_failure?
43
+ true
44
+ end
45
+
46
+ def copy_files
47
+ COPY_FILES.each { |file| template file }
48
+ end
49
+
50
+ def copy_dirs
51
+ COPY_DIRS.each { |dir| directory(dir) }
52
+ end
53
+
54
+ def copy_gemfiles
55
+ template "gemfiles/rubocop.gemfile"
56
+ return unless rails?
57
+
58
+ template "gemfiles/jruby.gemfile"
59
+ template "gemfiles/rails5.gemfile"
60
+ template "gemfiles/rails6.gemfile"
61
+ template "gemfiles/railsmaster.gemfile"
62
+ end
63
+
64
+ def copy_lib
65
+ template "lib/name.rb", "lib/#{name}.rb"
66
+ directory "lib/dir", "lib/#{name_path}"
67
+ remove_file "lib/#{name_path}/railtie.rb" unless rails?
68
+ end
69
+
70
+ def copy_gemspec
71
+ template "newgem.gemspec", "#{name}.gemspec"
72
+ end
73
+
74
+ private
75
+
76
+ def rails?
77
+ @rails ||= yes?("Need Rails stuff?")
78
+ end
79
+
80
+ def module_name
81
+ @module_name ||= name.split("-").map { |mod|
82
+ mod.split("_").map(&:capitalize).join
83
+ }.join("::")
84
+ end
85
+
86
+ def human_name
87
+ @human_name ||= name.split(/[-_]/).map(&:capitalize).join(" ")
88
+ end
89
+
90
+ def name_path
91
+ @name_path ||= name.tr("-", "/")
92
+ end
93
+ end
94
+
95
+ def self.start
96
+ generator = Newgem.new ARGV
97
+ generator.destination_root = ARGV[0]
98
+ generator.invoke_all
99
+ end
100
+ end
@@ -0,0 +1,3 @@
1
+ bump:
2
+ file: lib/<%= name %>/version.rb
3
+ skip_ci: true
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: andrewmcodes
7
+
8
+ ---
9
+
10
+ ## What did you do?
11
+
12
+ ## What did you expect to happen?
13
+
14
+ ## What actually happened?
15
+
16
+ ## Additional context
17
+
18
+ ## Environment
19
+
20
+ **Ruby Version:**
21
+
22
+ **Framework Version (Rails, whatever):**
23
+
24
+ **<%= human_name %> Version:**
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ""
5
+ labels: enhancement
6
+ assignees: andrewmcodes
7
+ ---
8
+
9
+ ## Is your feature request related to a problem? Please describe.
10
+
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ ## Describe the solution you'd like
14
+
15
+ A clear and concise description of what you want to happen.
16
+
17
+ ## Describe alternatives you've considered
18
+
19
+ A clear and concise description of any alternative solutions or features you've considered.
20
+
21
+ ## Additional context
22
+
23
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,23 @@
1
+ <!--
2
+ First of all, thanks for contributing!
3
+
4
+ If it's a typo fix or minor documentation update feel free to skip the rest of this template!
5
+ -->
6
+
7
+ ## What is the purpose of this pull request?
8
+
9
+ <!--
10
+ If it's a bug fix, then link it to the issue, for example:
11
+
12
+ Fixes #xxx
13
+ -->
14
+
15
+ ## What changes did you make? (overview)
16
+
17
+ ## Is there anything you'd like reviewers to focus on?
18
+
19
+ ## Checklist
20
+
21
+ - [ ] I've added tests for this change
22
+ - [ ] I've added a Changelog entry
23
+ - [ ] I've updated a documentation
@@ -0,0 +1,72 @@
1
+ name: Lint Docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ paths:
8
+ - "*.md"
9
+ - "**/*.md"
10
+ pull_request:
11
+ paths:
12
+ - "*.md"
13
+ - "**/*.md"
14
+
15
+ jobs:
16
+ markdownlint:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: 2.7
23
+ - name: Run Markdown linter
24
+ run: |
25
+ gem install mdl
26
+ mdl **/*.md
27
+ rubocop:
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@v2
31
+ - uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: 2.7
34
+ - name: Lint Markdown files with RuboCop
35
+ run: |
36
+ gem install bundler
37
+ bundle install --gemfile gemfiles/rubocop.gemfile --jobs 4 --retry 3
38
+ bundle exec --gemfile gemfiles/rubocop.gemfile rubocop -c .rubocop-md.yml
39
+ forspell:
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - uses: actions/checkout@v2
43
+ - name: Install Hunspell
44
+ run: |
45
+ sudo apt-get install hunspell
46
+ - uses: ruby/setup-ruby@v1
47
+ with:
48
+ ruby-version: 2.7
49
+ - name: Cache installed gems
50
+ uses: actions/cache@v1
51
+ with:
52
+ path: /home/runner/.rubies/ruby-2.7.0/lib/ruby/gems/2.7.0
53
+ key: gems-cache-${{ runner.os }}
54
+ - name: Install Forspell
55
+ run: gem install forspell
56
+ - name: Run Forspell
57
+ run: forspell **/*.md .github/**/*.md
58
+ liche:
59
+ runs-on: ubuntu-latest
60
+ env:
61
+ GO111MODULE: on
62
+ steps:
63
+ - uses: actions/checkout@v2
64
+ - name: Set up Go
65
+ uses: actions/setup-go@v1
66
+ with:
67
+ go-version: 1.13.x
68
+ - name: Run liche
69
+ run: |
70
+ export PATH=$PATH:$(go env GOPATH)/bin
71
+ go get -u github.com/raviqqe/liche
72
+ liche README.md CHANGELOG.md
@@ -0,0 +1,35 @@
1
+ name: JRuby Build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ rspec:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ BUNDLE_JOBS: 4
14
+ BUNDLE_RETRY: 3
15
+ CI: true
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: actions/cache@v1
19
+ with:
20
+ path: /home/runner/bundle
21
+ key: bundle-${{ hashFiles('**/gemfiles/jruby.gemfile') }}-${{ hashFiles('**/*.gemspec') }}
22
+ restore-keys: |
23
+ bundle-
24
+ - uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: jruby
27
+ - name: Bundle install
28
+ run: |
29
+ bundle config --global gemfile gemfiles/jruby.gemfile
30
+ bundle config path /home/runner/bundle
31
+ bundle install
32
+ bundle update
33
+ - name: Run RSpec
34
+ run: |
35
+ bundle exec rspec
@@ -0,0 +1,61 @@
1
+ name: Build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ rspec:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ BUNDLE_JOBS: 4
14
+ BUNDLE_RETRY: 3
15
+ CI: true
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ <%- if rails? -%>
20
+ ruby: ["2.7"]
21
+ gemfile: ["gemfiles/rails6.gemfile"]
22
+ include:
23
+ - ruby: "2.5"
24
+ gemfile: "gemfiles/rails5.gemfile"
25
+ - ruby: "2.6"
26
+ gemfile: "gemfiles/rails5.gemfile"
27
+ - ruby: "2.7"
28
+ gemfile: "gemfiles/railsmaster.gemfile"
29
+ <%- else %>
30
+ ruby: ["2.5", "2.6", "2.7"]
31
+ <%- end -%>
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+ - uses: actions/cache@v1
35
+ with:
36
+ path: /home/runner/bundle
37
+ <%- if rails? -%>
38
+ key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
39
+ <%- else -%>
40
+ key: bundle-${{ matrix.ruby }}-${{ hashFiles('../Gemfile') }}-${{ hashFiles('**/*.gemspec') }}
41
+ <%- end -%>
42
+ restore-keys: |
43
+ <%- if rails? -%>
44
+ bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
45
+ <%- else -%>
46
+ bundle-${{ matrix.ruby }}-
47
+ <%- end -%>
48
+ - uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: ${{ matrix.ruby }}
51
+ - name: Bundle install
52
+ run: |
53
+ bundle config path /home/runner/bundle
54
+ <%- if rails? -%>
55
+ bundle config --global gemfile ${{ matrix.gemfile }}
56
+ <%- end -%>
57
+ bundle install
58
+ bundle update
59
+ - name: Run RSpec
60
+ run: |
61
+ bundle exec rspec