spiker 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 907101e30efff6e0426d45830d7907599b4ee590b7415381d6515e610a454beb
4
- data.tar.gz: 8befa5bc352c113c415e9ca223c4a24549213196a748dca6ee543d911b04b830
3
+ metadata.gz: f6183b45c44cffdac7e55a8cc487634185d550b98b88802d331e66b4d19e5159
4
+ data.tar.gz: c96d176df0f11614308af344020b8a3b546e291fcb0dc94b7c97724867a9a6e5
5
5
  SHA512:
6
- metadata.gz: '09045548a1f614957922c597fe54ece30bf8a76cbf26dcfb59c54d3b57230f3cd6deb80e3c73370dadd8628a6fa775a8dd076049590e4bb7efdfc6f7f24a8dfb'
7
- data.tar.gz: 21279e2734fd077c48a9414554139b1adc9adb757dc7d629fb76da27cb60a7ad78f9d4f6434502e83138dd35dab6565ab9139bc89e73908c6dcac2fe3acb5cd6
6
+ metadata.gz: 61065d34c4b29b1f541ec91274d326536f3952f2e94ed4efad1863bcf81b2eb2b335d140eb9eb2b38ed866ead8bcb213e7b6eff536dc7e71dfe8f9e41507c8a0
7
+ data.tar.gz: fc2d21d8670e09eb8acd314ae5e75c6caf57f6b880e02cc4becebfab2c6d439bb937da3abf464cc22b8a6d34fcad2fdd380a115ebe14706d9d890f168ab89d0e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spiker (0.1.3)
4
+ spiker (0.1.4)
5
5
  thor (~> 0.19)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,22 +1,12 @@
1
1
  # Spiker
2
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.
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
4
 
5
5
  ## Installation
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/spiker.svg)](https://badge.fury.io/rb/spiker)
8
8
 
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'spiker'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
9
+ Install it directly:
20
10
 
21
11
  $ gem install spiker
22
12
 
@@ -31,9 +21,10 @@ Then, create a new spike:
31
21
  $ spiker simple my_spike
32
22
  $ cd my_spike
33
23
 
34
- 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:
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:
35
25
 
36
26
  ```ruby
27
+ require 'dotenv'
37
28
  require 'minitest'
38
29
  require 'minitest/autorun'
39
30
  require 'minitest/reporters'
@@ -41,8 +32,12 @@ require 'minitest/reporters'
41
32
  Minitest::Reporters.use!
42
33
 
43
34
  class MySpikeTest < Minitest::Test
44
- def test_that_it_works
45
- assert true
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"]
46
41
  end
47
42
  end
48
43
 
data/lib/spiker/cli.rb CHANGED
@@ -6,8 +6,8 @@ require_relative "generators/simple"
6
6
  require_relative "generators/multi"
7
7
 
8
8
  module Spiker
9
- # Accept options "single" and "multiple"
10
- # for single file spikes or multi-file spikes
9
+ # Accept options "single" and "multi"
10
+ # for single-file spikes or multi-file spikes
11
11
  # and a name for the spike directory. That is all
12
12
  class CLI < Thor
13
13
  desc "version", "Show version"
@@ -49,6 +49,15 @@ module Spiker
49
49
  template("multi_rakefile.rb", "#{name}/Rakefile")
50
50
  end
51
51
 
52
+ def create_readme_file
53
+ opts = { name_as_class: Spiker.classify(name), name: name }
54
+ template("multi_readme.md.erb", "#{name}/README.md", opts)
55
+ end
56
+
57
+ def create_env_file
58
+ template("basic.env", "#{name}/.env")
59
+ end
60
+
52
61
  def run_bundler
53
62
  inside(name) do
54
63
  run("bundle install")
@@ -33,6 +33,10 @@ module Spiker
33
33
  template("simple_gemfile.rb", "#{name}/Gemfile")
34
34
  end
35
35
 
36
+ def create_env_file
37
+ template("basic.env", "#{name}/.env")
38
+ end
39
+
36
40
  def run_bundler
37
41
  inside(name) do
38
42
  run("bundle install")
@@ -0,0 +1 @@
1
+ TEST_VALUE="test"
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "dotenv/load"
4
+
3
5
  class <%= config[:name_as_class] %>
4
6
  def self.hello
5
7
  "Hello, world!"
@@ -8,3 +8,4 @@ gem "minitest"
8
8
  gem "minitest-reporters"
9
9
  gem "guard"
10
10
  gem "guard-minitest"
11
+ gem "dotenv"
@@ -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 under test.
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!
@@ -6,5 +6,13 @@ require "<%= config[:name_in_snake_case] %>"
6
6
 
7
7
  require "minitest/autorun"
8
8
  require "minitest/reporters"
9
+ require "dotenv/load"
9
10
 
10
11
  Minitest::Reporters.use!
12
+
13
+ # ensure the environment is available
14
+ class DefaultEnvironmentTest < MiniTest::Unit::TestCase
15
+ def test_default_environment
16
+ assert_equal "test", ENV["TEST_VALUE"]
17
+ end
18
+ end
@@ -1,3 +1,4 @@
1
+ require 'dotenv/load'
1
2
  require 'minitest'
2
3
  require 'minitest/autorun'
3
4
  require 'minitest/reporters'
@@ -5,8 +6,12 @@ require 'minitest/reporters'
5
6
  Minitest::Reporters.use!
6
7
 
7
8
  class <%= config[:name_as_class] %>Test < Minitest::Test
8
- def test_that_it_works
9
- assert true
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"]
10
15
  end
11
16
  end
12
17
 
@@ -9,3 +9,5 @@ gem "minitest-reporters"
9
9
 
10
10
  gem "guard"
11
11
  gem "guard-minitest"
12
+
13
+ gem "dotenv"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spiker
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Norling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-23 00:00:00.000000000 Z
11
+ date: 2022-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -49,11 +49,13 @@ files:
49
49
  - lib/spiker/cli.rb
50
50
  - lib/spiker/generators/multi.rb
51
51
  - lib/spiker/generators/simple.rb
52
+ - lib/spiker/generators/templates/basic.env
52
53
  - lib/spiker/generators/templates/multi_app.rb.erb
53
54
  - lib/spiker/generators/templates/multi_app_test.rb.erb
54
55
  - lib/spiker/generators/templates/multi_gemfile.rb
55
56
  - lib/spiker/generators/templates/multi_guardfile.rb
56
57
  - lib/spiker/generators/templates/multi_rakefile.rb
58
+ - lib/spiker/generators/templates/multi_readme.md.erb
57
59
  - lib/spiker/generators/templates/multi_test_helper.rb
58
60
  - lib/spiker/generators/templates/simple_app.rb.erb
59
61
  - lib/spiker/generators/templates/simple_gemfile.rb