spiker 0.1.6 → 0.1.7
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 +4 -4
- data/exe/spiker +1 -1
- data/lib/spiker/base_generator.rb +71 -0
- data/lib/spiker/cli.rb +28 -18
- data/lib/spiker/generators/given.rb +3 -36
- data/lib/spiker/generators/multi.rb +18 -43
- data/lib/spiker/generators/rspec.rb +43 -0
- data/lib/spiker/generators/simple.rb +3 -36
- data/lib/spiker/templates/common/Dockerfile.tt +18 -0
- data/lib/spiker/templates/common/Makefile.tt +11 -0
- data/lib/spiker/templates/common/docker-compose.yml.tt +8 -0
- data/lib/spiker/{generators/templates/given/gemfile.rb → templates/given/Gemfile.tt} +4 -1
- data/lib/spiker/templates/given/app.rb.tt +31 -0
- data/lib/spiker/{generators/templates/simple/gemfile.rb → templates/multi/Gemfile.tt} +4 -1
- data/lib/spiker/{generators/templates/multi/app.rb.erb → templates/multi/app.rb.tt} +2 -1
- data/lib/spiker/{generators/templates/multi/app_test.rb.erb → templates/multi/app_test.rb.tt} +3 -3
- data/lib/spiker/{generators/templates/multi/test_helper.rb → templates/multi/test_helper.rb.tt} +1 -1
- data/lib/spiker/templates/rspec/Gemfile.tt +15 -0
- data/lib/spiker/templates/rspec/Guardfile.tt +7 -0
- data/lib/spiker/templates/rspec/README.md.tt +44 -0
- data/lib/spiker/templates/rspec/Rakefile.tt +7 -0
- data/lib/spiker/templates/rspec/app.rb.tt +10 -0
- data/lib/spiker/templates/rspec/app_spec.rb.tt +9 -0
- data/lib/spiker/templates/rspec/spec_helper.rb.tt +12 -0
- data/lib/spiker/{generators/templates/multi/gemfile.rb → templates/simple/Gemfile.tt} +5 -0
- data/lib/spiker/templates/simple/app.rb.tt +31 -0
- data/lib/spiker/utils.rb +17 -0
- data/lib/spiker/version.rb +1 -1
- data/lib/spiker.rb +11 -14
- metadata +30 -29
- data/.circleci/config.yml +0 -13
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -16
- data/Gemfile +0 -20
- data/Gemfile.lock +0 -94
- data/Guardfile +0 -9
- data/LICENSE.txt +0 -21
- data/README.md +0 -77
- data/Rakefile +0 -16
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/lib/spiker/generators/templates/given/app.rb.erb +0 -23
- data/lib/spiker/generators/templates/simple/app.rb.erb +0 -23
- data/spiker.gemspec +0 -37
- /data/lib/spiker/{generators/templates/common/basic.env → templates/common/basic.env.tt} +0 -0
- /data/lib/spiker/{generators/templates/given/guardfile.rb → templates/given/Guardfile.tt} +0 -0
- /data/lib/spiker/{generators/templates/multi/guardfile.rb → templates/multi/Guardfile.tt} +0 -0
- /data/lib/spiker/{generators/templates/multi/readme.md.erb → templates/multi/README.md.tt} +0 -0
- /data/lib/spiker/{generators/templates/multi/rakefile.rb → templates/multi/Rakefile.tt} +0 -0
- /data/lib/spiker/{generators/templates/simple/guardfile.rb → templates/simple/Guardfile.tt} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a9aea62d09c4b4c0e42dba860dc32a6c572d779d6c40da92f9d5a56736d1455
|
4
|
+
data.tar.gz: 161acf90832597f8151a324a60096775cab7f9569e0dc13f717ff82b9b2a1f86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57f40c25c3b4e06146662f9aeb8712e1cfa9e071dcb20c251a215d635192c5473ba421fa4675291472ecd416204bddc82b7163bddb896d202502142c1fc224ce
|
7
|
+
data.tar.gz: 05e2bcdf0c10fcb04b1385abb1008c5341282a8f1dd2b6cdcedfb1ce8f2d4cc3c80f4b90e6994bec4ad5c159e80fcff95f2391f47f4acb806c53ff6f0d466e97
|
data/exe/spiker
CHANGED
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spiker
|
4
|
+
# BaseGenerator handles the common steps for all generators, including allowing for
|
5
|
+
# several feature skips. Inherited this generator - not to be used directly.
|
6
|
+
class BaseGenerator < Thor::Group
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
argument :spike_name, type: :string
|
10
|
+
|
11
|
+
def self.source_root
|
12
|
+
File.expand_path("../spiker/templates", __dir__)
|
13
|
+
end
|
14
|
+
|
15
|
+
def generator_name
|
16
|
+
# name here refers to the class name, not the name of the spike
|
17
|
+
name = self.class.name.split("::").last
|
18
|
+
name.gsub(/([a-z])([A-Z])/, '\1_\2').downcase
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_spike_directory
|
22
|
+
empty_directory(spike_name)
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_guard_file
|
26
|
+
template("#{generator_name}/Guardfile.tt", "#{spike_name}/Guardfile")
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_gem_file
|
30
|
+
template("#{generator_name}/Gemfile.tt", "#{spike_name}/Gemfile")
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_env_file
|
34
|
+
template("common/basic.env.tt", "#{spike_name}/.env")
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_docker_files
|
38
|
+
if options[:skip_docker]
|
39
|
+
say "🛑 Skipping Dockerfile and docker-compose.yml generation (--skip-docker was passed)", :yellow
|
40
|
+
return if options[:skip_docker]
|
41
|
+
end
|
42
|
+
|
43
|
+
template("common/Dockerfile.tt", "#{spike_name}/Dockerfile")
|
44
|
+
template("common/docker-compose.yml.tt", "#{spike_name}/docker-compose.yml")
|
45
|
+
template("common/Makefile.tt", "#{spike_name}/Makefile")
|
46
|
+
end
|
47
|
+
|
48
|
+
def run_bundle_install
|
49
|
+
if options[:skip_bundle]
|
50
|
+
say "🛑 Skipping bundle install (--skip-bundle was passed)", :yellow
|
51
|
+
return
|
52
|
+
end
|
53
|
+
|
54
|
+
inside(spike_name) do
|
55
|
+
Bundler.with_unbundled_env do
|
56
|
+
system("bundle install")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def run_git_init
|
62
|
+
if options[:skip_git]
|
63
|
+
say "🛑 Skipping git init (--skip-git was passed)", :yellow
|
64
|
+
return
|
65
|
+
end
|
66
|
+
|
67
|
+
say "📦 Running `git init`...", :green
|
68
|
+
inside(File.join(destination_root, spike_name)) { run "git init" }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/spiker/cli.rb
CHANGED
@@ -1,39 +1,49 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "thor"
|
4
|
-
require_relative "version"
|
5
|
-
require_relative "generators/simple"
|
6
|
-
require_relative "generators/given"
|
7
|
-
require_relative "generators/multi"
|
8
|
-
|
9
3
|
module Spiker
|
10
|
-
# Accept options "simple", "given", or "
|
4
|
+
# Accept options "simple", "given", "multi", or "rspec".
|
11
5
|
# Both Simple and Given create "single file" spikes
|
12
6
|
# with the tests and spike code in a single file.
|
13
|
-
# The Multi
|
7
|
+
# The Multi and Rspec options create a more traditionally structured
|
14
8
|
# spike directory with tests, code, README, etc. That is all.
|
15
9
|
class CLI < Thor
|
10
|
+
class_option :skip_bundle, type: :boolean, default: false, desc: "Skip running bundle install"
|
11
|
+
class_option :skip_git, type: :boolean, default: false, desc: "Skip initializing git repository"
|
12
|
+
class_option :skip_docker, type: :boolean, default: false, desc: "Skip creating Dockerfile and docker-compose.yml"
|
13
|
+
|
16
14
|
desc "version", "Show version"
|
17
15
|
def version
|
18
16
|
puts "Spiker version #{Spiker::VERSION}"
|
19
17
|
end
|
20
18
|
|
21
19
|
desc "simple NAME", "Spike in a single file"
|
22
|
-
|
23
|
-
|
24
|
-
Spiker::Generators::Simple.start([name])
|
20
|
+
def simple(spike_name)
|
21
|
+
Spiker::Generators::Simple.new([spike_name], generator_options).invoke_all
|
25
22
|
end
|
26
23
|
|
27
24
|
desc "given NAME", "Spike in a single file using Given syntax"
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
def given(spike_name)
|
26
|
+
Spiker::Generators::Given.new([spike_name], generator_options).invoke_all
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "multi NAME", "Spike using Minitest over multiple files"
|
30
|
+
def multi(spike_name)
|
31
|
+
Spiker::Generators::Multi.new([spike_name], generator_options).invoke_all
|
31
32
|
end
|
32
33
|
|
33
|
-
desc "
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
desc "rspec NAME", "Spike using Rspec over multiple files"
|
35
|
+
def rspec(spike_name)
|
36
|
+
Spiker::Generators::Rspec.new([spike_name], generator_options).invoke_all
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def generator_options
|
42
|
+
{
|
43
|
+
skip_bundle: options[:skip_bundle],
|
44
|
+
skip_git: options[:skip_git],
|
45
|
+
skip_docker: options[:skip_docker]
|
46
|
+
}
|
37
47
|
end
|
38
48
|
end
|
39
49
|
end
|
@@ -1,46 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "thor/group"
|
4
|
-
require_relative "../../spiker"
|
5
|
-
|
6
3
|
module Spiker
|
7
4
|
module Generators
|
8
5
|
# Generates a single spike file, with supporting infrastructure.
|
9
6
|
# For simpler spikes that don't need a ton of organization.
|
10
|
-
class
|
11
|
-
include Thor::Actions
|
12
|
-
|
13
|
-
argument :name, type: :string
|
14
|
-
|
15
|
-
def self.source_root
|
16
|
-
"#{File.dirname(__FILE__)}/templates/given"
|
17
|
-
end
|
18
|
-
|
19
|
-
def create_spike_directory
|
20
|
-
empty_directory(name)
|
21
|
-
end
|
22
|
-
|
7
|
+
class Given < BaseGenerator
|
23
8
|
def create_spike_file
|
24
|
-
opts = { name_as_class: Spiker.classify(
|
25
|
-
template("app.rb.
|
26
|
-
end
|
27
|
-
|
28
|
-
def create_guard_file
|
29
|
-
template("guardfile.rb", "#{name}/Guardfile")
|
30
|
-
end
|
31
|
-
|
32
|
-
def create_gem_file
|
33
|
-
template("gemfile.rb", "#{name}/Gemfile")
|
34
|
-
end
|
35
|
-
|
36
|
-
def create_env_file
|
37
|
-
template("../common/basic.env", "#{name}/.env")
|
38
|
-
end
|
39
|
-
|
40
|
-
def run_bundler
|
41
|
-
inside(name) do
|
42
|
-
run("bundle install")
|
43
|
-
end
|
9
|
+
opts = { name_as_class: Spiker.classify(spike_name) }
|
10
|
+
template("#{generator_name}/app.rb.tt", "#{spike_name}/app.rb", opts)
|
44
11
|
end
|
45
12
|
end
|
46
13
|
end
|
@@ -1,67 +1,42 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "thor/group"
|
4
|
-
require_relative "../../spiker"
|
5
|
-
|
6
3
|
module Spiker
|
7
4
|
module Generators
|
8
5
|
# Generates multiple spike files, seperating tests from the
|
9
6
|
# tested code. For when the spike gets too hairy for a single
|
10
7
|
# file.
|
11
|
-
class Multi <
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def self.source_root
|
17
|
-
"#{File.dirname(__FILE__)}/templates/multi"
|
18
|
-
end
|
19
|
-
|
20
|
-
def create_spike_directories
|
21
|
-
empty_directory(name)
|
22
|
-
empty_directory("#{name}/lib")
|
23
|
-
empty_directory("#{name}/test")
|
24
|
-
end
|
25
|
-
|
26
|
-
def create_test_files
|
27
|
-
name_in_snake_case = Spiker.snake_case(name)
|
28
|
-
name_as_class = Spiker.classify(name)
|
29
|
-
opts = { name_as_class:, name_in_snake_case: }
|
30
|
-
template("app_test.rb.erb", "#{name}/test/#{name_in_snake_case}_test.rb", opts)
|
31
|
-
template("test_helper.rb", "#{name}/test/test_helper.rb", opts)
|
8
|
+
class Multi < BaseGenerator
|
9
|
+
def create_additional_spike_directories
|
10
|
+
empty_directory("#{spike_name}/lib")
|
11
|
+
empty_directory("#{spike_name}/test")
|
32
12
|
end
|
33
13
|
|
34
14
|
def create_app_files
|
35
|
-
|
36
|
-
|
37
|
-
template("app.rb.erb", "#{name}/lib/#{name_in_snake_case}.rb", opts)
|
38
|
-
end
|
39
|
-
|
40
|
-
def create_guard_file
|
41
|
-
template("guardfile.rb", "#{name}/Guardfile")
|
15
|
+
template("#{generator_name}/app.rb.tt",
|
16
|
+
"#{spike_name}/lib/#{multi_options[:name_in_snake_case]}.rb", multi_options)
|
42
17
|
end
|
43
18
|
|
44
|
-
def
|
45
|
-
template("
|
19
|
+
def create_test_files
|
20
|
+
template("#{generator_name}/app_test.rb.tt",
|
21
|
+
"#{spike_name}/test/#{multi_options[:name_in_snake_case]}_test.rb", multi_options)
|
22
|
+
template("#{generator_name}/test_helper.rb.tt", "#{spike_name}/test/test_helper.rb", multi_options)
|
46
23
|
end
|
47
24
|
|
48
25
|
def create_rake_file
|
49
|
-
template("
|
26
|
+
template("#{generator_name}/Rakefile.tt", "#{spike_name}/Rakefile")
|
50
27
|
end
|
51
28
|
|
52
29
|
def create_readme_file
|
53
|
-
|
54
|
-
template("readme.md.erb", "#{name}/README.md", opts)
|
30
|
+
template("#{generator_name}/README.md.tt", "#{spike_name}/README.md", multi_options)
|
55
31
|
end
|
56
32
|
|
57
|
-
|
58
|
-
template("../common/basic.env", "#{name}/.env")
|
59
|
-
end
|
33
|
+
private
|
60
34
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
|
35
|
+
def multi_options
|
36
|
+
@multi_options ||= {
|
37
|
+
name_as_class: Spiker.classify(spike_name),
|
38
|
+
name_in_snake_case: Spiker.snake_case(spike_name)
|
39
|
+
}
|
65
40
|
end
|
66
41
|
end
|
67
42
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spiker
|
4
|
+
module Generators
|
5
|
+
# Generates multiple spike files, seperating specs from the
|
6
|
+
# tested code. For when the spike gets too hairy for a single
|
7
|
+
# file.
|
8
|
+
class Rspec < BaseGenerator
|
9
|
+
def create_additional_spike_directories
|
10
|
+
empty_directory("#{spike_name}/lib")
|
11
|
+
empty_directory("#{spike_name}/spec")
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_app_files
|
15
|
+
template("#{generator_name}/app.rb.tt",
|
16
|
+
"#{spike_name}/lib/#{spec_options[:name_in_snake_case]}.rb", spec_options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_test_files
|
20
|
+
template("#{generator_name}/app_spec.rb.tt",
|
21
|
+
"#{spike_name}/spec/#{spec_options[:name_in_snake_case]}_spec.rb", spec_options)
|
22
|
+
template("#{generator_name}/spec_helper.rb.tt", "#{spike_name}/spec/spec_helper.rb", spec_options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_rake_file
|
26
|
+
template("#{generator_name}/Rakefile.tt", "#{spike_name}/Rakefile")
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_readme_file
|
30
|
+
template("#{generator_name}/README.md.tt", "#{spike_name}/README.md", spec_options)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def spec_options
|
36
|
+
@spec_options ||= {
|
37
|
+
name_as_class: Spiker.classify(spike_name),
|
38
|
+
name_in_snake_case: Spiker.snake_case(spike_name)
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,46 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "thor/group"
|
4
|
-
require_relative "../../spiker"
|
5
|
-
|
6
3
|
module Spiker
|
7
4
|
module Generators
|
8
5
|
# Generates a single spike file, with supporting infrastructure.
|
9
6
|
# For simpler spikes that don't need a ton of organization.
|
10
|
-
class Simple <
|
11
|
-
include Thor::Actions
|
12
|
-
|
13
|
-
argument :name, type: :string
|
14
|
-
|
15
|
-
def self.source_root
|
16
|
-
"#{File.dirname(__FILE__)}/templates/simple"
|
17
|
-
end
|
18
|
-
|
19
|
-
def create_spike_directory
|
20
|
-
empty_directory(name)
|
21
|
-
end
|
22
|
-
|
7
|
+
class Simple < BaseGenerator
|
23
8
|
def create_spike_file
|
24
|
-
opts = { name_as_class: Spiker.classify(
|
25
|
-
template("app.rb.
|
26
|
-
end
|
27
|
-
|
28
|
-
def create_guard_file
|
29
|
-
template("guardfile.rb", "#{name}/Guardfile")
|
30
|
-
end
|
31
|
-
|
32
|
-
def create_gem_file
|
33
|
-
template("gemfile.rb", "#{name}/Gemfile")
|
34
|
-
end
|
35
|
-
|
36
|
-
def create_env_file
|
37
|
-
template("../common/basic.env", "#{name}/.env")
|
38
|
-
end
|
39
|
-
|
40
|
-
def run_bundler
|
41
|
-
inside(name) do
|
42
|
-
run("bundle install")
|
43
|
-
end
|
9
|
+
opts = { name_as_class: Spiker.classify(spike_name) }
|
10
|
+
template("#{generator_name}/app.rb.tt", "#{spike_name}/app.rb", opts)
|
44
11
|
end
|
45
12
|
end
|
46
13
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
FROM ruby:3.4.3-slim
|
2
|
+
|
3
|
+
# Set working directory
|
4
|
+
WORKDIR /usr/src/app
|
5
|
+
|
6
|
+
# Install dependencies (e.g., node, if needed by Guard or other tools)
|
7
|
+
RUN apt-get update -qq && apt-get install -y \
|
8
|
+
build-essential
|
9
|
+
|
10
|
+
# Copy Gemfiles first to install gems separately (cache layer)
|
11
|
+
COPY Gemfile* ./
|
12
|
+
RUN bundle install
|
13
|
+
|
14
|
+
# Copy rest of your project files
|
15
|
+
COPY . .
|
16
|
+
|
17
|
+
# Set entrypoint to Bash for dev container
|
18
|
+
CMD [ "bash" ]
|
@@ -5,10 +5,13 @@ source "https://rubygems.org"
|
|
5
5
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
6
|
|
7
7
|
gem "minitest"
|
8
|
-
gem "minitest-reporters"
|
9
8
|
gem "minitest-given"
|
9
|
+
gem "minitest-reporters"
|
10
10
|
|
11
11
|
gem "guard"
|
12
12
|
gem "guard-minitest"
|
13
13
|
|
14
14
|
gem "dotenv"
|
15
|
+
|
16
|
+
gem "rubocop"
|
17
|
+
gem "ruby-lsp"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dotenv/load"
|
4
|
+
require "minitest"
|
5
|
+
require "minitest/autorun"
|
6
|
+
require "minitest/reporters"
|
7
|
+
require "minitest/given"
|
8
|
+
|
9
|
+
Minitest::Reporters.use!
|
10
|
+
|
11
|
+
# Test for the class that's also defined in this file (look below).
|
12
|
+
# The two tests here are just "smoke tests" to make sure everything
|
13
|
+
# is wired up correctly. From the command line, run:
|
14
|
+
# $ bundle exec guard
|
15
|
+
describe "When Initializing a <%= config[:name_as_class] %>" do
|
16
|
+
context "Named Fred" do
|
17
|
+
Given(:fred) { <%= config[:name_as_class] %>.new(name: "Fred") }
|
18
|
+
Then {
|
19
|
+
expect(fred.name).must_equal "Fred"
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Spike your ideas here.
|
25
|
+
class <%= config[:name_as_class] %>
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
def initialize(name:)
|
29
|
+
@name = name
|
30
|
+
end
|
31
|
+
end
|
data/lib/spiker/{generators/templates/multi/app_test.rb.erb → templates/multi/app_test.rb.tt}
RENAMED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "test_helper"
|
4
4
|
|
5
|
-
class <%= config[:name_as_class] %>Test <
|
5
|
+
class <%= config[:name_as_class] %>Test < Minitest::Test
|
6
6
|
def test_default_class_instantiates
|
7
7
|
assert <%= config[:name_as_class] %>.new
|
8
8
|
end
|
@@ -10,4 +10,4 @@ class <%= config[:name_as_class] %>Test < MiniTest::Test
|
|
10
10
|
def test_default_class_responds_to_hello
|
11
11
|
assert_equal "Hello, world!", <%= config[:name_as_class] %>.hello
|
12
12
|
end
|
13
|
-
end
|
13
|
+
end
|
data/lib/spiker/{generators/templates/multi/test_helper.rb → templates/multi/test_helper.rb.tt}
RENAMED
@@ -11,7 +11,7 @@ require "dotenv/load"
|
|
11
11
|
Minitest::Reporters.use!
|
12
12
|
|
13
13
|
# ensure the environment is available
|
14
|
-
class DefaultEnvironmentTest <
|
14
|
+
class DefaultEnvironmentTest < Minitest::Test
|
15
15
|
def test_default_environment
|
16
16
|
assert_equal "test", ENV.fetch("TEST_VALUE", nil)
|
17
17
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# <%= config[:name_as_class] %> Spike
|
2
|
+
|
3
|
+
This is the auto-generated README for the <%= config[:name_as_class] %> spike. This content was generated by the [Spiker](https://github.com/norlinga/spiker) gem.
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This directory is the result of **someone** running the following command on a command line:
|
8
|
+
|
9
|
+
$ gem install spiker
|
10
|
+
$ spiker multi <%= config[:name] %>
|
11
|
+
$ cd <%= config[:name] %>
|
12
|
+
|
13
|
+
Once inside the spike directory, open your favorite text editor and then execute the following command:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
$ guard
|
17
|
+
|
18
|
+
Bundler will have executed once when the spike directory was first created, but it's no problem to run it again (in case the spike directory was shared between machines / environments).
|
19
|
+
|
20
|
+
After starting Guard you should have been greeted with passing tests. You are now ready to start hashing out your spike using specs.
|
21
|
+
|
22
|
+
## Adding to This README
|
23
|
+
|
24
|
+
This README could be a great place to capture findings from your spike. Topics to address in this README might include:
|
25
|
+
|
26
|
+
- what was the initial motivation for this spike?
|
27
|
+
- what is the current state of this spike?
|
28
|
+
- is there a future intention or unrealized goal for this spike?
|
29
|
+
- what was discovered in the course of this spike?
|
30
|
+
- who is involved in this spike?
|
31
|
+
|
32
|
+
## Feel Free to Include Code
|
33
|
+
|
34
|
+
Embedding code in a Markdown file is easy - this README uses the triple backtick syntax. The following code will be rendered as a Ruby code block:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
require 'dotenv'
|
38
|
+
|
39
|
+
puts ENV["TEST_VALUE"]
|
40
|
+
|
41
|
+
"maybe show some code in your README?".capitalize
|
42
|
+
```
|
43
|
+
|
44
|
+
Spikes are intended to be short lived, but that's no reason to skip proper practices in your spike development. Have fun!
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rspec"
|
4
|
+
require "dotenv/load"
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
7
|
+
require "<%= config[:name_in_snake_case] %>"
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
11
|
+
config.disable_monkey_patching!
|
12
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dotenv/load"
|
4
|
+
require "minitest"
|
5
|
+
require "minitest/autorun"
|
6
|
+
require "minitest/reporters"
|
7
|
+
|
8
|
+
Minitest::Reporters.use!
|
9
|
+
|
10
|
+
# Test for the class that's also defined in this file (look below).
|
11
|
+
# The two tests here are just "smoke tests" to make sure everything
|
12
|
+
# is wired up correctly. From the command line, run:
|
13
|
+
# $ bundle exec guard
|
14
|
+
class <%= config[:name_as_class] %>Test < Minitest::Test
|
15
|
+
def test_name
|
16
|
+
assert_equal "Fred", <%= config[:name_as_class] %>.new(name: "Fred").name
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_default_env_value
|
20
|
+
assert_equal "test", ENV.fetch("TEST_VALUE", nil)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Spike your ideas here.
|
25
|
+
class <%= config[:name_as_class] %>
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
def initialize(name:)
|
29
|
+
@name = name
|
30
|
+
end
|
31
|
+
end
|
data/lib/spiker/utils.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# methods used in the generators
|
4
|
+
module Spiker
|
5
|
+
def self.classify(str)
|
6
|
+
str.split(/[^A-Za-z0-0]/).map(&:capitalize).join
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.snake_case(str)
|
10
|
+
# lifted from ActiveSupport inflectors
|
11
|
+
str.gsub("::", "/")
|
12
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
13
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
14
|
+
.tr("-", "_")
|
15
|
+
.downcase
|
16
|
+
end
|
17
|
+
end
|
data/lib/spiker/version.rb
CHANGED
data/lib/spiker.rb
CHANGED
@@ -1,21 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require "thor"
|
4
|
+
require "thor/group"
|
5
|
+
|
6
|
+
require "spiker/version"
|
7
|
+
require "spiker/utils"
|
8
|
+
require "spiker/base_generator"
|
9
|
+
require "spiker/generators/simple"
|
10
|
+
require "spiker/generators/given"
|
11
|
+
require "spiker/generators/multi"
|
12
|
+
require "spiker/generators/rspec"
|
13
|
+
require "spiker/cli"
|
4
14
|
|
5
15
|
# Spiker is a simple spike generator.
|
6
16
|
module Spiker
|
7
17
|
class Error < StandardError; end
|
8
|
-
|
9
|
-
def self.classify(str)
|
10
|
-
str.split(/[^A-Za-z0-0]/).map(&:capitalize).join
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.snake_case(str)
|
14
|
-
# lifted from ActiveSupport inflectors
|
15
|
-
str.gsub("::", "/")
|
16
|
-
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
17
|
-
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
18
|
-
.tr("-", "_")
|
19
|
-
.downcase
|
20
|
-
end
|
21
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spiker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Norling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -33,39 +33,40 @@ executables:
|
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
35
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
36
|
- exe/spiker
|
48
37
|
- lib/spiker.rb
|
38
|
+
- lib/spiker/base_generator.rb
|
49
39
|
- lib/spiker/cli.rb
|
50
40
|
- lib/spiker/generators/given.rb
|
51
41
|
- lib/spiker/generators/multi.rb
|
42
|
+
- lib/spiker/generators/rspec.rb
|
52
43
|
- lib/spiker/generators/simple.rb
|
53
|
-
- lib/spiker/
|
54
|
-
- lib/spiker/
|
55
|
-
- lib/spiker/
|
56
|
-
- lib/spiker/
|
57
|
-
- lib/spiker/
|
58
|
-
- lib/spiker/
|
59
|
-
- lib/spiker/
|
60
|
-
- lib/spiker/
|
61
|
-
- lib/spiker/
|
62
|
-
- lib/spiker/
|
63
|
-
- lib/spiker/
|
64
|
-
- lib/spiker/
|
65
|
-
- lib/spiker/
|
66
|
-
- lib/spiker/
|
44
|
+
- lib/spiker/templates/common/Dockerfile.tt
|
45
|
+
- lib/spiker/templates/common/Makefile.tt
|
46
|
+
- lib/spiker/templates/common/basic.env.tt
|
47
|
+
- lib/spiker/templates/common/docker-compose.yml.tt
|
48
|
+
- lib/spiker/templates/given/Gemfile.tt
|
49
|
+
- lib/spiker/templates/given/Guardfile.tt
|
50
|
+
- lib/spiker/templates/given/app.rb.tt
|
51
|
+
- lib/spiker/templates/multi/Gemfile.tt
|
52
|
+
- lib/spiker/templates/multi/Guardfile.tt
|
53
|
+
- lib/spiker/templates/multi/README.md.tt
|
54
|
+
- lib/spiker/templates/multi/Rakefile.tt
|
55
|
+
- lib/spiker/templates/multi/app.rb.tt
|
56
|
+
- lib/spiker/templates/multi/app_test.rb.tt
|
57
|
+
- lib/spiker/templates/multi/test_helper.rb.tt
|
58
|
+
- lib/spiker/templates/rspec/Gemfile.tt
|
59
|
+
- lib/spiker/templates/rspec/Guardfile.tt
|
60
|
+
- lib/spiker/templates/rspec/README.md.tt
|
61
|
+
- lib/spiker/templates/rspec/Rakefile.tt
|
62
|
+
- lib/spiker/templates/rspec/app.rb.tt
|
63
|
+
- lib/spiker/templates/rspec/app_spec.rb.tt
|
64
|
+
- lib/spiker/templates/rspec/spec_helper.rb.tt
|
65
|
+
- lib/spiker/templates/simple/Gemfile.tt
|
66
|
+
- lib/spiker/templates/simple/Guardfile.tt
|
67
|
+
- lib/spiker/templates/simple/app.rb.tt
|
68
|
+
- lib/spiker/utils.rb
|
67
69
|
- lib/spiker/version.rb
|
68
|
-
- spiker.gemspec
|
69
70
|
homepage: http://github.com/norlinga/spiker
|
70
71
|
licenses:
|
71
72
|
- MIT
|
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
90
|
- !ruby/object:Gem::Version
|
90
91
|
version: '0'
|
91
92
|
requirements: []
|
92
|
-
rubygems_version: 3.5.
|
93
|
+
rubygems_version: 3.5.9
|
93
94
|
signing_key:
|
94
95
|
specification_version: 4
|
95
96
|
summary: Properly spike your Ruby
|
data/.circleci/config.yml
DELETED
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,16 +0,0 @@
|
|
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
|
-
- 'exe/spiker'
|
16
|
-
- 'spiker.gemspec'
|
data/Gemfile
DELETED
@@ -1,20 +0,0 @@
|
|
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
|
-
group :development, :test do
|
11
|
-
gem "minitest", "~> 5.0"
|
12
|
-
gem "minitest-reporters", "~> 1.0"
|
13
|
-
|
14
|
-
gem "guard", "~> 2.18.0"
|
15
|
-
gem "guard-minitest", "~> 2.4.0"
|
16
|
-
|
17
|
-
gem "rubocop", "~> 1.60"
|
18
|
-
end
|
19
|
-
|
20
|
-
gem "thor", "~> 1.3"
|
data/Gemfile.lock
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
spiker (0.1.5)
|
5
|
-
thor (~> 1.3)
|
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.16.3)
|
15
|
-
formatador (1.1.0)
|
16
|
-
guard (2.18.1)
|
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
|
-
json (2.7.1)
|
30
|
-
language_server-protocol (3.17.0.3)
|
31
|
-
listen (3.8.0)
|
32
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
33
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
34
|
-
lumberjack (1.2.10)
|
35
|
-
method_source (1.0.0)
|
36
|
-
minitest (5.21.2)
|
37
|
-
minitest-reporters (1.6.1)
|
38
|
-
ansi
|
39
|
-
builder
|
40
|
-
minitest (>= 5.0)
|
41
|
-
ruby-progressbar
|
42
|
-
nenv (0.3.0)
|
43
|
-
notiffany (0.1.3)
|
44
|
-
nenv (~> 0.1)
|
45
|
-
shellany (~> 0.0)
|
46
|
-
parallel (1.24.0)
|
47
|
-
parser (3.3.0.5)
|
48
|
-
ast (~> 2.4.1)
|
49
|
-
racc
|
50
|
-
pry (0.14.2)
|
51
|
-
coderay (~> 1.1)
|
52
|
-
method_source (~> 1.0)
|
53
|
-
racc (1.7.3)
|
54
|
-
rainbow (3.1.1)
|
55
|
-
rake (13.1.0)
|
56
|
-
rb-fsevent (0.11.2)
|
57
|
-
rb-inotify (0.10.1)
|
58
|
-
ffi (~> 1.0)
|
59
|
-
regexp_parser (2.9.0)
|
60
|
-
rexml (3.2.6)
|
61
|
-
rubocop (1.60.2)
|
62
|
-
json (~> 2.3)
|
63
|
-
language_server-protocol (>= 3.17.0)
|
64
|
-
parallel (~> 1.10)
|
65
|
-
parser (>= 3.3.0.2)
|
66
|
-
rainbow (>= 2.2.2, < 4.0)
|
67
|
-
regexp_parser (>= 1.8, < 3.0)
|
68
|
-
rexml (>= 3.2.5, < 4.0)
|
69
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
70
|
-
ruby-progressbar (~> 1.7)
|
71
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
72
|
-
rubocop-ast (1.30.0)
|
73
|
-
parser (>= 3.2.1.0)
|
74
|
-
ruby-progressbar (1.13.0)
|
75
|
-
shellany (0.0.1)
|
76
|
-
thor (1.3.0)
|
77
|
-
unicode-display_width (2.5.0)
|
78
|
-
|
79
|
-
PLATFORMS
|
80
|
-
ruby
|
81
|
-
x86_64-linux
|
82
|
-
|
83
|
-
DEPENDENCIES
|
84
|
-
guard (~> 2.18.0)
|
85
|
-
guard-minitest (~> 2.4.0)
|
86
|
-
minitest (~> 5.0)
|
87
|
-
minitest-reporters (~> 1.0)
|
88
|
-
rake (~> 13.0)
|
89
|
-
rubocop (~> 1.60)
|
90
|
-
spiker!
|
91
|
-
thor (~> 1.3)
|
92
|
-
|
93
|
-
BUNDLED WITH
|
94
|
-
2.5.5
|
data/Guardfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2022-2024 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
DELETED
@@ -1,77 +0,0 @@
|
|
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 their Ruby code.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
[](https://badge.fury.io/rb/spiker)
|
8
|
-
|
9
|
-
Install it directly:
|
10
|
-
|
11
|
-
$ gem install spiker
|
12
|
-
|
13
|
-
## Usage
|
14
|
-
|
15
|
-
In the terminal, change directory to someplace where you want to collect your spikes:
|
16
|
-
|
17
|
-
$ cd ~/spikes
|
18
|
-
|
19
|
-
Then, create a new spike:
|
20
|
-
|
21
|
-
$ spiker simple my_spike
|
22
|
-
$ cd my_spike
|
23
|
-
|
24
|
-
Using the "simple" formula, Spiker will create an `app.rb` file, a `Gemfile`, a `Guardfile` and an `.env` file for configuration, to be read by the `dotenv` gem. The `app.rb` file will contain boilerplate for both Minitest and a Ruby class in the same file:
|
25
|
-
|
26
|
-
```ruby
|
27
|
-
require 'dotenv/load'
|
28
|
-
require 'minitest'
|
29
|
-
require 'minitest/autorun'
|
30
|
-
require 'minitest/reporters'
|
31
|
-
|
32
|
-
Minitest::Reporters.use!
|
33
|
-
|
34
|
-
class MySpikeTest < Minitest::Test
|
35
|
-
def test_name
|
36
|
-
assert_equal "Fred", MySpike.new(name: "Fred").name
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_default_env_value
|
40
|
-
assert_equal "test", ENV["TEST_VALUE"]
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
class MySpike
|
45
|
-
attr_accessor :name
|
46
|
-
def initialize(name:)
|
47
|
-
@name = name
|
48
|
-
end
|
49
|
-
end
|
50
|
-
```
|
51
|
-
|
52
|
-
From here, the user should be able to start Guard and immediately begin development in a red-green fashion.
|
53
|
-
|
54
|
-
## Types of Spikes
|
55
|
-
|
56
|
-
The `simple` option shown above puts the code and the tests together in a single file, which can be useful in a number of circumstances. Similar to the `simple` option, the `given` option puts the code and tests in the same file but offers the user the Minitest::Spec and ::Given syntax options. Learn more about the [Given/When/Then](https://en.wikipedia.org/wiki/Given-When-Then) syntax on Wikipedia, or the work of Jim Weirich related to Rspec with [Given](https://github.com/jimweirich/rspec-given).
|
57
|
-
|
58
|
-
The `multi` option places directories and files into a named directory, and is intended to flesh out a more complex spike that includes a tests directory and `test_helper.rb`, a `lib` directory, README.md, etc. The overall workflow is still the same:
|
59
|
-
|
60
|
-
$ spiker multi my_spike
|
61
|
-
$ cd my_spike
|
62
|
-
|
63
|
-
Bundle will run automatically and the user will be able to start development in a red-green fashion just the same as with the simple spike. There is also a Rakefile provided, the Guardfile is modified from the simple version to include files in directories, and simple tests are predefined.
|
64
|
-
|
65
|
-
## Development
|
66
|
-
|
67
|
-
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.
|
68
|
-
|
69
|
-
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).
|
70
|
-
|
71
|
-
## Contributing
|
72
|
-
|
73
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/norlinga/spiker.
|
74
|
-
|
75
|
-
## License
|
76
|
-
|
77
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
DELETED
@@ -1,16 +0,0 @@
|
|
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
DELETED
@@ -1,15 +0,0 @@
|
|
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
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'dotenv/load'
|
2
|
-
require 'minitest'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'minitest/reporters'
|
5
|
-
require 'minitest/given'
|
6
|
-
|
7
|
-
Minitest::Reporters.use!
|
8
|
-
|
9
|
-
describe 'When Initializing a <%= config[:name_as_class] %>' do
|
10
|
-
context 'Named Fred' do
|
11
|
-
Given(:fred) { <%= config[:name_as_class] %>.new(name: 'Fred') }
|
12
|
-
Then {
|
13
|
-
expect(fred.name).must_equal 'Fred'
|
14
|
-
}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class <%= config[:name_as_class] %>
|
19
|
-
attr_accessor :name
|
20
|
-
def initialize(name:)
|
21
|
-
@name = name
|
22
|
-
end
|
23
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'dotenv/load'
|
2
|
-
require 'minitest'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'minitest/reporters'
|
5
|
-
|
6
|
-
Minitest::Reporters.use!
|
7
|
-
|
8
|
-
class <%= config[:name_as_class] %>Test < Minitest::Test
|
9
|
-
def test_name
|
10
|
-
assert_equal "Fred", <%= config[:name_as_class] %>.new(name: 'Fred').name
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_default_env_value
|
14
|
-
assert_equal "test", ENV["TEST_VALUE"]
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class <%= config[:name_as_class] %>
|
19
|
-
attr_accessor :name
|
20
|
-
def initialize(name:)
|
21
|
-
@name = name
|
22
|
-
end
|
23
|
-
end
|
data/spiker.gemspec
DELETED
@@ -1,37 +0,0 @@
|
|
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/norlinga/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", "~> 1.3"
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|