raketeer 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/README.md +0 -2
- data/Rakefile +4 -2
- data/lib/raketeer/all.rb +1 -0
- data/lib/raketeer/irb_task.rb +3 -24
- data/lib/raketeer/run.rb +35 -0
- data/lib/raketeer/run_task.rb +102 -0
- data/lib/raketeer/util.rb +67 -0
- data/lib/raketeer/version.rb +1 -1
- data/lib/raketeer.rb +1 -0
- data/raketeer.gemspec +15 -2
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0fe188ca361d90c09d8cf7222b553aab685af3237b8e1ed6c7ffcc98376d5eb
|
4
|
+
data.tar.gz: 000acde7b85235e3972207ebc8de75725d2d3b63de1df18325509d486762fdc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ea1eb2f31032fcb5b676645805c0c2805c4f9d08fa5f20776b3a141998f79913e3515d0271ca06aff428a76d15f09f8288b86b5e0c80fba67cf503f765f74c1
|
7
|
+
data.tar.gz: f056934701cff50e1b3aa278c63441825a3d543a5f388cbe3acb60061736a2ee9032ab488d0c9251090d044c721690ae853ca85d2eae73c6b0606f687b640cc7
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,21 @@
|
|
2
2
|
|
3
3
|
Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
4
4
|
|
5
|
-
## [[Unreleased]](https://github.com/esotericpig/raketeer/compare/v0.2.
|
5
|
+
## [[Unreleased]](https://github.com/esotericpig/raketeer/compare/v0.2.2...master)
|
6
|
+
|
7
|
+
## [v0.2.2] - 2019-07-29
|
8
|
+
### Changed
|
9
|
+
- Refactored some code (minor)
|
10
|
+
- Changed some documentation (minor)
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- RunTask & 'raketeer/run'
|
14
|
+
- Util
|
15
|
+
- bin/raketeer (for testing purposes only, not included in the Gem package)
|
16
|
+
|
17
|
+
## [v0.2.1] - 2019-07-24
|
18
|
+
### Changed
|
19
|
+
- Fixed minor/cosmetic typo
|
6
20
|
|
7
21
|
## [v0.2.0] - 2019-07-24
|
8
22
|
### Added
|
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/raketeer/all.rb
CHANGED
data/lib/raketeer/irb_task.rb
CHANGED
@@ -25,6 +25,8 @@ require 'rake'
|
|
25
25
|
|
26
26
|
require 'rake/tasklib'
|
27
27
|
|
28
|
+
require 'raketeer/util'
|
29
|
+
|
28
30
|
module Raketeer
|
29
31
|
###
|
30
32
|
# @author Jonathan Bradley Whited (@esotericpig)
|
@@ -43,7 +45,7 @@ module Raketeer
|
|
43
45
|
super()
|
44
46
|
|
45
47
|
@description = 'Open an irb session loaded with this library'
|
46
|
-
@main_module = find_main_module()
|
48
|
+
@main_module = Util.find_main_module()
|
47
49
|
@name = name
|
48
50
|
@warning = true
|
49
51
|
|
@@ -66,28 +68,5 @@ module Raketeer
|
|
66
68
|
sh(*@irb_cmd)
|
67
69
|
end
|
68
70
|
end
|
69
|
-
|
70
|
-
def find_main_module()
|
71
|
-
# First, try the lib/ dir
|
72
|
-
main_file = Dir.glob(File.join('lib','*.rb'))
|
73
|
-
|
74
|
-
if main_file.length == 1
|
75
|
-
basename = File.basename(main_file[0],'.*')
|
76
|
-
|
77
|
-
return basename
|
78
|
-
end
|
79
|
-
|
80
|
-
# Next, try the Gemspec
|
81
|
-
main_file = Dir.glob('*.gemspec')
|
82
|
-
|
83
|
-
if main_file.length == 1
|
84
|
-
basename = File.basename(main_file[0],'.*')
|
85
|
-
main_file = File.join('lib',"#{basename}.rb")
|
86
|
-
|
87
|
-
return basename if File.exist?(main_file)
|
88
|
-
end
|
89
|
-
|
90
|
-
return nil
|
91
|
-
end
|
92
71
|
end
|
93
72
|
end
|
data/lib/raketeer/run.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
#--
|
6
|
+
# This file is part of Raketeer.
|
7
|
+
# Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
|
8
|
+
#
|
9
|
+
# Raketeer is free software: you can redistribute it and/or modify
|
10
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
11
|
+
# the Free Software Foundation, either version 3 of the License, or
|
12
|
+
# (at your option) any later version.
|
13
|
+
#
|
14
|
+
# Raketeer is distributed in the hope that it will be useful,
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
+
# GNU Lesser General Public License for more details.
|
18
|
+
#
|
19
|
+
# You should have received a copy of the GNU Lesser General Public License
|
20
|
+
# along with Raketeer. If not, see <https://www.gnu.org/licenses/>.
|
21
|
+
#++
|
22
|
+
|
23
|
+
|
24
|
+
require 'raketeer/run_task'
|
25
|
+
|
26
|
+
module Raketeer
|
27
|
+
###
|
28
|
+
# @author Jonathan Bradley Whited (@esotericpig)
|
29
|
+
# @since 0.2.2
|
30
|
+
###
|
31
|
+
module Run
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Raketeer::RunTask.new() # @since 0.2.2
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
#--
|
6
|
+
# This file is part of Raketeer.
|
7
|
+
# Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
|
8
|
+
#
|
9
|
+
# Raketeer is free software: you can redistribute it and/or modify
|
10
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
11
|
+
# the Free Software Foundation, either version 3 of the License, or
|
12
|
+
# (at your option) any later version.
|
13
|
+
#
|
14
|
+
# Raketeer is distributed in the hope that it will be useful,
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
+
# GNU Lesser General Public License for more details.
|
18
|
+
#
|
19
|
+
# You should have received a copy of the GNU Lesser General Public License
|
20
|
+
# along with Raketeer. If not, see <https://www.gnu.org/licenses/>.
|
21
|
+
#++
|
22
|
+
|
23
|
+
|
24
|
+
require 'rake'
|
25
|
+
|
26
|
+
require 'rake/tasklib'
|
27
|
+
|
28
|
+
require 'raketeer/util'
|
29
|
+
|
30
|
+
module Raketeer
|
31
|
+
###
|
32
|
+
# @author Jonathan Bradley Whited (@esotericpig)
|
33
|
+
# @since 0.2.2
|
34
|
+
###
|
35
|
+
class RunTask < Rake::TaskLib
|
36
|
+
attr_accessor :bin_dir
|
37
|
+
attr_accessor :description
|
38
|
+
attr_accessor :executable
|
39
|
+
attr_accessor :name
|
40
|
+
attr_accessor :run_cmd
|
41
|
+
attr_accessor :warning
|
42
|
+
|
43
|
+
alias_method :warning?,:warning
|
44
|
+
|
45
|
+
def initialize(name=:run)
|
46
|
+
super()
|
47
|
+
|
48
|
+
@bin_dir = 'bin'
|
49
|
+
@description = %Q(Run this project's main file: "rake #{name} -- --version")
|
50
|
+
@executable = nil
|
51
|
+
@name = name
|
52
|
+
@warning = true
|
53
|
+
|
54
|
+
@run_cmd = ['ruby']
|
55
|
+
@run_cmd += ['-r','rubygems']
|
56
|
+
@run_cmd += ['-r','bundler/setup']
|
57
|
+
|
58
|
+
# Yield before using changeable vars
|
59
|
+
yielf self if block_given?()
|
60
|
+
|
61
|
+
@executable = Util.find_main_executable(@bin_dir) if @executable.nil?()
|
62
|
+
|
63
|
+
@run_cmd << '-w' if @warning
|
64
|
+
@run_cmd << File.join(@bin_dir,@executable)
|
65
|
+
|
66
|
+
define()
|
67
|
+
end
|
68
|
+
|
69
|
+
def define()
|
70
|
+
desc @description
|
71
|
+
task @name do |task,args|
|
72
|
+
first_arg_index = -1
|
73
|
+
name_s = @name.to_s()
|
74
|
+
|
75
|
+
# Cut out "--silent" for "rake --silent rt:run -- --version",
|
76
|
+
# else "--silent" will be sent to the executable.
|
77
|
+
ARGV.each_with_index do |arg,i|
|
78
|
+
# There could be a namespace and/or args, like "rt:run[true]".
|
79
|
+
# Rake task names are case-sensitive.
|
80
|
+
if arg.include?(name_s)
|
81
|
+
first_arg_index = i + 1
|
82
|
+
|
83
|
+
break
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Are there args for the run command?
|
88
|
+
if first_arg_index >= 0 && first_arg_index < ARGV.length
|
89
|
+
run_args = ARGV.slice!(first_arg_index..-1)
|
90
|
+
|
91
|
+
# Cut out "--" for "rake run -- --version".
|
92
|
+
# For older versions of rake, you didn't need "--", so check for it.
|
93
|
+
run_args.slice!(0) if run_args[0] == '--'
|
94
|
+
|
95
|
+
@run_cmd += run_args
|
96
|
+
end
|
97
|
+
|
98
|
+
sh(*@run_cmd)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
#--
|
6
|
+
# This file is part of Raketeer.
|
7
|
+
# Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
|
8
|
+
#
|
9
|
+
# Raketeer is free software: you can redistribute it and/or modify
|
10
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
11
|
+
# the Free Software Foundation, either version 3 of the License, or
|
12
|
+
# (at your option) any later version.
|
13
|
+
#
|
14
|
+
# Raketeer is distributed in the hope that it will be useful,
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
+
# GNU Lesser General Public License for more details.
|
18
|
+
#
|
19
|
+
# You should have received a copy of the GNU Lesser General Public License
|
20
|
+
# along with Raketeer. If not, see <https://www.gnu.org/licenses/>.
|
21
|
+
#++
|
22
|
+
|
23
|
+
|
24
|
+
module Raketeer
|
25
|
+
###
|
26
|
+
# @author Jonathan Bradley Whited (@esotericpig)
|
27
|
+
# @since 0.2.2
|
28
|
+
###
|
29
|
+
module Util
|
30
|
+
def self.find_main_executable(bin_dir)
|
31
|
+
# Try any file
|
32
|
+
main_exe = Dir.glob(File.join(bin_dir,'*'))
|
33
|
+
|
34
|
+
return File.basename(main_exe[0]) if main_exe.length == 1
|
35
|
+
|
36
|
+
# Try only .rb files
|
37
|
+
main_exe = Dir.glob(File.join(bin_dir,'*.rb'))
|
38
|
+
|
39
|
+
return File.basename(main_exe[0]) if main_exe.length == 1
|
40
|
+
|
41
|
+
# Try using the main module
|
42
|
+
main_mod = find_main_module()
|
43
|
+
|
44
|
+
if !main_mod.nil?()
|
45
|
+
main_exe = File.join(bin_dir,main_mod)
|
46
|
+
|
47
|
+
return main_mod if File.exist?(main_exe)
|
48
|
+
end
|
49
|
+
|
50
|
+
return nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.find_main_module()
|
54
|
+
# Try the lib/ dir
|
55
|
+
main_file = Dir.glob(File.join('lib','*.rb'))
|
56
|
+
|
57
|
+
return File.basename(main_file[0],'.*') if main_file.length == 1
|
58
|
+
|
59
|
+
# Try the Gemspec
|
60
|
+
main_file = Dir.glob('*.gemspec')
|
61
|
+
|
62
|
+
return File.basename(main_file[0],'.*') if main_file.length == 1
|
63
|
+
|
64
|
+
return nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/raketeer/version.rb
CHANGED
data/lib/raketeer.rb
CHANGED
data/raketeer.gemspec
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
#++
|
21
21
|
|
22
22
|
|
23
|
-
lib = File.expand_path('
|
23
|
+
lib = File.expand_path(File.join('..','lib'),__FILE__)
|
24
24
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
25
25
|
|
26
26
|
require 'raketeer/version'
|
@@ -33,7 +33,7 @@ Gem::Specification.new() do |spec|
|
|
33
33
|
spec.licenses = ['LGPL-3.0-or-later']
|
34
34
|
spec.homepage = 'https://github.com/esotericpig/raketeer'
|
35
35
|
spec.summary = 'Extra Ruby Rake Tasks.'
|
36
|
-
spec.description =
|
36
|
+
spec.description = 'Extra Ruby Rake Tasks for IRB, Nokogiri, running, etc.'
|
37
37
|
|
38
38
|
spec.metadata = {
|
39
39
|
'bug_tracker_uri' => 'https://github.com/esotericpig/raketeer/issues',
|
@@ -51,8 +51,21 @@ Gem::Specification.new() do |spec|
|
|
51
51
|
|
52
52
|
spec.required_ruby_version = '>= 2.1.10'
|
53
53
|
|
54
|
+
# TODO: also add the below comment to the README & reword for user
|
55
|
+
# If it is a dependency specific to a task, then it should probably be added
|
56
|
+
# as a dev dependency (not a runtime dependency) so that a bunch of
|
57
|
+
# non-essential dependencies (to the user) are not added.
|
58
|
+
#
|
59
|
+
# For example, if the user only uses the Nokogiri tasks, then they don't need
|
60
|
+
# the IRB dependency.
|
61
|
+
#
|
62
|
+
# Therefore, it is up to the user to add the dependencies they need.
|
63
|
+
# If the user uses the IRB task, then they will have to add 'irb' as a
|
64
|
+
# development dependency in their own project's Gemspec.
|
65
|
+
|
54
66
|
spec.add_runtime_dependency 'rake' #,'~> 12.3'
|
55
67
|
|
56
68
|
spec.add_development_dependency 'bundler','~> 1.17'
|
69
|
+
spec.add_development_dependency 'irb' ,'~> 1.0' # For IRBTask
|
57
70
|
spec.add_development_dependency 'yard' ,'~> 0.9' # For doc
|
58
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raketeer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Bradley Whited (@esotericpig)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.17'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: irb
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: yard
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,7 +66,7 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0.9'
|
55
|
-
description: Extra Ruby Rake Tasks
|
69
|
+
description: Extra Ruby Rake Tasks for IRB, Nokogiri, running, etc.
|
56
70
|
email:
|
57
71
|
- bradley@esotericpig.com
|
58
72
|
executables: []
|
@@ -70,6 +84,9 @@ files:
|
|
70
84
|
- lib/raketeer/irb_task.rb
|
71
85
|
- lib/raketeer/nokogiri_install_tasks.rb
|
72
86
|
- lib/raketeer/nokogiri_installs.rb
|
87
|
+
- lib/raketeer/run.rb
|
88
|
+
- lib/raketeer/run_task.rb
|
89
|
+
- lib/raketeer/util.rb
|
73
90
|
- lib/raketeer/version.rb
|
74
91
|
- raketeer.gemspec
|
75
92
|
homepage: https://github.com/esotericpig/raketeer
|