singer 2.0.0 → 2.2.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 +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +6 -2
- data/lib/singer/paths.rb +6 -1
- data/lib/singer/version.rb +1 -1
- data/templates/sinatra_app/test/{test_autoloading.rb → autoloading_test.rb} +1 -1
- data/templates/sinatra_app/test/{test_hello.rb → hello_test.rb} +1 -1
- data/templates/sinatra_app/test/server/{test_server_error_dumping.rb → server_error_dumping_test.rb} +1 -1
- data/templates/sinatra_app/test/server/{test_server.rb → server_test.rb} +1 -1
- data/templates/tdd/test/{test___PROJECT_NAME_SNAKECASE__.rb → __PROJECT_NAME_SNAKECASE___test.rb} +1 -1
- data/templates/test/test/__PROJECT_NAME_SNAKECASE___test.rb +9 -0
- metadata +10 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1496a866af8bd84f5f37b7fd231ebca183cb1af9527c80fcf82d7d12e559ae60
|
|
4
|
+
data.tar.gz: d162ae6671bde936f13594d4a9ce989179d207f96a92eb3a24496f5db5116fe6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 475541c7ea0a9c63f64eb9ee72c8267b0e4eb9f3aa9e240587e37010077123a8dc3e7ab2005c0bea4a7bd0849ec088879d4acb6967ebad766ab829e1b093d26c
|
|
7
|
+
data.tar.gz: c2cb1b56b6b65d644a844c7305ebf1fa2158d221bce249d1f9cd8970273709f0578df79c2307d89037fa45a57912ccc0a4b6341395ff6e16c651ede61823c57d
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -19,13 +19,17 @@ For `PROJECT_NAME`, using `snake_case` is best, although an attempt will be made
|
|
|
19
19
|
|
|
20
20
|
## Writing your own templates
|
|
21
21
|
|
|
22
|
-
Many features of Singer will become clearer when seeing actual usage - please feel encouraged to examine the templates shipped with the gem (you can find them in `templates_from_gem` shown by the `singer --
|
|
22
|
+
Many features of Singer will become clearer when seeing actual usage - please feel encouraged to examine the templates shipped with the gem (you can find them in `templates_from_gem` shown by the `singer --list-paths`).
|
|
23
23
|
|
|
24
24
|
### Template location
|
|
25
25
|
|
|
26
|
-
User-provided templates should be placed in the directory named `templates_from_user` in the `singer --
|
|
26
|
+
User-provided templates should be placed in the directory named `templates_from_user` in the `singer --list-paths` output.
|
|
27
27
|
Each template resides in a subdirectory - the subdirectory's name becomes the template's name, and is not included in the generated paths (Singer will only replicate the directory structure _inside_ it).
|
|
28
28
|
|
|
29
|
+
### Using templates from somewhere else
|
|
30
|
+
|
|
31
|
+
You can also, instead of the name of a known template via `[TEMPLATE_NAME]`, specify the full path to your custom template with the `--template-path` option.
|
|
32
|
+
|
|
29
33
|
### Variables available to templates
|
|
30
34
|
|
|
31
35
|
Templates written in ERB or other templating mechanisms that execute Ruby code will have access to `Singer.configuration` object and its accessors. For example, the following code in a `my_template`'s file:
|
data/lib/singer/paths.rb
CHANGED
|
@@ -18,7 +18,12 @@ module Singer
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def self.output_path(...)
|
|
21
|
-
File.join(...)
|
|
21
|
+
substitute_variables(File.join(...))
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# will substitute non-forbidden variables, 2 characters or more
|
|
25
|
+
def self.substitute_variables(path)
|
|
26
|
+
path.gsub(/__([[:alpha:]][[:word:]]*[[:alpha:]])__/) do |match|
|
|
22
27
|
potential_config = $1.downcase
|
|
23
28
|
|
|
24
29
|
if variable_name_can_be_substituted?(potential_config)
|
data/lib/singer/version.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'minitest_helper'
|
|
2
2
|
|
|
3
3
|
# TODO: remove
|
|
4
|
-
class
|
|
4
|
+
class HelloTest < Minitest::Test
|
|
5
5
|
def test_greet_with_a_param_generates_a_greeting_string
|
|
6
6
|
assert_equal 'Hello, stranger.', <%= Singer.configuration.project_name_camelcase %>::Hello.greet(:stranger)
|
|
7
7
|
end
|
data/templates/sinatra_app/test/server/{test_server_error_dumping.rb → server_error_dumping_test.rb}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'minitest_helper'
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class ServerErrorDumpingTest < Minitest::Test
|
|
4
4
|
def test_dump_errors_backtrace_is_filtered_against_vendor
|
|
5
5
|
exc = generate_exception_with_realistic_backtrace
|
|
6
6
|
assert exc.backtrace.any?{ _1.include?('/vendor/') } # now you see me
|
data/templates/tdd/test/{test___PROJECT_NAME_SNAKECASE__.rb → __PROJECT_NAME_SNAKECASE___test.rb}
RENAMED
|
@@ -3,7 +3,7 @@ require 'minitest/autorun' if File.expand_path($PROGRAM_NAME) == File.expand_pat
|
|
|
3
3
|
|
|
4
4
|
require_relative '../lib/<%= Singer.configuration.project_name_snakecase %>'
|
|
5
5
|
|
|
6
|
-
class
|
|
6
|
+
class <%= Singer.configuration.project_name_camelcase %>Test < Minitest::Test
|
|
7
7
|
# TEST_INPUT = File.read('input_mini.txt').lines(chomp: true)
|
|
8
8
|
|
|
9
9
|
def setup
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: singer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Emil Chludziński
|
|
@@ -25,7 +25,8 @@ dependencies:
|
|
|
25
25
|
version: '0'
|
|
26
26
|
description: |
|
|
27
27
|
Singer is a highly configurable templating system intended for generating Ruby boilerplate.
|
|
28
|
-
|
|
28
|
+
Its main aim is to make creating and extending Sinatra apps easier.
|
|
29
|
+
It can also be used to generate pretty much any other files from templates, with defined directory structure.
|
|
29
30
|
email:
|
|
30
31
|
- tanstaafl@tlen.pl
|
|
31
32
|
executables:
|
|
@@ -52,17 +53,18 @@ files:
|
|
|
52
53
|
- templates/sinatra_app/lib/__PROJECT_NAME_SNAKECASE__/hello.rb
|
|
53
54
|
- templates/sinatra_app/lib/__PROJECT_NAME_SNAKECASE__/server.rb
|
|
54
55
|
- templates/sinatra_app/lib/zeitwerk_setup.rb
|
|
56
|
+
- templates/sinatra_app/test/autoloading_test.rb
|
|
57
|
+
- templates/sinatra_app/test/hello_test.rb
|
|
55
58
|
- templates/sinatra_app/test/minitest_helper.rb
|
|
56
|
-
- templates/sinatra_app/test/server/
|
|
57
|
-
- templates/sinatra_app/test/server/
|
|
58
|
-
- templates/sinatra_app/test/test_autoloading.rb
|
|
59
|
-
- templates/sinatra_app/test/test_hello.rb
|
|
59
|
+
- templates/sinatra_app/test/server/server_error_dumping_test.rb
|
|
60
|
+
- templates/sinatra_app/test/server/server_test.rb
|
|
60
61
|
- templates/sinatra_app/views/index.haml
|
|
61
62
|
- templates/sinatra_app/views/layout.haml
|
|
62
63
|
- templates/sinatra_app/views/style.sass
|
|
63
64
|
- templates/tdd/Gemfile
|
|
64
65
|
- templates/tdd/lib/__PROJECT_NAME_SNAKECASE__.rb
|
|
65
|
-
- templates/tdd/test/
|
|
66
|
+
- templates/tdd/test/__PROJECT_NAME_SNAKECASE___test.rb
|
|
67
|
+
- templates/test/test/__PROJECT_NAME_SNAKECASE___test.rb
|
|
66
68
|
homepage: https://gitlab.com/tanstaafl/singer/
|
|
67
69
|
licenses:
|
|
68
70
|
- MIT
|
|
@@ -84,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
84
86
|
- !ruby/object:Gem::Version
|
|
85
87
|
version: '0'
|
|
86
88
|
requirements: []
|
|
87
|
-
rubygems_version:
|
|
89
|
+
rubygems_version: 4.0.6
|
|
88
90
|
specification_version: 4
|
|
89
91
|
summary: Singer generates code (such as Sinatra apps) from templates.
|
|
90
92
|
test_files: []
|