ashiba 0.7.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 +7 -0
- data/CHANGELOG.md +17 -0
- data/README.md +77 -0
- data/bin/ashiba +5 -0
- data/lib/ashiba/cli.rb +236 -0
- data/lib/ashiba/configuration.rb +70 -0
- data/lib/ashiba/logger.rb +5 -0
- data/lib/ashiba/template.rb +9 -0
- data/lib/ashiba/template_loader.rb +71 -0
- data/lib/ashiba/version.rb +3 -0
- data/lib/ashiba.rb +6 -0
- data/templates/ashiba-template/%name%.gemspec +18 -0
- data/templates/ashiba-template/CHANGELOG.md +5 -0
- data/templates/ashiba-template/Gemfile +4 -0
- data/templates/ashiba-template/README.md +5 -0
- data/templates/ashiba-template/Rakefile +17 -0
- data/templates/ashiba-template/tasks/gem.rake +27 -0
- data/templates/ashiba-template/templates/example/README.md +7 -0
- data/templates/ashiba-template/templates/example.yaml +15 -0
- data/templates/ashiba-template.yaml +17 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 64048ef4dbc11eb3f67c0a55e952447ae308dc3196fbb641d41e2ce72ab98b6d
|
4
|
+
data.tar.gz: a42654dbf742cb324c5d8e998cb66069a08b355dfdee168307ca3248471f97eb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cfc6ac7386b25658590c49e39ada2e86b988779e2c2516892fabbf2a1932b8d8fe5173594f6d2283b89af8a9bac84d9ef60703e2c25346cd9b24baa59835943e
|
7
|
+
data.tar.gz: 3acfdf76ec99472fa438ec8a857f5bc635ccc33052f7a0a1229d39fa80ca0d3b7355ba4993abccf322a10d1e0be4b7c75260a8b1cae17b7188218cabf8b2eca5
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
## Version 0.8.0
|
6
|
+
|
7
|
+
- Update minimum ruby version to 2.7
|
8
|
+
- Add GitHub Workflows
|
9
|
+
|
10
|
+
## Version 0.7.0
|
11
|
+
|
12
|
+
- Add ability to run commands at the end
|
13
|
+
- Add bump, editorconfig and overcommit
|
14
|
+
|
15
|
+
## Version 0.6.0
|
16
|
+
|
17
|
+
- First public release
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Ashiba
|
2
|
+
|
3
|
+
Ashiba is yet another Ruby-based scaffolding tool. It allows bootstrapping of
|
4
|
+
projects using precreated templates. Templates for projects can be authored
|
5
|
+
as separate Rubygems to allow maximum flexibility and central management.
|
6
|
+
|
7
|
+
Ashiba (足場) is Japanese for scaffolding and meand as a nod towards the
|
8
|
+
Ruby language, which originated in Japan.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Install the tool with
|
13
|
+
|
14
|
+
```bash
|
15
|
+
gem install 'ashiba'
|
16
|
+
```
|
17
|
+
|
18
|
+
## Template Authoring
|
19
|
+
|
20
|
+
A generator for templates is included under the name `ashiba-template`. With
|
21
|
+
this, you can create you own custom generators for Rubygems, Chef Cookbooks
|
22
|
+
or whatever you want.
|
23
|
+
|
24
|
+
Every template has a configuration file in YAML which states some metadata
|
25
|
+
along with the template's variables and their defaults like this:
|
26
|
+
|
27
|
+
```yaml
|
28
|
+
variables:
|
29
|
+
name: ''
|
30
|
+
version: 0.1.0
|
31
|
+
```
|
32
|
+
|
33
|
+
All files within a template are parsed as ERB, so you can substitute
|
34
|
+
things with variables (`<%= name + ' ' + version %>`) or execute Ruby code for
|
35
|
+
looping or anything else (`<% do_something() %>`).
|
36
|
+
|
37
|
+
If you want to use the content of a variable in a filename, just enclose it in
|
38
|
+
percent signs: `%name%.gemspec`.
|
39
|
+
|
40
|
+
All templates are directly configured as Gem file, so you can build them,
|
41
|
+
install them and even publish them to your own private Gem repository or
|
42
|
+
rubygems.org.
|
43
|
+
|
44
|
+
### Final commands
|
45
|
+
|
46
|
+
If you want commands to be executed after scaffolding your project, add them as
|
47
|
+
a list under the `finalize` key of the YAML
|
48
|
+
|
49
|
+
## Configuration
|
50
|
+
|
51
|
+
Ashiba YAML configuration files reside in ~/.ashibarc or in /etc/ashiba/ashibarc.
|
52
|
+
|
53
|
+
You currently can only override template defaults with a file like
|
54
|
+
|
55
|
+
```yaml
|
56
|
+
author: My Name
|
57
|
+
email: name@example.com
|
58
|
+
```
|
59
|
+
|
60
|
+
which will override the author/email variable defaults from the template. So if
|
61
|
+
you have this in your home directory or the system configuration directory,
|
62
|
+
all template executions will default to your name and email.
|
63
|
+
|
64
|
+
## Usage
|
65
|
+
|
66
|
+
`ashiba help` Display all available commands
|
67
|
+
|
68
|
+
`ashiba list` List all available templates on the system
|
69
|
+
|
70
|
+
`ashiba info TEMPLATE` Display metadata about a template
|
71
|
+
|
72
|
+
`ashiba create TEMPLATE PATH [--set variable:value]` Scaffold a package
|
73
|
+
Note that you can manually specify contents of variables. Lookup will happen
|
74
|
+
in order `/etc/ashiba/ashibarc`, `~/.ashibarc`, `--set` value or template
|
75
|
+
default.
|
76
|
+
|
77
|
+
`ashiba version` Output version of Ashiba
|
data/bin/ashiba
ADDED
data/lib/ashiba/cli.rb
ADDED
@@ -0,0 +1,236 @@
|
|
1
|
+
require 'hashie'
|
2
|
+
require 'highline'
|
3
|
+
require 'thor'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
module Ashiba
|
7
|
+
class TemplateVariable
|
8
|
+
attr_accessor :name, :value, :type, :default, :mandatory
|
9
|
+
|
10
|
+
# ok this is bugged
|
11
|
+
def initialize(name = '', value = '', type = 'String', default = '', mandatory = false)
|
12
|
+
@name = name
|
13
|
+
@value = value
|
14
|
+
@type = type
|
15
|
+
@default = default
|
16
|
+
@mandatory = mandatory
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
"#{name}=#{value} of type #{type}, defaulting to #{default} and mandatory is #{mandatory}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Cli < Thor
|
25
|
+
include Thor::Actions
|
26
|
+
check_unknown_options!
|
27
|
+
# add_runtime_options!
|
28
|
+
|
29
|
+
def self.source_root
|
30
|
+
# File.dirname(__FILE__)
|
31
|
+
File.expand_path('../../templates', __dir__)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.exit_on_failure?
|
35
|
+
true
|
36
|
+
end
|
37
|
+
|
38
|
+
map %w[version] => :__print_version
|
39
|
+
desc 'version', 'Display version'
|
40
|
+
def __print_version
|
41
|
+
say "Ashiba #{VERSION} (Ruby #{RUBY_VERSION}-#{RUBY_PLATFORM})"
|
42
|
+
end
|
43
|
+
|
44
|
+
@packdata = {}
|
45
|
+
attr_accessor :packdata
|
46
|
+
|
47
|
+
@config = {}
|
48
|
+
attr_accessor :config
|
49
|
+
|
50
|
+
no_commands do
|
51
|
+
def get_data_from_template(name)
|
52
|
+
TemplateLoader.new.load_template(name)
|
53
|
+
end
|
54
|
+
|
55
|
+
def load_data_from_userconfig
|
56
|
+
@config = Configuration.new
|
57
|
+
@config.load
|
58
|
+
end
|
59
|
+
|
60
|
+
# @todo
|
61
|
+
@template_information = {}
|
62
|
+
def process_template_information(template)
|
63
|
+
template_info = get_data_from_template(template)
|
64
|
+
template_info = template_info.delete('variables')
|
65
|
+
@template_information = Hashie::Mash.new(template_info)
|
66
|
+
end
|
67
|
+
|
68
|
+
def template_information(key)
|
69
|
+
@template_information.fetch(key)
|
70
|
+
end
|
71
|
+
|
72
|
+
# @todo
|
73
|
+
@template_variables = {}
|
74
|
+
def process_template_variables(_template, variables)
|
75
|
+
# template_info = get_data_from_template(template)
|
76
|
+
# @todo unifying structure, ideally struct class?
|
77
|
+
# variables = Hashie::Mash.new(template_info['variables'])
|
78
|
+
variables = Hashie::Mash.new(variables)
|
79
|
+
|
80
|
+
variables.each do |k, v|
|
81
|
+
if v.is_a?(String)
|
82
|
+
TemplateVariable.new(name: k, value: v)
|
83
|
+
# Results in #<struct TemplateVariable name={:name=>"email", :value=>"theinen@tecracer.de"}, value=""
|
84
|
+
elsif v.is_a?(Hashie::Mash)
|
85
|
+
# puts TemplateVariable.new(name: k, **v)
|
86
|
+
# Explodes like a Pro
|
87
|
+
else
|
88
|
+
raise "No known datatype for variable #{k}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def parse_template_data(template)
|
94
|
+
template_info = get_data_from_template(template)
|
95
|
+
|
96
|
+
# Template defaults, then config files, then command line
|
97
|
+
defaults = Hashie::Mash.new(template_info['variables'])
|
98
|
+
defaults.deep_update(load_data_from_userconfig)
|
99
|
+
defaults.deep_update(options['set'])
|
100
|
+
|
101
|
+
# For ease of use: if no 'name' was passed, use the directory name
|
102
|
+
defaults['name'] = File.basename(@path) if defaults['name'].empty?
|
103
|
+
|
104
|
+
# Command line query of mandatory arguments
|
105
|
+
cli = HighLine.new
|
106
|
+
used_cli = false
|
107
|
+
defaults.each do |parameter, data|
|
108
|
+
next unless data == :mandatory
|
109
|
+
|
110
|
+
puts 'Unset parameters' unless used_cli
|
111
|
+
|
112
|
+
defaults[parameter] = cli.ask(" #{parameter}: ")
|
113
|
+
used_cli = true
|
114
|
+
end
|
115
|
+
if used_cli
|
116
|
+
puts 'Evaluated parameters:'
|
117
|
+
defaults.each { |k, v| puts " #{k}: #{v}" }
|
118
|
+
|
119
|
+
exit unless yes?('Create? [Y/N]')
|
120
|
+
end
|
121
|
+
|
122
|
+
process_template_information(template)
|
123
|
+
process_template_variables(template, defaults)
|
124
|
+
|
125
|
+
@packdata = defaults
|
126
|
+
end
|
127
|
+
|
128
|
+
def retrieve_value(name)
|
129
|
+
packdata.fetch(name)
|
130
|
+
end
|
131
|
+
|
132
|
+
def dest_filename(filename)
|
133
|
+
new_filename = filename.dup
|
134
|
+
filename.scan(/%.+?%/) do |placeholder|
|
135
|
+
variable = placeholder[1..-2]
|
136
|
+
new_filename.gsub!(placeholder, retrieve_value(variable))
|
137
|
+
end
|
138
|
+
|
139
|
+
new_filename
|
140
|
+
end
|
141
|
+
|
142
|
+
def copy_template(template, path)
|
143
|
+
# @todo Really confusing
|
144
|
+
template_base = TemplateLoader.new.search_template(template).gsub(/\.yaml$/, '')
|
145
|
+
|
146
|
+
entries = Dir.glob("#{template_base}/**/*", File::FNM_DOTMATCH) - %w[. ..]
|
147
|
+
entries.select! { |entry| File.file?(entry) }
|
148
|
+
entries.map! { |entry| entry.gsub("#{template_base}/", '') }
|
149
|
+
|
150
|
+
entries.each do |name|
|
151
|
+
template("#{template_base}/#{name}", "#{path}/#{dest_filename(name)}")
|
152
|
+
end
|
153
|
+
|
154
|
+
template_info = get_data_from_template(template)
|
155
|
+
finalize = Array(template_info['finalize'])
|
156
|
+
return unless finalize
|
157
|
+
|
158
|
+
Dir.chdir(path) do
|
159
|
+
finalize.each { |cmd| puts `#{cmd}` }
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# rubocop:disable Style/MethodMissingSuper,Style/MissingRespondToMissing
|
164
|
+
def method_missing(method, *_args, &_block)
|
165
|
+
packdata.fetch(method)
|
166
|
+
end
|
167
|
+
# rubocop:enable Style/MethodMissingSuper,Style/MissingRespondToMissing
|
168
|
+
end
|
169
|
+
|
170
|
+
desc 'create TEMPLATE PATH', 'Scaffold a new path'
|
171
|
+
method_option :set, desc: 'Values of template to set', type: :hash, default: {}
|
172
|
+
def create(template, path)
|
173
|
+
path = File.expand_path(path)
|
174
|
+
raise Error, set_color("ERROR: #{path} already exists.", :red) if File.exist?(path)
|
175
|
+
|
176
|
+
@path = path
|
177
|
+
parse_template_data(template)
|
178
|
+
copy_template(template, path)
|
179
|
+
end
|
180
|
+
|
181
|
+
desc 'list', 'List available templates'
|
182
|
+
def list
|
183
|
+
# @todo Should be in TemplateLoader
|
184
|
+
dirs = TemplateLoader.new.locations
|
185
|
+
entries = []
|
186
|
+
dirs.each do |dir|
|
187
|
+
yamls = Dir.glob('*.yaml', base: dir)
|
188
|
+
basenames = yamls.map { |filename| filename.gsub(/\.yaml$/, '') }
|
189
|
+
|
190
|
+
entries.concat(basenames)
|
191
|
+
end
|
192
|
+
|
193
|
+
say 'Available templates:'
|
194
|
+
entries.uniq.sort.each do |template|
|
195
|
+
data = get_data_from_template(template)
|
196
|
+
say " #{data['name']} (#{data['version']}) - #{data['summary']}"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
desc 'locations', 'List locations to load templates from'
|
201
|
+
def locations
|
202
|
+
dirs = TemplateLoader.new.locations
|
203
|
+
|
204
|
+
say 'Locations searched for templates'
|
205
|
+
dirs.each do |dir|
|
206
|
+
say " #{dir}"
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
desc 'info TEMPLATE', 'Get information about a template'
|
211
|
+
def info(template)
|
212
|
+
load_data_from_userconfig
|
213
|
+
|
214
|
+
template_info = get_data_from_template(template)
|
215
|
+
output = <<~OUTPUT
|
216
|
+
Name : #{template_info['name']}
|
217
|
+
Version : #{template_info['version']}
|
218
|
+
Description: #{template_info['description'].chop}
|
219
|
+
Origin : #{template_info['origin']}
|
220
|
+
|
221
|
+
Variables:
|
222
|
+
OUTPUT
|
223
|
+
say output
|
224
|
+
|
225
|
+
align_to = template_info['variables'].keys.map(&:length).max # { |item| item.length }.max
|
226
|
+
template_info['variables'].each do |name, default|
|
227
|
+
default = '<unset>' if default.empty? || default == :mandatory
|
228
|
+
|
229
|
+
outline = " #{name.ljust(align_to)}: "
|
230
|
+
outline << "#{@config.settings[name]} (was: #{default})" if config.settings[name]
|
231
|
+
outline << default unless config.settings[name]
|
232
|
+
say outline
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'hashie'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
# Namespace of Ashiba
|
5
|
+
module Ashiba
|
6
|
+
# Class loading and representing all configuration data independent
|
7
|
+
# of chosen templates
|
8
|
+
#
|
9
|
+
# @attr [Hashie::Mash] settings Loaded settings
|
10
|
+
class Configuration
|
11
|
+
attr_accessor :settings
|
12
|
+
|
13
|
+
# Initialize class
|
14
|
+
def initialize
|
15
|
+
@settings = Hashie::Mash.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# Return all locations to look for configuration files.
|
19
|
+
#
|
20
|
+
# @return [Array] Possible paths for configuration
|
21
|
+
def locations
|
22
|
+
[
|
23
|
+
'/etc/ashiba/fashibarc',
|
24
|
+
"#{ENV['HOME']}/.ashibarc"
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
# Load values from stated file and merge over previously loaded data,
|
29
|
+
# allowing stacking of global + personal configuration
|
30
|
+
#
|
31
|
+
# @param [String] filename
|
32
|
+
# @return [void]
|
33
|
+
def process_config(file)
|
34
|
+
$logger.debug("Processing user configuraton file #{file}")
|
35
|
+
|
36
|
+
begin
|
37
|
+
contents = ::YAML.load_file(file)
|
38
|
+
rescue Errno::ENOENT => e
|
39
|
+
puts e.message
|
40
|
+
rescue ::YAML::SyntaxError => e
|
41
|
+
puts e.message
|
42
|
+
end
|
43
|
+
|
44
|
+
new_settings = Hashie::Mash.new(contents)
|
45
|
+
new_settings.each { |k, v| $logger.debug(" Setting #{k} to #{v}") }
|
46
|
+
|
47
|
+
@settings.deep_merge!(new_settings)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Recurse over possible locations for configuration and stack found
|
51
|
+
# values
|
52
|
+
#
|
53
|
+
# @return [Hash] Summary of settings
|
54
|
+
def load
|
55
|
+
$logger.info('Loading configuration')
|
56
|
+
|
57
|
+
locations.each do |config|
|
58
|
+
$logger.debug("Checking for configuration at #{config}")
|
59
|
+
next unless File.file?(config)
|
60
|
+
|
61
|
+
process_config(config)
|
62
|
+
end
|
63
|
+
|
64
|
+
$logger.debug('Evaluated configuration as:')
|
65
|
+
@settings.each { |k, v| $logger.debug(" Setting #{k} to #{v}") }
|
66
|
+
|
67
|
+
@settings.to_hash # @todo just for compatibility with old codebase
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
# require_relative 'template_loaders/*.rb'
|
3
|
+
|
4
|
+
# Namespace of Ashiba
|
5
|
+
module Ashiba
|
6
|
+
# Loads templates and creates the Template object.
|
7
|
+
class TemplateLoader
|
8
|
+
# Return all locations to look for configuration files.
|
9
|
+
#
|
10
|
+
# @return [Array] Possible paths for configuration
|
11
|
+
def locations
|
12
|
+
dirs = []
|
13
|
+
|
14
|
+
# Add any templates in plugin packs
|
15
|
+
template_gems = Gem::Specification.latest_specs(true).select { |g| g.name =~ /^ashiba-/ }
|
16
|
+
template_gems.each do |spec|
|
17
|
+
dirs << File.join(spec.base_dir, 'gems', "#{spec.name}-#{spec.version}", 'templates')
|
18
|
+
end
|
19
|
+
|
20
|
+
# Bundled templates last, so they can be overridden by identically named gems
|
21
|
+
dirs << File.expand_path('../../templates', __dir__)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Search for given template in all known locations. May be
|
25
|
+
# given a path as well, to directly reference a file
|
26
|
+
#
|
27
|
+
# @param [String] Name/Path of template
|
28
|
+
# @return [String] Full path of the template, if found
|
29
|
+
# @raise [SomeError] If no template could be found
|
30
|
+
def search_template(name)
|
31
|
+
return name if File.file?(name)
|
32
|
+
|
33
|
+
locations.each do |path|
|
34
|
+
expected = "#{path}/#{name}.yaml"
|
35
|
+
return expected if File.file?(expected)
|
36
|
+
end
|
37
|
+
|
38
|
+
raise "Template #{name} not found. Search path: #{locations.join(', ')}"
|
39
|
+
end
|
40
|
+
|
41
|
+
# Load the template, including a search in all known locations
|
42
|
+
# for templates
|
43
|
+
#
|
44
|
+
# @param [String] Name/Path of the template
|
45
|
+
# @return [Hash] Configuration data, only for compatibility reasons
|
46
|
+
# @raise [Error] If file was not found
|
47
|
+
# @raise [YAML::SyntaxError] If file was invalid
|
48
|
+
def load_template(name)
|
49
|
+
config_file = search_template(name)
|
50
|
+
|
51
|
+
begin
|
52
|
+
contents = ::YAML.load_file(config_file)
|
53
|
+
rescue Errno::ENOENT => e
|
54
|
+
puts e.message
|
55
|
+
rescue ::YAML::SyntaxError => e
|
56
|
+
puts e.message
|
57
|
+
end
|
58
|
+
|
59
|
+
# @todo Only for compatibility reasons, should use regular getters later
|
60
|
+
contents['origin'] = config_file
|
61
|
+
contents
|
62
|
+
|
63
|
+
# @_contents = contents
|
64
|
+
# return template
|
65
|
+
end
|
66
|
+
|
67
|
+
def template
|
68
|
+
Template.new(@_contents)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/ashiba.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = '<%= name %>'
|
3
|
+
spec.version = '<%= version %>'
|
4
|
+
spec.licenses = ['Nonstandard']
|
5
|
+
|
6
|
+
spec.summary = '<%= summary %>'
|
7
|
+
spec.description = '<%= description %>'
|
8
|
+
spec.authors = ['<%= author %>']
|
9
|
+
spec.email = ['<%= email %>']
|
10
|
+
spec.homepage = '<%= url %>'
|
11
|
+
|
12
|
+
spec.files = Dir.glob('templates/**/**', File::FNM_DOTMATCH)
|
13
|
+
spec.files += ['README.md', 'CHANGELOG.md']
|
14
|
+
|
15
|
+
spec.required_ruby_version = '>= 2.4'
|
16
|
+
|
17
|
+
spec.add_runtime_dependency('ashiba', '>= 0.5')
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "rspec/core/rake_task"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
Rake::Task["release"].clear
|
5
|
+
|
6
|
+
# We run tests by default
|
7
|
+
task :default => :build
|
8
|
+
task :gem => :build
|
9
|
+
|
10
|
+
#
|
11
|
+
# Install all tasks found in tasks folder
|
12
|
+
#
|
13
|
+
# See .rake files there for complete documentation.
|
14
|
+
#
|
15
|
+
Dir["tasks/*.rake"].each do |taskfile|
|
16
|
+
load taskfile
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Installs rake tasks for gemming and packaging
|
2
|
+
#
|
3
|
+
begin
|
4
|
+
require 'rubygems/package_task'
|
5
|
+
|
6
|
+
CLEAN.include('pkg/*')
|
7
|
+
CLEAN.include('doc/*')
|
8
|
+
|
9
|
+
# Dynamically load the gem spec
|
10
|
+
filename = '../../' + Dir.glob('*.gemspec').first
|
11
|
+
gemspec_file = File.expand_path(filename, __FILE__)
|
12
|
+
gemspec = Kernel.eval(File.read(gemspec_file))
|
13
|
+
|
14
|
+
Gem::PackageTask.new(gemspec) do |t|
|
15
|
+
t.name = gemspec.name
|
16
|
+
t.version = gemspec.version
|
17
|
+
t.package_dir = "pkg"
|
18
|
+
t.package_files = gemspec.files
|
19
|
+
end
|
20
|
+
rescue LoadError
|
21
|
+
task :gem do
|
22
|
+
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
23
|
+
end
|
24
|
+
task :package do
|
25
|
+
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
name: example
|
3
|
+
format_version: 1
|
4
|
+
version: 0.1.0
|
5
|
+
summary: New Ashiba template
|
6
|
+
description: |
|
7
|
+
Nothing right now
|
8
|
+
variables:
|
9
|
+
name: ''
|
10
|
+
version: 1.0.0
|
11
|
+
author: John Doe
|
12
|
+
email: jdoe@tecracer.de
|
13
|
+
summary: New Template for X
|
14
|
+
description: Provides modular X functionality
|
15
|
+
url: https://tecracer.de
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
name: ashiba-template
|
3
|
+
format_version: 1
|
4
|
+
version: 1.0.0
|
5
|
+
summary: New Ashiba template
|
6
|
+
description: |
|
7
|
+
Creates a template project for new Ashiba templates
|
8
|
+
variables:
|
9
|
+
name: ''
|
10
|
+
version: 0.1.0
|
11
|
+
author: John Doe
|
12
|
+
email: john@example.com
|
13
|
+
summary: Summary of the template
|
14
|
+
description: A longer explanation of its functionality
|
15
|
+
url: http://example.com
|
16
|
+
finalize:
|
17
|
+
- git init .
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ashiba
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thomas Heinen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-04-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bump
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mdl
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.4'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: hashie
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.5'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: highline
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.7'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.7'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: thor
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.20'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.20'
|
111
|
+
description: Use Ashiba to generate directory hierarchies according to templates
|
112
|
+
email:
|
113
|
+
- theinen@tecracer.de
|
114
|
+
executables:
|
115
|
+
- ashiba
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- CHANGELOG.md
|
120
|
+
- README.md
|
121
|
+
- bin/ashiba
|
122
|
+
- lib/ashiba.rb
|
123
|
+
- lib/ashiba/cli.rb
|
124
|
+
- lib/ashiba/configuration.rb
|
125
|
+
- lib/ashiba/logger.rb
|
126
|
+
- lib/ashiba/template.rb
|
127
|
+
- lib/ashiba/template_loader.rb
|
128
|
+
- lib/ashiba/version.rb
|
129
|
+
- templates/ashiba-template.yaml
|
130
|
+
- templates/ashiba-template/%name%.gemspec
|
131
|
+
- templates/ashiba-template/CHANGELOG.md
|
132
|
+
- templates/ashiba-template/Gemfile
|
133
|
+
- templates/ashiba-template/README.md
|
134
|
+
- templates/ashiba-template/Rakefile
|
135
|
+
- templates/ashiba-template/tasks/gem.rake
|
136
|
+
- templates/ashiba-template/templates/example.yaml
|
137
|
+
- templates/ashiba-template/templates/example/README.md
|
138
|
+
homepage: https://github.com/tecracer/ashiba
|
139
|
+
licenses:
|
140
|
+
- Apache-2.0
|
141
|
+
metadata:
|
142
|
+
rubygems_mfa_required: 'true'
|
143
|
+
post_install_message:
|
144
|
+
rdoc_options: []
|
145
|
+
require_paths:
|
146
|
+
- lib
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '2.7'
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
requirements: []
|
158
|
+
rubygems_version: 3.3.7
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: Ashiba is another simple scaffolding tool
|
162
|
+
test_files: []
|