put_rake 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec_status +4 -0
- data/Gemfile.lock +1 -1
- data/README.org +20 -8
- data/Rakefile.backup +30 -0
- data/lib/put_rake/version.rb +1 -1
- data/lib/put_rake.rb +57 -14
- data/lib/templates/Rakefile_template +14 -0
- data/put_rake.gemspec +2 -2
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61852391e5b8e277e532468797d6984843a0b5b17b03f0fe020a4373a98b2f07
|
4
|
+
data.tar.gz: 756b1034e603a008f2807af18dba781599e5f5a325934356d1a2432543614dc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d89278ddee2924708f70cd832bea0186cafae173881426b7486085b0f2e871ae7f66209eec1b2aac81d193a84a7073af8eb64461ad4124f662c8180edef06bd
|
7
|
+
data.tar.gz: 0dee5a1cea344259b933e3179bd383152581a929bf34312e6c84be926b90e3df14581a99efc9b3e160f6184adf11f36ac78a51c224cebceed25aa11b5a3a62fc
|
data/.rspec_status
ADDED
data/Gemfile.lock
CHANGED
data/README.org
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
+
[[https://badge.fury.io/rb/put_rake.svg]]
|
2
|
+
|
1
3
|
* PutRake
|
2
4
|
:PROPERTIES:
|
3
5
|
:CUSTOM_ID: putrake
|
4
6
|
:END:
|
5
|
-
Put
|
7
|
+
Put a template of Rakefile for the specific tasks on the local directory
|
6
8
|
|
7
9
|
** Installation
|
8
|
-
:PROPERTIES:
|
9
|
-
:CUSTOM_ID: installation
|
10
|
-
:END:
|
11
10
|
Install the gem and add to the application's Gemfile by executing:
|
12
11
|
|
13
12
|
#+begin_example
|
@@ -22,18 +21,31 @@ $ gem install put_rake
|
|
22
21
|
#+end_example
|
23
22
|
|
24
23
|
** Usage
|
25
|
-
:PROPERTIES:
|
26
|
-
:CUSTOM_ID: usage
|
27
|
-
:END:
|
28
|
-
|
29
24
|
#+begin_src bash
|
30
25
|
put_rake commands:
|
26
|
+
put_rake add PATH # add Rakefile template PATH
|
31
27
|
put_rake for [EXT] # put Rakefile for [EXT]
|
32
28
|
put_rake help [COMMAND] # Describe available commands or one specific command
|
33
29
|
put_rake list # list available Rakefiles
|
30
|
+
put_rake path # show Rakefile template path
|
34
31
|
put_rake version # show version
|
35
32
|
#+end_src
|
36
33
|
|
34
|
+
Put a Rakefile [for] a specific tasks.
|
35
|
+
The default templates are located on the install directory of libs,
|
36
|
+
#+begin_src bash
|
37
|
+
> put_rake path
|
38
|
+
* Rakefile template paths
|
39
|
+
/Users/bob/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/put_rake-0.1.3/lib/templates
|
40
|
+
#+end_src
|
41
|
+
and the additionals can be located any path which is specified
|
42
|
+
by the following command:
|
43
|
+
#+begin_src bash
|
44
|
+
put_rake add /Users/bob/bin/Rakefiles
|
45
|
+
#+end_src
|
46
|
+
|
47
|
+
Happy Ruby.
|
48
|
+
|
37
49
|
** Development
|
38
50
|
:PROPERTIES:
|
39
51
|
:CUSTOM_ID: development
|
data/Rakefile.backup
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
# task default: :spec
|
9
|
+
|
10
|
+
require "colorize"
|
11
|
+
require 'command_line/global'
|
12
|
+
|
13
|
+
task :default do
|
14
|
+
system "rake -T"
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'git auto'
|
18
|
+
task :git_auto do
|
19
|
+
print "Input comments: "
|
20
|
+
comment = STDIN.gets.chomp
|
21
|
+
comment = comment == "" ? "auto pull and push" : comment.gsub("\'", "\\'")
|
22
|
+
["git add -A",
|
23
|
+
"git commit -m '#{comment}'",
|
24
|
+
"git pull origin main",
|
25
|
+
"git push origin main"].each do |comm|
|
26
|
+
puts comm.cyan
|
27
|
+
res = command_line comm
|
28
|
+
puts res.stdout.green
|
29
|
+
end
|
30
|
+
end
|
data/lib/put_rake/version.rb
CHANGED
data/lib/put_rake.rb
CHANGED
@@ -8,9 +8,10 @@ require_relative "put_rake/version"
|
|
8
8
|
|
9
9
|
module PutRake
|
10
10
|
class Error < StandardError; end
|
11
|
+
|
11
12
|
# Your code goes here...
|
12
13
|
class CLI < Thor
|
13
|
-
package_name
|
14
|
+
package_name "put_rake"
|
14
15
|
map "-v" => :version
|
15
16
|
map "--version" => :version
|
16
17
|
|
@@ -20,38 +21,80 @@ module PutRake
|
|
20
21
|
print "put_rake #{VERSION}"
|
21
22
|
end
|
22
23
|
|
24
|
+
desc "path", "show Rakefile template path"
|
25
|
+
|
26
|
+
def path
|
27
|
+
additional_path = ENV["PUT_RAKE_PATH"].split(":")
|
28
|
+
@gem_template_dirs = [
|
29
|
+
File.join(File.dirname(__FILE__), "templates"), additional_path,
|
30
|
+
].flatten
|
31
|
+
puts "* Rakefile template paths\n #{@gem_template_dirs.join("\n ")}"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "add PATH", "add Rakefile template PATH"
|
35
|
+
|
36
|
+
def add(*args)
|
37
|
+
add = args[0]
|
38
|
+
puts "Additional template paths are obtained from ENV['PUT_RAKE_PATH']."
|
39
|
+
puts "Add default paths, put 'setenv PUT_RAKE_PATH ...' on ~/.config/fish/fishconfig.fish."
|
40
|
+
p additional_path = [ENV["PUT_RAKE_PATH"].split(":"), add].join(":")
|
41
|
+
p comm = "setenv #{additional_path}"
|
42
|
+
system comm
|
43
|
+
end
|
44
|
+
|
23
45
|
desc "for [EXT]", "put Rakefile for [EXT]"
|
24
46
|
method_option :force, :type => :boolean, :default => false,
|
25
|
-
|
47
|
+
:aliases => "-f", :desc => "forcely replace"
|
26
48
|
# method_option :force => false, :aliases => "-f", :desc => "forcely replace"
|
27
49
|
method_option :add, :type => :boolean, :default => false,
|
28
|
-
|
50
|
+
:aliases => "-a", :desc => "add to the Rakefile"
|
51
|
+
|
29
52
|
def for(*args)
|
30
|
-
gem_template_dir = File.join(File.dirname(__FILE__), 'templates')
|
31
53
|
file = "Rakefile_#{args[0]}"
|
32
|
-
|
54
|
+
list()
|
55
|
+
@file_path = @rake_file_path.collect do |path|
|
56
|
+
path if File.basename(path) == file
|
57
|
+
end.compact!
|
58
|
+
if @file_path.size != 1 #check multiple name
|
59
|
+
comment = <<~"HEREDOC"
|
60
|
+
Multiple file name #{args}: edit source Rakefile name first.\n
|
61
|
+
#{@file_path.join("\n")}
|
62
|
+
HEREDOC
|
63
|
+
puts comment
|
64
|
+
exit
|
65
|
+
end
|
66
|
+
@file_path = @file_path[0]
|
67
|
+
if File.exists?("./Rakefile") # check exist and -a -f
|
33
68
|
if options[:force]
|
34
|
-
comm = "cp #{
|
69
|
+
comm = "cp #{@file_path} ./Rakefile"
|
35
70
|
elsif options[:add]
|
36
|
-
comm = "cat #{
|
71
|
+
comm = "cat #{@file_path} >> ./Rakefile"
|
37
72
|
else
|
38
|
-
comm = "echo 'Rakefile exists. -f(orce) or -a(dd) available.'"
|
73
|
+
comm = "echo 'Rakefile exists. -f(orce) or -a(dd) option is available.'"
|
39
74
|
end
|
40
75
|
else
|
41
|
-
comm = "cp #{
|
76
|
+
comm = "cp #{@file_path} ./Rakefile"
|
42
77
|
end
|
43
78
|
puts comm
|
44
79
|
system comm
|
45
80
|
end
|
46
81
|
|
47
82
|
desc "list", "list available Rakefiles"
|
83
|
+
|
48
84
|
def list
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
85
|
+
path()
|
86
|
+
@rake_file_path = []
|
87
|
+
puts "* Available Rakefiles"
|
88
|
+
puts "%10s: %s" % ["EXT", "full path"]
|
89
|
+
@gem_template_dirs.each do |gem_template_dir|
|
90
|
+
files = File.join(gem_template_dir, "*")
|
91
|
+
Dir.glob(files).each do |file|
|
92
|
+
next if file[-1] == "~"
|
93
|
+
@rake_file_path << file
|
94
|
+
key = file.match(/Rakefile_(.*)/)[1]
|
95
|
+
puts "%10s: %s" % [key, file]
|
96
|
+
end
|
53
97
|
end
|
54
98
|
end
|
55
|
-
|
56
99
|
end
|
57
100
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "colorize"
|
3
|
+
require 'command_line/global'
|
4
|
+
|
5
|
+
task :default do
|
6
|
+
system "rake -T"
|
7
|
+
end
|
8
|
+
|
9
|
+
namespace :some_name_space do
|
10
|
+
desc "task desciption" #desc → descriptio
|
11
|
+
task task_name: do # any name on task_name
|
12
|
+
# your code goes
|
13
|
+
end
|
14
|
+
end
|
data/put_rake.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Shigeto R. Nishiani"]
|
9
9
|
spec.email = ["daddygongon@users.noreply.github.com"]
|
10
10
|
|
11
|
-
spec.summary = "Put
|
12
|
-
spec.description = "Put
|
11
|
+
spec.summary = "Put a template of Rakefiles on the local dir."
|
12
|
+
spec.description = "Put a template of Rakefiles on the local dir."
|
13
13
|
spec.license = "MIT"
|
14
14
|
spec.required_ruby_version = ">= 2.6.0"
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: put_rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeto R. Nishiani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: Put
|
69
|
+
description: Put a template of Rakefiles on the local dir.
|
70
70
|
email:
|
71
71
|
- daddygongon@users.noreply.github.com
|
72
72
|
executables:
|
@@ -75,6 +75,7 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- ".rspec"
|
78
|
+
- ".rspec_status"
|
78
79
|
- CHANGELOG.md
|
79
80
|
- CODE_OF_CONDUCT.md
|
80
81
|
- Gemfile
|
@@ -82,10 +83,12 @@ files:
|
|
82
83
|
- LICENSE.txt
|
83
84
|
- README.org
|
84
85
|
- Rakefile
|
86
|
+
- Rakefile.backup
|
85
87
|
- exe/put_rake
|
86
88
|
- lib/put_rake.rb
|
87
89
|
- lib/put_rake/version.rb
|
88
90
|
- lib/templates/Rakefile_git_auto
|
91
|
+
- lib/templates/Rakefile_template
|
89
92
|
- put_rake.gemspec
|
90
93
|
- sig/put_rake.rbs
|
91
94
|
homepage:
|
@@ -111,5 +114,5 @@ requirements: []
|
|
111
114
|
rubygems_version: 3.2.22
|
112
115
|
signing_key:
|
113
116
|
specification_version: 4
|
114
|
-
summary: Put
|
117
|
+
summary: Put a template of Rakefiles on the local dir.
|
115
118
|
test_files: []
|