scipio 0.7.0 → 0.8.0

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: ea0fe5447366a0cf4667c9c5229bedd8655b4834b723e9ec69af4a01cae2c54d
4
- data.tar.gz: 4bdade6cb2e464db6652c74715ae3b36d9b5e7b1285c88f6afe84a350566842c
3
+ metadata.gz: 555d00709e761ef9a85713ffc2e2fb308265b818d2de11415186abd7d09386ca
4
+ data.tar.gz: 46bd65c8869b69d71c87ebd5b0bae64649db16ab59b7f3d415a12d4d6f58c140
5
5
  SHA512:
6
- metadata.gz: b5d08adeb33365c1226e8f7a5cba3a1980c8ac7c138189f3996db45138a22e7fb884d651050a9deecdac4e2802ba78a6177b4b8a795a591f3172178069b41e45
7
- data.tar.gz: bb1680babc5f474f2cae62c59d5bfcbb9b7043a57dcba7d89de69521898ecd9b23a154f85b281fe514430b324feb9b74b6fe814056d248c022a55f4c64e6fbd3
6
+ metadata.gz: f02466438546c1ba4fe520d9159f5bee9ce6981857341f63e69cef05ef3de2f8bc110ba134c772ea10a01bff4e7aa01147aaa4eab97668a15eaf918e589ee673
7
+ data.tar.gz: cbc8fecd12d0197708d929c12bce74fe786fc9b24c79970bef8c4abae98a7cb6a45954cfbe9a352f5293b54c712d5953f99989c423a34dbd420cd303122f679b
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## 0.7.0 - 27 August 2024
4
11
 
5
12
  - Breaking changes
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # Scipio
2
2
 
3
- A small CLI utility to:
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
 
@@ -15,13 +14,13 @@ Early days. Development status "3 - Alpha" in Python terms.
15
14
 
16
15
  ## Why
17
16
 
18
- 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. It seemed a natural place to add the ability to run Rake scripts from anywhere.
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.
19
18
 
20
19
  ## Installation
21
20
 
22
21
  `gem install scipio`
23
22
 
24
- You will need to have Git and Berg installed and configured, as well as the Rake gem, in order to use them all via Scipio.
23
+ You will need to have Git and Berg installed and configured in order to use them via Scipio.
25
24
 
26
25
  ## Usage
27
26
 
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,8 +14,7 @@ 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
@@ -25,14 +23,11 @@ module Scipio
25
23
  init(opts:)
26
24
  local(opts:)
27
25
  naked_repo(opts:)
28
- rake(opts:)
29
- tasks(opts:)
30
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
@@ -72,18 +67,6 @@ module Scipio
72
67
  end
73
68
  end
74
69
 
75
- def rake(opts:)
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 tasks(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
70
  def version(opts:)
88
71
  opts.on("-v", "--version", "The version") do
89
72
  puts Scipio::VERSION
@@ -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
@@ -8,7 +8,6 @@ module Scipio
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
@@ -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,9 +108,6 @@ 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
112
  yaml = config.to_yaml
128
113
  File.write(Config.config_file, yaml)
data/lib/scipio/gems.rb CHANGED
@@ -29,12 +29,12 @@ module Scipio
29
29
  end
30
30
 
31
31
  def init
32
- FileUtils.mkdir_p @template_dir
33
- unless Dir.empty? @template_dir
34
- puts "Templates directory not empty - #{@template_dir}"
35
- exit
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
36
  end
37
- FileUtils.cp_r(@gem_default_templates, @config_dir)
37
+ puts "Templates directory - #{@template_dir}"
38
38
  end
39
39
 
40
40
  def relative_out_path(path_from:)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Scipio
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.0"
5
5
  end
data/lib/stdlib/string.rb CHANGED
@@ -18,7 +18,7 @@ class String
18
18
  split("-").map { |word| word.capitalize_first }.join("::")
19
19
  end
20
20
 
21
- # this/and/that to that - used in require_relative
21
+ # this-and-that to that - used in require_relative
22
22
  def last_part
23
23
  File.basename(tr("-", "/"))
24
24
  end
@@ -13,27 +13,30 @@ module <%= gem_name.colonize.camelize %>
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
41
  puts <%= gem_name.colonize.camelize %>::VERSION
39
42
  exit
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.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Kreuzer
@@ -35,13 +35,12 @@ cert_chain:
35
35
  YgqTixCwts6cQYIdYNFtJbzKvRNqyviKKxPaum7UWAv6Uy80gxgJ8p+fG81FsxbZ
36
36
  0ULnXrHlhf/CHs550TxRlXalgxBCImGdHzWjhdJeC1dZP3olgNtjO23ywtw=
37
37
  -----END CERTIFICATE-----
38
- date: 2024-08-27 00:00:00.000000000 Z
38
+ date: 2024-08-28 00:00:00.000000000 Z
39
39
  dependencies: []
40
- description: |
41
- A small CLI utility to:
42
- - set up new Ruby Gems using a configurable template
43
- - set up local & remote git repos
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,7 +59,6 @@ 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
66
64
  - template/%{gem_name}.gemspec.erb
@@ -111,6 +109,5 @@ requirements: []
111
109
  rubygems_version: 3.5.17
112
110
  signing_key:
113
111
  specification_version: 4
114
- summary: A small CLI utility to set up Ruby Gems & git repos, & to run Rake tasks
115
- from anywhere
112
+ summary: A CLI utility to set up Ruby Gems & git repos
116
113
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/lib/scipio/rake.rb DELETED
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler"
4
-
5
- module Scipio
6
- # To call Rake from anywhere
7
- class Rake
8
- def initialize(options:, config:)
9
- @rake = options[:rake]
10
- @task = options[:task] # may be an empty string
11
- @dir = config.rake_dirs
12
- end
13
-
14
- # if running without bundler
15
- # https://mattbrictson.com/blog/run-shell-commands-in-ruby
16
- def self.with_original_bundler_env(&)
17
- return yield unless defined?(Bundler)
18
- Bundler.with_original_env(&)
19
- end
20
-
21
- def run
22
- dir = try_dir(rake: @rake)
23
- Dir.chdir(dir) do
24
- # Bundler.with_original_env do
25
- Rake.with_original_bundler_env do
26
- system("bundle exec rake #{@task} --trace", exception: true)
27
- end
28
- end
29
- end
30
-
31
- # try for a directory, then an entry in the config
32
- # TODO: note - watch out for directories in the directory you're calling scipio from,
33
- # rake will search the tree upwards from any directory it uses
34
- def try_dir
35
- dir =
36
- if File.directory?(File.expand_path(@rake))
37
- @rake
38
- elsif @dir.key?(@rake) && File.directory?(File.expand_path(@dir[@rake]))
39
- @dir[@rake]
40
- else
41
- p "Don't know directory or config entry - #{@rake}"
42
- exit
43
- end
44
- File.expand_path(dir)
45
- end
46
- end
47
- end