scipio 0.6.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +17 -1
- data/README.md +16 -3
- data/lib/scipio/cli.rb +14 -46
- data/lib/scipio/config.rb +4 -19
- data/lib/scipio/gems.rb +20 -15
- data/lib/scipio/version.rb +1 -1
- data/lib/stdlib/string.rb +37 -0
- data/template/{%{gem_name}.gemspec.t → %{gem_name}.gemspec.erb} +3 -3
- data/template/.gitignore +20 -5
- data/template/.standard +1 -0
- data/template/CHANGELOG.md.erb +5 -0
- data/template/{Gemfile → Gemfile.erb} +1 -0
- data/template/{README.md → README.md.erb} +10 -6
- data/template/{Rakefile → Rakefile.erb} +12 -17
- data/template/bin/{%{gem_name} → %{gem_name}.erb} +2 -2
- data/template/lib/{%{gem_name}/cli.rb → %{gem_name_slash}/cli.rb.erb} +11 -8
- data/template/lib/{%{gem_name}/version.rb → %{gem_name_slash}/version.rb.erb} +1 -1
- data/template/lib/%{gem_name_slash}.rb.erb +7 -0
- data/template/sig/%{gem_name_slash}/cli.rbs.erb +13 -0
- data/template/sig/%{gem_name_slash}.rbs.erb +3 -0
- data/template/test/{test_%{gem_name}.rb → %{gem_name_test}.rb.erb} +2 -2
- data.tar.gz.sig +0 -0
- metadata +36 -35
- metadata.gz.sig +0 -0
- data/lib/scipio/rake.rb +0 -45
- data/template/CHANGELOG.md +0 -5
- data/template/lib/%{gem_name}.rb +0 -7
- /data/template/{CODE_OF_CONDUCT.md → CODE_OF_CONDUCT.md.erb} +0 -0
- /data/template/{LICENSE.txt → LICENSE.txt.erb} +0 -0
- /data/template/bin/{console → console.erb} +0 -0
- /data/template/bin/{setup → setup.erb} +0 -0
- /data/template/test/{test_helper.rb → test_helper.rb.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 555d00709e761ef9a85713ffc2e2fb308265b818d2de11415186abd7d09386ca
|
4
|
+
data.tar.gz: 46bd65c8869b69d71c87ebd5b0bae64649db16ab59b7f3d415a12d4d6f58c140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02466438546c1ba4fe520d9159f5bee9ce6981857341f63e69cef05ef3de2f8bc110ba134c772ea10a01bff4e7aa01147aaa4eab97668a15eaf918e589ee673
|
7
|
+
data.tar.gz: cbc8fecd12d0197708d929c12bce74fe786fc9b24c79970bef8c4abae98a7cb6a45954cfbe9a352f5293b54c712d5953f99989c423a34dbd420cd303122f679b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Scipio Changelog
|
2
2
|
|
3
|
+
## 0.8.0 - 28 August 2024
|
4
|
+
|
5
|
+
- Breaking changes
|
6
|
+
- split off Rake tasks to the new Reki gem, to focus on new gems & repos here
|
7
|
+
- minor template changes (named arguments in the cli methods)
|
8
|
+
- bug fix - attempt gem creation with no local template copy present
|
9
|
+
|
10
|
+
## 0.7.0 - 27 August 2024
|
11
|
+
|
12
|
+
- Breaking changes
|
13
|
+
- bug fix/add support for - hyphens & underscores in gem names
|
14
|
+
- add .erb extensions to the default template files
|
15
|
+
- add RBS files to the default template
|
16
|
+
- Add RBS & type signatures
|
17
|
+
- Some refactoring
|
18
|
+
|
3
19
|
## 0.6.0 - 13 August 2024
|
4
20
|
|
5
|
-
- Initial Ruby release
|
21
|
+
- Initial Ruby release (earlier versions were a Python project)
|
data/README.md
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# Scipio
|
2
2
|
|
3
|
-
A
|
3
|
+
A CLI utility to:
|
4
4
|
- set up new Ruby Gems using a configurable template
|
5
5
|
- set up local & remote git repos
|
6
|
-
- launch Rake tasks from anywhere
|
7
6
|
|
8
|
-
|
7
|
+
Set up & run Ruby projects with less typing. Scipio. Skip IO. Geddit?
|
9
8
|
|
10
9
|
## Status
|
11
10
|
|
@@ -13,6 +12,20 @@ Early days. Development status "3 - Alpha" in Python terms.
|
|
13
12
|
|
14
13
|
(Those Python statuses are 1 - Planning, 2 - Pre-alpha, 3 - Alpha, 4 - Beta, 5 - Production/Stable, 6 - Mature, 7 - Inactive.)
|
15
14
|
|
15
|
+
## Why
|
16
|
+
|
17
|
+
I'm a big fan of Bundler & Gem as package management tools. But I'm not a fan of the assumptions about licensing (MIT or nothing), repos (just Github), & Rake that are baked into the Bundler gem command. So I built Scipio, to make gem setup a user choice.
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
`gem install scipio`
|
22
|
+
|
23
|
+
You will need to have Git and Berg installed and configured in order to use them via Scipio.
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
...
|
28
|
+
|
16
29
|
## Ancient history
|
17
30
|
|
18
31
|
<img src="./Scipio.png" alt="Scipio Africanus, OG" />
|
data/lib/scipio/cli.rb
CHANGED
@@ -6,7 +6,6 @@ require "yaml"
|
|
6
6
|
require_relative "config"
|
7
7
|
require_relative "gems"
|
8
8
|
require_relative "git"
|
9
|
-
require_relative "rake"
|
10
9
|
|
11
10
|
module Scipio
|
12
11
|
# CLI handled by optparse
|
@@ -15,43 +14,39 @@ module Scipio
|
|
15
14
|
@options = {}
|
16
15
|
OptionParser.new do |opts|
|
17
16
|
opts.banner = <<~BANNER
|
18
|
-
Scipio
|
19
|
-
Expanded help here
|
17
|
+
Scipio is a CLI utility to set up Ruby Gems & git repos
|
20
18
|
|
21
19
|
Commands:
|
22
20
|
BANNER
|
23
|
-
|
24
|
-
help(opts)
|
25
|
-
init(opts)
|
26
|
-
local(opts)
|
27
|
-
naked_repo(opts)
|
28
|
-
|
29
|
-
task(opts)
|
30
|
-
version(opts)
|
21
|
+
gems(opts:)
|
22
|
+
help(opts:)
|
23
|
+
init(opts:)
|
24
|
+
local(opts:)
|
25
|
+
naked_repo(opts:)
|
26
|
+
version(opts:)
|
31
27
|
end.parse!
|
32
28
|
|
33
29
|
create_gem
|
34
30
|
create_repo
|
35
|
-
create_task
|
36
31
|
rescue OptionParser::InvalidOption
|
37
32
|
puts "Invalid option"
|
38
33
|
# don't have opts here to show help
|
39
34
|
end
|
40
35
|
|
41
|
-
def
|
36
|
+
def gems(opts:)
|
42
37
|
opts.on("-g GEM", "--gem GEM", "Create a new ruby gem named GEM") do |opt|
|
43
38
|
@options[:gem] = opt
|
44
39
|
end
|
45
40
|
end
|
46
41
|
|
47
|
-
def help(opts)
|
42
|
+
def help(opts:)
|
48
43
|
opts.on("-h", "--help", "This help message") do
|
49
44
|
puts opts
|
50
45
|
exit
|
51
46
|
end
|
52
47
|
end
|
53
48
|
|
54
|
-
def init(opts)
|
49
|
+
def init(opts:)
|
55
50
|
opts.on("-i", "--initialize", "Initialize config & template files, show details if they exist") do
|
56
51
|
config = Scipio::Config.new
|
57
52
|
config.info
|
@@ -60,31 +55,19 @@ module Scipio
|
|
60
55
|
end
|
61
56
|
end
|
62
57
|
|
63
|
-
def local(opts)
|
58
|
+
def local(opts:)
|
64
59
|
opts.on("-l", "--local", "With a gem or repo, do not create or connect to the origin") do
|
65
60
|
@options[:local] = true
|
66
61
|
end
|
67
62
|
end
|
68
63
|
|
69
|
-
def naked_repo(opts)
|
64
|
+
def naked_repo(opts:)
|
70
65
|
opts.on("-n REPO", "--naked REPO", "Create a new naked git repo named REPO") do |opt|
|
71
66
|
@options[:repo] = opt
|
72
67
|
end
|
73
68
|
end
|
74
69
|
|
75
|
-
def
|
76
|
-
opts.on("-r RAKE", "--rake RAKE", "Run Rake in directory RAKE, or named RAKE in config") do |opt|
|
77
|
-
@options[:rake] = opt
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def task(opts)
|
82
|
-
opts.on("-t TASK", "--task TASK", "Rake task, use -t -T to list tasks, leave off for the default task") do |opt|
|
83
|
-
@options[:task] = opt
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def version(opts)
|
70
|
+
def version(opts:)
|
88
71
|
opts.on("-v", "--version", "The version") do
|
89
72
|
puts Scipio::VERSION
|
90
73
|
exit
|
@@ -97,6 +80,7 @@ module Scipio
|
|
97
80
|
config = Scipio::Config.new
|
98
81
|
repo = Scipio::Git.new(config:, repo_name: @options[:gem])
|
99
82
|
gem = Scipio::Gems.new(config:, gem_name: @options[:gem])
|
83
|
+
gem.init
|
100
84
|
|
101
85
|
repo.create_dir
|
102
86
|
repo.init_before_write
|
@@ -124,21 +108,5 @@ module Scipio
|
|
124
108
|
exit
|
125
109
|
end
|
126
110
|
end
|
127
|
-
|
128
|
-
def create_task
|
129
|
-
if @options[:rake]
|
130
|
-
config = Scipio::Config.new
|
131
|
-
@options[:task] ||= ""
|
132
|
-
rake = Scipio::Rake.new(options: @options, config:)
|
133
|
-
rake.run
|
134
|
-
exit
|
135
|
-
end
|
136
|
-
|
137
|
-
# no rake dir or name, but a task
|
138
|
-
if @options[:task]
|
139
|
-
puts "--task requires --rake NAME, the directory or named Rake file you're calling this task on"
|
140
|
-
exit
|
141
|
-
end
|
142
|
-
end
|
143
111
|
end
|
144
112
|
end
|
data/lib/scipio/config.rb
CHANGED
@@ -3,12 +3,11 @@
|
|
3
3
|
require "yaml"
|
4
4
|
|
5
5
|
module Scipio
|
6
|
-
#
|
6
|
+
# Persist & use configuration
|
7
7
|
class Config
|
8
8
|
attr_reader :git_dir,
|
9
9
|
:git_domain,
|
10
10
|
:git_site,
|
11
|
-
:rake_dirs,
|
12
11
|
:user_email,
|
13
12
|
:user_fullname,
|
14
13
|
:user_name
|
@@ -60,7 +59,7 @@ module Scipio
|
|
60
59
|
parse_git_config
|
61
60
|
parse_berg_user_info
|
62
61
|
parse_berg_config
|
63
|
-
@git_site =
|
62
|
+
@git_site = File.join(@git_site, @user_name)
|
64
63
|
FileUtils.mkdir_p(Config.template_dir)
|
65
64
|
save_file
|
66
65
|
end
|
@@ -76,17 +75,7 @@ module Scipio
|
|
76
75
|
e-mail: #{@user_email}
|
77
76
|
name: \t#{@user_fullname}
|
78
77
|
user: \t#{@user_name}
|
79
|
-
|
80
|
-
Rake
|
81
78
|
INFO
|
82
|
-
if rake_dirs
|
83
|
-
rake_dirs.each do |name, dir|
|
84
|
-
puts "#{name} - #{dir}"
|
85
|
-
end
|
86
|
-
else
|
87
|
-
puts "No rake directories defined"
|
88
|
-
end
|
89
|
-
# exit
|
90
79
|
end
|
91
80
|
|
92
81
|
def ask_for_git_dir
|
@@ -109,7 +98,6 @@ module Scipio
|
|
109
98
|
@user_email = git["user_email"]
|
110
99
|
@user_fullname = git["user_fullname"]
|
111
100
|
@user_name = git["user_name"]
|
112
|
-
@rake_dirs = config["rake"]
|
113
101
|
end
|
114
102
|
|
115
103
|
def save_file
|
@@ -120,12 +108,9 @@ module Scipio
|
|
120
108
|
"user_email" => @user_email,
|
121
109
|
"user_fullname" => @user_fullname,
|
122
110
|
"user_name" => @user_name
|
123
|
-
},
|
124
|
-
"rake" => {
|
125
|
-
"name" => "path"
|
126
111
|
}}
|
127
|
-
|
128
|
-
File.write(Config.config_file,
|
112
|
+
yaml = config.to_yaml
|
113
|
+
File.write(Config.config_file, yaml)
|
129
114
|
end
|
130
115
|
|
131
116
|
# ~/.Config -> @user_email, @user_fullname
|
data/lib/scipio/gems.rb
CHANGED
@@ -6,6 +6,7 @@ require "fileutils"
|
|
6
6
|
require "pathname"
|
7
7
|
|
8
8
|
require_relative "config"
|
9
|
+
require_relative "../stdlib/string"
|
9
10
|
|
10
11
|
module Scipio
|
11
12
|
# Create the skeleton of a new Gem
|
@@ -18,6 +19,8 @@ module Scipio
|
|
18
19
|
@git_dir = config.git_dir
|
19
20
|
@template_dir = Config.template_dir
|
20
21
|
@vars = {gem_name: @gem_name,
|
22
|
+
gem_name_slash: @gem_name.slash,
|
23
|
+
gem_name_test: @gem_name.test,
|
21
24
|
git_site: config.git_site,
|
22
25
|
user_name: config.user_name,
|
23
26
|
user_fullname: config.user_fullname,
|
@@ -25,31 +28,41 @@ module Scipio
|
|
25
28
|
date: DateTime.now}
|
26
29
|
end
|
27
30
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
def init
|
32
|
+
FileUtils.mkdir_p(@template_dir)
|
33
|
+
if Dir.empty?(@template_dir)
|
34
|
+
FileUtils.cp_r(@gem_default_templates, @config_dir)
|
35
|
+
puts "Templates copied"
|
36
|
+
end
|
37
|
+
puts "Templates directory - #{@template_dir}"
|
33
38
|
end
|
34
39
|
|
35
40
|
def relative_out_path(path_from:)
|
36
41
|
out = Pathname.new(path_from)
|
37
42
|
.relative_path_from(@template_dir)
|
38
43
|
.to_s
|
39
|
-
.chomp(".
|
44
|
+
.chomp(".erb")
|
40
45
|
out % @vars
|
41
46
|
end
|
42
47
|
|
48
|
+
def templates
|
49
|
+
# except for dot files this could be... Dir[File.join(dir, "**/*")]
|
50
|
+
filter_types = %w[. .. .DS_Store]
|
51
|
+
Dir.glob(File.join(@template_dir, "**/*"), File::FNM_DOTMATCH)
|
52
|
+
.select { |file| !file.end_with?(*filter_types) }
|
53
|
+
end
|
54
|
+
|
43
55
|
def write
|
44
56
|
out_dir = File.join(@git_dir, @gem_name)
|
45
57
|
# create_out_dir(out_dir:)
|
46
|
-
templates
|
58
|
+
templates.each do |path_from|
|
47
59
|
path_to = File.join(out_dir, relative_out_path(path_from:))
|
48
60
|
|
49
61
|
if File.directory? path_from
|
50
62
|
FileUtils.mkdir_p path_to
|
51
63
|
else
|
52
64
|
puts path_to # TODO: unless silent
|
65
|
+
FileUtils.mkdir_p Pathname(path_to).dirname # just in case
|
53
66
|
template = ERB.new(File.read(path_from))
|
54
67
|
IO.write(path_to, template.result_with_hash(@vars))
|
55
68
|
end
|
@@ -57,13 +70,5 @@ module Scipio
|
|
57
70
|
end
|
58
71
|
|
59
72
|
# copy the default template files for users to modify or use
|
60
|
-
def init
|
61
|
-
FileUtils.mkdir_p @template_dir
|
62
|
-
unless Dir.empty? @template_dir
|
63
|
-
puts "Templates directory not empty - #{@template_dir}"
|
64
|
-
exit
|
65
|
-
end
|
66
|
-
FileUtils.cp_r(@gem_default_templates, @config_dir)
|
67
|
-
end
|
68
73
|
end
|
69
74
|
end
|
data/lib/scipio/version.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Extending the String class just like I promised I'd never do
|
4
|
+
class String
|
5
|
+
# these_words to TheseWords, this to This
|
6
|
+
def camelize
|
7
|
+
split("_").map { |word| word.capitalize_first }.join
|
8
|
+
end
|
9
|
+
|
10
|
+
# worD to WordD (& not Word, which is what capitalize would do)
|
11
|
+
def capitalize_first
|
12
|
+
sub(/\w/) { |word| word.upcase }
|
13
|
+
end
|
14
|
+
|
15
|
+
# these-words to These::Words - used for Module names
|
16
|
+
def colonize
|
17
|
+
# sub("-", "::")
|
18
|
+
split("-").map { |word| word.capitalize_first }.join("::")
|
19
|
+
end
|
20
|
+
|
21
|
+
# this-and-that to that - used in require_relative
|
22
|
+
def last_part
|
23
|
+
File.basename(tr("-", "/"))
|
24
|
+
end
|
25
|
+
|
26
|
+
# these-words to these/words - used in file paths
|
27
|
+
def slash
|
28
|
+
tr("-", "/")
|
29
|
+
end
|
30
|
+
|
31
|
+
# these-words to these/test_words
|
32
|
+
def test
|
33
|
+
slashed = slash
|
34
|
+
last = slashed.last_part
|
35
|
+
slashed.sub(/.*\K#{last}/, "test_#{last}")
|
36
|
+
end
|
37
|
+
end
|
@@ -4,11 +4,11 @@
|
|
4
4
|
# lib = File.expand_path("lib", __dir__)
|
5
5
|
# $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
6
|
|
7
|
-
require_relative "lib/<%= gem_name %>/version"
|
7
|
+
require_relative "lib/<%= gem_name.slash %>/version"
|
8
8
|
|
9
9
|
Gem::Specification.new do |spec|
|
10
10
|
spec.name = "<%= gem_name %>"
|
11
|
-
spec.version = <%= gem_name.
|
11
|
+
spec.version = <%= gem_name.colonize.camelize %>::VERSION
|
12
12
|
spec.authors = ["<%= user_fullname %>"]
|
13
13
|
spec.email = ["<%= user_email %>"]
|
14
14
|
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.description = <<~DESC
|
17
17
|
TODO: Longer description
|
18
18
|
DESC
|
19
|
-
spec.homepage = "<%= git_site %>/<%=
|
19
|
+
spec.homepage = "<%= git_site %>/<%= gem_name %>"
|
20
20
|
spec.license = "AGPL-3.0-or-later"
|
21
21
|
spec.required_ruby_version = ">= 3.3"
|
22
22
|
|
data/template/.gitignore
CHANGED
@@ -1,11 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
4
|
/coverage/
|
5
|
-
/
|
5
|
+
/InstalledFiles
|
6
6
|
/pkg/
|
7
7
|
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
8
11
|
/tmp/
|
9
12
|
|
10
|
-
|
13
|
+
/.yardoc/
|
14
|
+
/_yardoc/
|
15
|
+
/doc/
|
16
|
+
/rdoc/
|
17
|
+
|
18
|
+
/.bundle/
|
19
|
+
/vendor/bundle
|
20
|
+
/lib/bundler/man/
|
21
|
+
|
22
|
+
.DS_Store
|
23
|
+
.env
|
24
|
+
.idea
|
11
25
|
.rspec_status
|
26
|
+
.ruby-lsp
|
data/template/.standard
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby_version: 3.3
|
@@ -2,19 +2,23 @@
|
|
2
2
|
|
3
3
|
...
|
4
4
|
|
5
|
-
##
|
5
|
+
## Status
|
6
6
|
|
7
|
-
...
|
7
|
+
... in Python terms.
|
8
8
|
|
9
|
-
|
9
|
+
(Those Python statuses are 1 - Planning, 2 - Pre-alpha, 3 - Alpha, 4 - Beta, 5 - Production/Stable, 6 - Mature, 7 - Inactive.)
|
10
|
+
|
11
|
+
## Why
|
10
12
|
|
11
13
|
...
|
12
14
|
|
13
|
-
##
|
15
|
+
## Installation
|
14
16
|
|
15
|
-
|
17
|
+
`gem install <%= gem_name %>`
|
16
18
|
|
17
|
-
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
...
|
18
22
|
|
19
23
|
## Development
|
20
24
|
|
@@ -2,32 +2,31 @@
|
|
2
2
|
|
3
3
|
require "digest/sha2"
|
4
4
|
require "minitest/test_task"
|
5
|
-
require "reek/rake/task"
|
6
5
|
require "standard/rake"
|
7
6
|
|
8
|
-
require_relative "lib/<%= gem_name %>/version"
|
7
|
+
require_relative "lib/<%= gem_name.slash %>/version"
|
9
8
|
|
10
9
|
Minitest::TestTask.create
|
11
10
|
|
12
11
|
namespace :build do
|
13
12
|
def check
|
14
|
-
built_gem_path = "pkg/<%= gem_name %>-#{<%= gem_name.
|
13
|
+
built_gem_path = "pkg/<%= gem_name %>-#{<%= gem_name.colonize.camelize %>::VERSION}.gem"
|
15
14
|
checksum = Digest::SHA512.new.hexdigest(File.read(built_gem_path))
|
16
|
-
checksum_path = "./checksums/<%= gem_name %>-#{<%= gem_name.
|
15
|
+
checksum_path = "./checksums/<%= gem_name %>-#{<%= gem_name.colonize.camelize %>::VERSION}.gem.sha512"
|
17
16
|
FileUtils.rm(Dir.glob("./checksums/*"))
|
18
17
|
File.write(checksum_path, checksum)
|
19
18
|
end
|
20
19
|
|
21
20
|
def signed_build
|
22
21
|
ENV["UNSIGNED_BUILD"] = "false"
|
23
|
-
sh "bundle exec gem build <%= gem_name %>.gemspec --output=./pkg/<%= gem_name %>-#{<%= gem_name.
|
22
|
+
sh "bundle exec gem build <%= gem_name %>.gemspec --output=./pkg/<%= gem_name %>-#{<%= gem_name.colonize %>::VERSION}.gem"
|
24
23
|
end
|
25
24
|
|
26
25
|
desc "Unsigned build & local install, update the repo's checksum"
|
27
26
|
task :local do
|
28
27
|
ENV["UNSIGNED_BUILD"] = "true"
|
29
|
-
sh "bundle exec gem build <%= gem_name %>.gemspec --output=./pkg/<%= gem_name %>-#{<%= gem_name.
|
30
|
-
sh "bundle exec gem install ./pkg/<%= gem_name %>-#{<%= gem_name.
|
28
|
+
sh "bundle exec gem build <%= gem_name %>.gemspec --output=./pkg/<%= gem_name %>-#{<%= gem_name.colonize.camelize %>::VERSION}.gem"
|
29
|
+
sh "bundle exec gem install ./pkg/<%= gem_name %>-#{<%= gem_name.colonize.camelize %>::VERSION}.gem -P MediumSecurity"
|
31
30
|
check
|
32
31
|
end
|
33
32
|
|
@@ -35,7 +34,7 @@ namespace :build do
|
|
35
34
|
task :local_sy do
|
36
35
|
signed_build
|
37
36
|
check
|
38
|
-
sh "bundle exec gem install ./pkg/<%= gem_name %>-#{<%= gem_name.
|
37
|
+
sh "bundle exec gem install ./pkg/<%= gem_name %>-#{<%= gem_name.colonize.camelize %>::VERSION}.gem -P HighSecurity"
|
39
38
|
end
|
40
39
|
|
41
40
|
desc "Publish it - this will build & sign, then commit, push and publish"
|
@@ -45,17 +44,13 @@ namespace :build do
|
|
45
44
|
check
|
46
45
|
# tag git repo
|
47
46
|
sh "git add ."
|
48
|
-
sh "git commit -m \"v#{<%= gem_name.
|
49
|
-
sh "git tag -s v#{<%= gem_name.
|
50
|
-
sh "git push origin \"v#{<%= gem_name.
|
47
|
+
sh "git commit -m \"v#{<%= gem_name.colonize.camelize %>::VERSION}\""
|
48
|
+
sh "git tag -s v#{<%= gem_name.colonize.camelize %>::VERSION} -m \"v#{<%= gem_name.colonize.camelize %>::VERSION}\""
|
49
|
+
sh "git push origin \"v#{<%= gem_name.colonize.camelize %>::VERSION}\""
|
51
50
|
sh "git push"
|
52
51
|
# publish to rubygems, will require OTP
|
53
|
-
sh "gem push ./pkg/<%= gem_name %>-#{<%= gem_name.
|
52
|
+
sh "gem push ./pkg/<%= gem_name %>-#{<%= gem_name.colonize.camelize %>::VERSION}.gem"
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
|
-
|
58
|
-
t.fail_on_error = false
|
59
|
-
end
|
60
|
-
|
61
|
-
task default: %i[standard:fix reek]
|
56
|
+
task default: %i[standard:fix]
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require "optparse"
|
4
4
|
|
5
|
-
module <%= gem_name.
|
5
|
+
module <%= gem_name.colonize.camelize %>
|
6
6
|
# CLI handled by optparse
|
7
7
|
class CLI
|
8
8
|
def start(*_args)
|
@@ -13,29 +13,32 @@ module <%= gem_name.capitalize %>
|
|
13
13
|
|
14
14
|
Commands:
|
15
15
|
BANNER
|
16
|
-
help(opts)
|
17
|
-
options_other(opts)
|
18
|
-
version(opts)
|
16
|
+
help(opts:)
|
17
|
+
options_other(opts:)
|
18
|
+
version(opts:)
|
19
19
|
end.parse!
|
20
|
+
rescue OptionParser::InvalidOption
|
21
|
+
puts "Invalid option"
|
22
|
+
# don't have opts here to show help
|
20
23
|
end
|
21
24
|
|
22
|
-
def help(opts)
|
25
|
+
def help(opts:)
|
23
26
|
opts.on("-h", "--help", "This help message") do
|
24
27
|
puts opts
|
25
28
|
exit
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
29
|
-
def options_other(opts)
|
32
|
+
def options_other(opts:)
|
30
33
|
opts.on("-o", "--other", "Do... other") do |_o|
|
31
34
|
puts "OK"
|
32
35
|
exit
|
33
36
|
end
|
34
37
|
end
|
35
38
|
|
36
|
-
def version(opts)
|
39
|
+
def version(opts:)
|
37
40
|
opts.on("-v", "--version", "The version") do
|
38
|
-
puts <%= gem_name.
|
41
|
+
puts <%= gem_name.colonize.camelize %>::VERSION
|
39
42
|
exit
|
40
43
|
end
|
41
44
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module <%= gem_name.colonize.camelize %>
|
2
|
+
class CLI
|
3
|
+
@options: Hash[String, String]
|
4
|
+
|
5
|
+
def help:(opts: OptionParser) -> void
|
6
|
+
|
7
|
+
def options_other:(opts: OptionParser) -> void
|
8
|
+
|
9
|
+
def start:(Array[untyped] _args) -> void
|
10
|
+
|
11
|
+
def version: -> void
|
12
|
+
end
|
13
|
+
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
require "test_helper"
|
4
4
|
|
5
|
-
class Test<%= gem_name.
|
5
|
+
class Test<%= gem_name.test %> < Minitest::Test
|
6
6
|
def test_that_it_has_a_version_number
|
7
|
-
refute_nil ::<%= gem_name.
|
7
|
+
refute_nil ::<%= gem_name.colonize.camelize %>::VERSION
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_it_does_something_useful
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scipio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kreuzer
|
@@ -12,7 +12,7 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ0wCwYDVQQDDARtaWtl
|
14
14
|
MRswGQYKCZImiZPyLGQBGRYLbWlrZWtyZXV6ZXIxEzARBgoJkiaJk/IsZAEZFgNj
|
15
|
-
|
15
|
+
b20wHhcNMjQwODEzMDczOTMzWhcNMjUwODEzMDczOTMzWjBBMQ0wCwYDVQQDDARt
|
16
16
|
aWtlMRswGQYKCZImiZPyLGQBGRYLbWlrZWtyZXV6ZXIxEzARBgoJkiaJk/IsZAEZ
|
17
17
|
FgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCmglRYFT8KQzXy
|
18
18
|
FfR96x8RTRUmk3ahagfIoH8gkCLrTpKL6qmEbzRBrmg3utjAMooQK3xn0aLwVq6T
|
@@ -25,23 +25,22 @@ cert_chain:
|
|
25
25
|
xfs+km5aTprQKQHK1IpLcWQ/23KbZbOHS0sJjem1WzbzBBtHHhcCAwEAAaN7MHkw
|
26
26
|
CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFKf5PbSu3EXt0eEsHMty
|
27
27
|
EisanEBpMB8GA1UdEQQYMBaBFG1pa2VAbWlrZWtyZXV6ZXIuY29tMB8GA1UdEgQY
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
/
|
28
|
+
MBaBFG1pa2VAbWlrZWtyZXV6ZXIuY29tMA0GCSqGSIb3DQEBCwUAA4IBgQAhdHiW
|
29
|
+
TwKU2JWbPUrErM3Pnu+2J7jzXuUWiGVg0toGn/lEPOm3crvBSXIWSCnHNFVMV90W
|
30
|
+
QuKUVButhH5u+WjzriBkuG6zIUfjSxBDVehLZoGo8E27PO58pBzPgWD7ZRS0S0H6
|
31
|
+
d1PFSPLTFvm2AkwOM9pXQxAXeCg25vkEbFeKBi147/++7tmsnU0pMYnSmuUUBFFu
|
32
|
+
QMr7UTxT0d6wnmTMErqPmD+VMnyGvX62aMqXAyL0FMZDJeVzoeEii2CYS4L9qkwY
|
33
|
+
PLWx2xbdV0LcT/Har9JmYX7b/Cio/tH023rZ++nPeD0k6n2nGfm+IVlknHM571c9
|
34
|
+
7sfPFxBucVUXL1sPl9GcQbMjfL+t7QS1rr2PhRuwCsRTStNcNZaRCd/mZUKKP+3l
|
35
|
+
YgqTixCwts6cQYIdYNFtJbzKvRNqyviKKxPaum7UWAv6Uy80gxgJ8p+fG81FsxbZ
|
36
|
+
0ULnXrHlhf/CHs550TxRlXalgxBCImGdHzWjhdJeC1dZP3olgNtjO23ywtw=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-08-
|
38
|
+
date: 2024-08-28 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
|
-
description:
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
- launch Rake tasks from anywhere
|
40
|
+
description: 'A CLI utility to set up new Ruby Gems using a configurable template,
|
41
|
+
& to set up local & remote git repositories.
|
42
|
+
|
43
|
+
'
|
45
44
|
email:
|
46
45
|
- mike@mikekreuzer.com
|
47
46
|
executables:
|
@@ -60,27 +59,30 @@ files:
|
|
60
59
|
- lib/scipio/config.rb
|
61
60
|
- lib/scipio/gems.rb
|
62
61
|
- lib/scipio/git.rb
|
63
|
-
- lib/scipio/rake.rb
|
64
62
|
- lib/scipio/version.rb
|
65
|
-
-
|
63
|
+
- lib/stdlib/string.rb
|
64
|
+
- template/%{gem_name}.gemspec.erb
|
66
65
|
- template/.gitignore
|
67
|
-
- template
|
68
|
-
- template/
|
69
|
-
- template/
|
70
|
-
- template/
|
71
|
-
- template/
|
72
|
-
- template/
|
73
|
-
- template/
|
74
|
-
- template/bin
|
75
|
-
- template/bin/
|
66
|
+
- template/.standard
|
67
|
+
- template/CHANGELOG.md.erb
|
68
|
+
- template/CODE_OF_CONDUCT.md.erb
|
69
|
+
- template/Gemfile.erb
|
70
|
+
- template/LICENSE.txt.erb
|
71
|
+
- template/README.md.erb
|
72
|
+
- template/Rakefile.erb
|
73
|
+
- template/bin/%{gem_name}.erb
|
74
|
+
- template/bin/console.erb
|
75
|
+
- template/bin/setup.erb
|
76
76
|
- template/certs/.gitkeep
|
77
77
|
- template/checksums/.gitkeep
|
78
|
-
- template/lib/%{
|
79
|
-
- template/lib/%{
|
80
|
-
- template/lib/%{
|
78
|
+
- template/lib/%{gem_name_slash}.rb.erb
|
79
|
+
- template/lib/%{gem_name_slash}/cli.rb.erb
|
80
|
+
- template/lib/%{gem_name_slash}/version.rb.erb
|
81
81
|
- template/pkg/.gitkeep
|
82
|
-
- template/
|
83
|
-
- template/
|
82
|
+
- template/sig/%{gem_name_slash}.rbs.erb
|
83
|
+
- template/sig/%{gem_name_slash}/cli.rbs.erb
|
84
|
+
- template/test/%{gem_name_test}.rb.erb
|
85
|
+
- template/test/test_helper.rb.erb
|
84
86
|
homepage: https://codeberg.org/kreuzer/scipio
|
85
87
|
licenses:
|
86
88
|
- AGPL-3.0-or-later
|
@@ -107,6 +109,5 @@ requirements: []
|
|
107
109
|
rubygems_version: 3.5.17
|
108
110
|
signing_key:
|
109
111
|
specification_version: 4
|
110
|
-
summary: A
|
111
|
-
from anywhere
|
112
|
+
summary: A CLI utility to set up Ruby Gems & git repos
|
112
113
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/scipio/rake.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require "bundler"
|
2
|
-
|
3
|
-
module Scipio
|
4
|
-
# To call Rake from anywhere
|
5
|
-
class Rake
|
6
|
-
def initialize(options:, config:)
|
7
|
-
@rake = options[:rake]
|
8
|
-
@task = options[:task] # may be an empty string
|
9
|
-
@dir = config.rake_dirs
|
10
|
-
end
|
11
|
-
|
12
|
-
# if running without bundler
|
13
|
-
# https://mattbrictson.com/blog/run-shell-commands-in-ruby
|
14
|
-
def self.with_original_bundler_env(&)
|
15
|
-
return yield unless defined?(Bundler)
|
16
|
-
Bundler.with_original_env(&)
|
17
|
-
end
|
18
|
-
|
19
|
-
def run
|
20
|
-
dir = try_dir(rake: @rake)
|
21
|
-
Dir.chdir(dir) do
|
22
|
-
# Bundler.with_original_env do
|
23
|
-
Rake.with_original_bundler_env do
|
24
|
-
system("bundle exec rake #{@task} --trace", exception: true)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# try for a directory, then an entry in the config
|
30
|
-
# TODO: note - watch out for directories in the directory you're calling scipio from,
|
31
|
-
# rake will search the tree upwards from any directory it uses
|
32
|
-
def try_dir(rake:)
|
33
|
-
dir =
|
34
|
-
if File.directory?(File.expand_path(rake))
|
35
|
-
rake
|
36
|
-
elsif @dir.key?(rake) && File.directory?(File.expand_path(@dir[rake]))
|
37
|
-
@dir[rake]
|
38
|
-
else
|
39
|
-
p "Don't know directory or config entry - #{rake}"
|
40
|
-
exit
|
41
|
-
end
|
42
|
-
File.expand_path(dir)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/template/CHANGELOG.md
DELETED
data/template/lib/%{gem_name}.rb
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|