spiker 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6807d10b0e21344ac48f335257b7a92e41cce9ce140b7f73b3f31545d06d7135
4
+ data.tar.gz: cd463be9673e5f188459c1ad61e5460dd5b4e9fb05fe6d61651abfd733de1b2c
5
+ SHA512:
6
+ metadata.gz: ee478066198cd3b8f3e2bb122d1bd43156dc08a13d2229ad72f1b63f68c67c2ba3d7a6aae8af33d43d319073673228b57dc7ce721b943be61ac8d5c802e2379c
7
+ data.tar.gz: e753e0e8618365cd74d7f1ee9a38733a1be9e20102e7ab5c22fdb3693566360ab24d6ea21c5a34e34055b4f60e63de51f76c14804c1ff22e3a3463d2265432ed
@@ -0,0 +1,13 @@
1
+ version: 2.1
2
+ jobs:
3
+ build:
4
+ docker:
5
+ - image: ruby:3.0.0
6
+ steps:
7
+ - checkout
8
+ - run:
9
+ name: Run the default task
10
+ command: |
11
+ gem install bundler -v 2.2.3
12
+ bundle install
13
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ Style/StringLiterals:
2
+ Enabled: true
3
+ EnforcedStyle: double_quotes
4
+
5
+ Style/StringLiteralsInInterpolation:
6
+ Enabled: true
7
+ EnforcedStyle: double_quotes
8
+
9
+ Layout/LineLength:
10
+ Max: 120
11
+
12
+ AllCops:
13
+ NewCops: enable
14
+ Exclude:
15
+ - 'lib/spiker/generators/templates/**'
16
+ - 'exe/spiker'
17
+ - 'spiker.gemspec'
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in spiker.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+ gem "minitest-reporters", "~> 1.0"
12
+
13
+ gem "guard", "~> 2.18.0"
14
+ gem "guard-minitest", "~> 2.4.0"
15
+
16
+ gem "rubocop", "~> 0.93.0"
17
+
18
+ gem "thor", "~> 0.20.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,87 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ spiker (0.1.0)
5
+ thor (~> 0.19)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ansi (1.5.0)
11
+ ast (2.4.2)
12
+ builder (3.2.4)
13
+ coderay (1.1.3)
14
+ ffi (1.15.5)
15
+ formatador (0.3.0)
16
+ guard (2.18.0)
17
+ formatador (>= 0.2.4)
18
+ listen (>= 2.7, < 4.0)
19
+ lumberjack (>= 1.0.12, < 2.0)
20
+ nenv (~> 0.1)
21
+ notiffany (~> 0.0)
22
+ pry (>= 0.13.0)
23
+ shellany (~> 0.0)
24
+ thor (>= 0.18.1)
25
+ guard-compat (1.2.1)
26
+ guard-minitest (2.4.6)
27
+ guard-compat (~> 1.2)
28
+ minitest (>= 3.0)
29
+ listen (3.7.1)
30
+ rb-fsevent (~> 0.10, >= 0.10.3)
31
+ rb-inotify (~> 0.9, >= 0.9.10)
32
+ lumberjack (1.2.8)
33
+ method_source (1.0.0)
34
+ minitest (5.15.0)
35
+ minitest-reporters (1.5.0)
36
+ ansi
37
+ builder
38
+ minitest (>= 5.0)
39
+ ruby-progressbar
40
+ nenv (0.3.0)
41
+ notiffany (0.1.3)
42
+ nenv (~> 0.1)
43
+ shellany (~> 0.0)
44
+ parallel (1.21.0)
45
+ parser (3.1.0.0)
46
+ ast (~> 2.4.1)
47
+ pry (0.14.1)
48
+ coderay (~> 1.1)
49
+ method_source (~> 1.0)
50
+ rainbow (3.1.1)
51
+ rake (13.0.6)
52
+ rb-fsevent (0.11.0)
53
+ rb-inotify (0.10.1)
54
+ ffi (~> 1.0)
55
+ regexp_parser (2.2.0)
56
+ rexml (3.2.5)
57
+ rubocop (0.93.1)
58
+ parallel (~> 1.10)
59
+ parser (>= 2.7.1.5)
60
+ rainbow (>= 2.2.2, < 4.0)
61
+ regexp_parser (>= 1.8)
62
+ rexml
63
+ rubocop-ast (>= 0.6.0)
64
+ ruby-progressbar (~> 1.7)
65
+ unicode-display_width (>= 1.4.0, < 2.0)
66
+ rubocop-ast (1.15.1)
67
+ parser (>= 3.0.1.1)
68
+ ruby-progressbar (1.11.0)
69
+ shellany (0.0.1)
70
+ thor (0.20.3)
71
+ unicode-display_width (1.8.0)
72
+
73
+ PLATFORMS
74
+ x86_64-linux
75
+
76
+ DEPENDENCIES
77
+ guard (~> 2.18.0)
78
+ guard-minitest (~> 2.4.0)
79
+ minitest (~> 5.0)
80
+ minitest-reporters (~> 1.0)
81
+ rake (~> 13.0)
82
+ rubocop (~> 0.93.0)
83
+ spiker!
84
+ thor (~> 0.20.0)
85
+
86
+ BUNDLED WITH
87
+ 2.2.3
data/Guardfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ clearing :on
4
+
5
+ guard :minitest, all_after_pass: true do
6
+ watch(%r{^test/(.*)/?(.*)_test\.rb$})
7
+ watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
8
+ watch(%r{^test/test_helper\.rb$}) { "test" }
9
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Aaron Norling
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # Spiker
2
+
3
+ Spiker helps you validate your ideas under test. It can also be a basic educational tool, giving the learner a minimal framework to start writing and testing the Ruby code.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'spiker'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install spiker
20
+
21
+ ## Usage
22
+
23
+ In the terminal, change directory to someplace where you want to collect your spikes:
24
+
25
+ $ cd ~/spikes
26
+
27
+ Then, create a new spike:
28
+
29
+ $ spiker simple my_spike
30
+ $ cd my_spike
31
+
32
+ Using the "simple" formula, Spiker will create an `app.rb` file, a `Gemfile`, and a `Guardfile`. The `app.rb` file will contain boilerplate for both Minitest and a Ruby class in the same file:
33
+
34
+ ```ruby
35
+ require 'minitest'
36
+ require 'minitest/autorun'
37
+ require 'minitest/reporters'
38
+
39
+ Minitest::Reporters.use!
40
+
41
+ class MySpikeTest < Minitest::Test
42
+ def test_that_it_works
43
+ assert true
44
+ end
45
+ end
46
+
47
+ class MySpike
48
+ attr_accessor :name
49
+ def initialize(name:)
50
+ @name = name
51
+ end
52
+ end
53
+ ```
54
+
55
+ From here, the user should be able to start Guard and immediately begin development in a red-green fashion.
56
+
57
+ The "multiple" option is not implemented yet, but is intended to flesh out a more complex spike that includes a tests directory and `test_helper.rb`, a `lib` directory, README.md, etc.
58
+
59
+ ## Development
60
+
61
+ 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.
62
+
63
+ 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).
64
+
65
+ ## Contributing
66
+
67
+ Bug reports and pull requests are welcome on GitHub at https://github.com/norlinga/spiker.
68
+
69
+ ## License
70
+
71
+ 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]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "spiker"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -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
data/exe/spiker ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require "spiker/cli"
3
+ Spiker::CLI.start
data/lib/spiker/cli.rb ADDED
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+ require_relative "version"
5
+ require_relative "generators/simple"
6
+ require_relative "generators/multiple"
7
+
8
+ module Spiker
9
+ # Accept options "single" and "multiple"
10
+ # for single file spikes or multi-file spikes
11
+ # and a name for the spike directory. That is all
12
+ class CLI < Thor
13
+ desc "version", "Show version"
14
+ def version
15
+ puts "Spiker version #{Spiker::VERSION}"
16
+ end
17
+
18
+ desc "simple NAME", "Spike in a single file"
19
+ method_option :name, type: :string, aliases: "-n", desc: "Name of the spike"
20
+ def simple(name)
21
+ Spiker::Generators::Simple.start([name])
22
+ end
23
+
24
+ desc "multiple NAME", "Spike over multiple files"
25
+ method_option :name, type: :string, aliases: "-n", desc: "Name of the spike"
26
+ def multiple(name)
27
+ Spiker::Generators::Multiple.start([name])
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor/group"
4
+ module Spiker
5
+ module Generators
6
+ # Generates multiple spike files, seperating tests from the
7
+ # tested code. For when the spike gets too hairy for a single
8
+ # file.
9
+ class Multiple < Thor::Group
10
+ include Thor::Actions
11
+
12
+ argument :name, type: :string
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor/group"
4
+ module Spiker
5
+ module Generators
6
+ # Generates a single spike file, with supporting infrastructure.
7
+ # For simpler spikes that don't need a ton of organization.
8
+ class Simple < Thor::Group
9
+ include Thor::Actions
10
+
11
+ argument :name, type: :string
12
+
13
+ def self.source_root
14
+ "#{File.dirname(__FILE__)}/templates"
15
+ end
16
+
17
+ def create_spike_directory
18
+ empty_directory(name)
19
+ end
20
+
21
+ def create_spike_file
22
+ template("simple_app.rb", "#{name}/app.rb")
23
+ end
24
+
25
+ def create_guard_file
26
+ template("simple_guardfile.rb", "#{name}/Guardfile")
27
+ end
28
+
29
+ def create_gem_file
30
+ template("simple_gemfile.rb", "#{name}/Gemfile")
31
+ end
32
+
33
+ def run_bundler
34
+ inside(name) do
35
+ run("bundle install")
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,18 @@
1
+ require 'minitest'
2
+ require 'minitest/autorun'
3
+ require 'minitest/reporters'
4
+
5
+ Minitest::Reporters.use!
6
+
7
+ class <%= name.capitalize %>Test < Minitest::Test
8
+ def test_that_it_works
9
+ assert true
10
+ end
11
+ end
12
+
13
+ class <%= name.capitalize %>
14
+ attr_accessor :name
15
+ def initialize(name:)
16
+ @name = name
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ gem 'minitest'
8
+ gem 'minitest-reporters'
9
+
10
+ gem 'guard'
11
+ gem 'guard-minitest'
@@ -0,0 +1,6 @@
1
+ clearing :on
2
+
3
+ guard :minitest, all_after_pass: true, test_folders: ['.'], test_file_patterns: '*.rb' do
4
+ # with Minitest::Unit
5
+ watch(%r{^app\.rb$}) { './app.rb' }
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spiker
4
+ VERSION = "0.1.0"
5
+ end
data/lib/spiker.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "spiker/version"
4
+
5
+ module Spiker
6
+ class Error < StandardError; end
7
+ end
data/spiker.gemspec ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/spiker/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "spiker"
7
+ spec.version = Spiker::VERSION
8
+ spec.authors = ["Aaron Norling"]
9
+ spec.email = ["me@aaronware.com"]
10
+
11
+ spec.summary = "Properly spike your Ruby"
12
+ spec.description = "Scaffold for code spikes, includes simple boilerplate with Minitest + Guard to make red/green work out-of-the-box."
13
+ spec.homepage = "http://github.com/norling/spiker."
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/norlinga/spiker"
21
+ spec.metadata["changelog_uri"] = "https://github.com/norlinga/spiker"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ spec.add_dependency "thor", "~> 0.19"
34
+
35
+ # For more information and examples about making a new gem, checkout our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spiker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aaron Norling
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.19'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.19'
27
+ description: Scaffold for code spikes, includes simple boilerplate with Minitest +
28
+ Guard to make red/green work out-of-the-box.
29
+ email:
30
+ - me@aaronware.com
31
+ executables:
32
+ - spiker
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - ".circleci/config.yml"
37
+ - ".gitignore"
38
+ - ".rubocop.yml"
39
+ - Gemfile
40
+ - Gemfile.lock
41
+ - Guardfile
42
+ - LICENSE.txt
43
+ - README.md
44
+ - Rakefile
45
+ - bin/console
46
+ - bin/setup
47
+ - exe/spiker
48
+ - lib/spiker.rb
49
+ - lib/spiker/cli.rb
50
+ - lib/spiker/generators/multiple.rb
51
+ - lib/spiker/generators/simple.rb
52
+ - lib/spiker/generators/templates/simple_app.rb
53
+ - lib/spiker/generators/templates/simple_gemfile.rb
54
+ - lib/spiker/generators/templates/simple_guardfile.rb
55
+ - lib/spiker/version.rb
56
+ - spiker.gemspec
57
+ homepage: http://github.com/norling/spiker.
58
+ licenses:
59
+ - MIT
60
+ metadata:
61
+ allowed_push_host: https://rubygems.org
62
+ homepage_uri: http://github.com/norling/spiker.
63
+ source_code_uri: https://github.com/norlinga/spiker
64
+ changelog_uri: https://github.com/norlinga/spiker
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 2.3.0
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubygems_version: 3.2.3
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Properly spike your Ruby
84
+ test_files: []