raketeer 0.2.8 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
data/lib/raketeer/irb.rb CHANGED
@@ -1,23 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # 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/>.
6
+ # Copyright (c) 2019-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
11
 
@@ -25,11 +13,11 @@ require 'raketeer/irb_task'
25
13
 
26
14
  module Raketeer
27
15
  ###
28
- # @author Jonathan Bradley Whited (@esotericpig)
16
+ # @author Jonathan Bradley Whited
29
17
  # @since 0.2.0
30
18
  ###
31
19
  module IRB
32
20
  end
33
21
  end
34
22
 
35
- Raketeer::IRBTask.new() # @since 0.2.0
23
+ Raketeer::IRBTask.new # @since 0.2.0
@@ -1,23 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # 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/>.
6
+ # Copyright (c) 2019-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
11
 
@@ -29,7 +17,7 @@ require 'raketeer/util'
29
17
 
30
18
  module Raketeer
31
19
  ###
32
- # @author Jonathan Bradley Whited (@esotericpig)
20
+ # @author Jonathan Bradley Whited
33
21
  # @since 0.1.0
34
22
  ###
35
23
  class IRBTask < Rake::TaskLib
@@ -38,30 +26,30 @@ module Raketeer
38
26
  attr_accessor :main_module
39
27
  attr_accessor :name
40
28
  attr_accessor :warning
41
-
29
+
42
30
  alias_method :warning?,:warning
43
-
31
+
44
32
  def initialize(name=:irb)
45
33
  super()
46
-
34
+
47
35
  @description = 'Open an irb session loaded with this library'
48
- @main_module = Util.find_main_module()
36
+ @main_module = Util.find_main_module
49
37
  @name = name
50
38
  @warning = true
51
-
39
+
52
40
  @irb_cmd = ['irb']
53
41
  @irb_cmd.push('-r','rubygems')
54
42
  @irb_cmd.push('-r','bundler/setup')
55
-
56
- yield self if block_given?()
57
-
58
- @irb_cmd.push('-r',@main_module) unless @main_module.nil?()
43
+
44
+ yield self if block_given?
45
+
46
+ @irb_cmd.push('-r',@main_module) unless @main_module.nil?
59
47
  @irb_cmd << '-w' if @warning
60
-
61
- define()
48
+
49
+ define
62
50
  end
63
-
64
- def define()
51
+
52
+ def define
65
53
  desc @description
66
54
  task @name do |task,args|
67
55
  sh(*@irb_cmd)
@@ -1,23 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # 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/>.
6
+ # Copyright (c) 2019-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
11
 
@@ -27,90 +15,90 @@ require 'rake/tasklib'
27
15
 
28
16
  module Raketeer
29
17
  ###
30
- # @author Jonathan Bradley Whited (@esotericpig)
18
+ # @author Jonathan Bradley Whited
31
19
  # @since 0.1.0
32
20
  ###
33
21
  class NokogiriInstallTask < Rake::TaskLib
34
22
  attr_accessor :description
35
23
  attr_accessor :install_cmd
36
24
  attr_accessor :name
37
-
25
+
38
26
  def initialize(name)
39
27
  super()
40
-
28
+
41
29
  @description = nil
42
30
  @install_cmd = nil
43
31
  @name = name
44
32
  end
45
-
33
+
46
34
  def define(&block)
47
- block.call(self) unless block.nil?()
48
-
35
+ block&.call(self)
36
+
49
37
  desc @description
50
38
  task @name do |task,args|
51
39
  run(task,args)
52
40
  end
53
41
  end
54
-
42
+
55
43
  def run(task,args)
56
44
  sh(*@install_cmd)
57
45
  end
58
46
  end
59
-
47
+
60
48
  ###
61
- # @author Jonathan Bradley Whited (@esotericpig)
49
+ # @author Jonathan Bradley Whited
62
50
  # @since 0.1.0
63
51
  ###
64
52
  class NokogiriAPTTask < NokogiriInstallTask
65
53
  def initialize(name=:nokogiri_apt,&block)
66
54
  super(name)
67
-
55
+
68
56
  @description = 'Install Nokogiri libs for Ubuntu/Debian'
69
-
70
- @install_cmd = ['sudo','apt-get','install']
57
+
58
+ @install_cmd = %w[ sudo apt-get install ]
71
59
  @install_cmd << 'build-essential'
72
60
  @install_cmd << 'libgmp-dev'
73
61
  @install_cmd << 'liblzma-dev'
74
62
  @install_cmd << 'patch'
75
63
  @install_cmd << 'ruby-dev'
76
64
  @install_cmd << 'zlib1g-dev'
77
-
65
+
78
66
  define(&block)
79
67
  end
80
68
  end
81
-
69
+
82
70
  ###
83
- # @author Jonathan Bradley Whited (@esotericpig)
71
+ # @author Jonathan Bradley Whited
84
72
  # @since 0.1.0
85
73
  ###
86
74
  class NokogiriDNFTask < NokogiriInstallTask
87
75
  def initialize(name=:nokogiri_dnf,&block)
88
76
  super(name)
89
-
77
+
90
78
  @description = 'Install Nokogiri libs for Fedora/CentOS/Red Hat'
91
-
92
- @install_cmd = ['sudo','dnf','install']
79
+
80
+ @install_cmd = %w[ sudo dnf install ]
93
81
  @install_cmd << 'gcc'
94
82
  @install_cmd << 'ruby-devel'
95
83
  @install_cmd << 'zlib-devel'
96
-
84
+
97
85
  define(&block)
98
86
  end
99
87
  end
100
-
88
+
101
89
  ###
102
- # @author Jonathan Bradley Whited (@esotericpig)
90
+ # @author Jonathan Bradley Whited
103
91
  # @since 0.1.0
104
92
  ###
105
93
  class NokogiriOtherTask < NokogiriInstallTask
106
94
  def initialize(name=:nokogiri_other,&block)
107
95
  super(name)
108
-
96
+
109
97
  @description = 'Install Nokogiri libs for other OSes'
110
-
98
+
111
99
  define(&block)
112
100
  end
113
-
101
+
114
102
  def run(task,args)
115
103
  puts 'Please go to this link for installing Nokogiri on your system:'
116
104
  puts ' https://nokogiri.org/tutorials/installing_nokogiri.html'
@@ -1,23 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # 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/>.
6
+ # Copyright (c) 2019-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
11
 
@@ -26,14 +14,14 @@ require 'raketeer/nokogiri_install_tasks'
26
14
  module Raketeer
27
15
  ###
28
16
  # Defines all Nokogiri install tasks in your Rakefile.
29
- #
30
- # @author Jonathan Bradley Whited (@esotericpig)
17
+ #
18
+ # @author Jonathan Bradley Whited
31
19
  # @since 0.1.0
32
20
  ###
33
21
  module NokogiriInstalls
34
22
  end
35
23
  end
36
24
 
37
- Raketeer::NokogiriAPTTask.new() # @since 0.1.0
38
- Raketeer::NokogiriDNFTask.new() # @since 0.1.0
39
- Raketeer::NokogiriOtherTask.new() # @since 0.1.0
25
+ Raketeer::NokogiriAPTTask.new # @since 0.1.0
26
+ Raketeer::NokogiriDNFTask.new # @since 0.1.0
27
+ Raketeer::NokogiriOtherTask.new # @since 0.1.0
data/lib/raketeer/run.rb CHANGED
@@ -1,23 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # 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/>.
6
+ # Copyright (c) 2019-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
11
 
@@ -25,11 +13,11 @@ require 'raketeer/run_task'
25
13
 
26
14
  module Raketeer
27
15
  ###
28
- # @author Jonathan Bradley Whited (@esotericpig)
16
+ # @author Jonathan Bradley Whited
29
17
  # @since 0.2.2
30
18
  ###
31
19
  module Run
32
20
  end
33
21
  end
34
22
 
35
- Raketeer::RunTask.new() # @since 0.2.2
23
+ Raketeer::RunTask.new # @since 0.2.2
@@ -1,23 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # 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/>.
6
+ # Copyright (c) 2019-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
11
 
@@ -29,7 +17,7 @@ require 'raketeer/util'
29
17
 
30
18
  module Raketeer
31
19
  ###
32
- # @author Jonathan Bradley Whited (@esotericpig)
20
+ # @author Jonathan Bradley Whited
33
21
  # @since 0.2.2
34
22
  ###
35
23
  class RunTask < Rake::TaskLib
@@ -39,38 +27,38 @@ module Raketeer
39
27
  attr_accessor :name
40
28
  attr_accessor :run_cmd
41
29
  attr_accessor :warning
42
-
30
+
43
31
  alias_method :warning?,:warning
44
-
32
+
45
33
  def initialize(name=:run)
46
34
  super()
47
-
35
+
48
36
  @bin_dir = 'bin'
49
37
  @description = %Q(Run this project's main file: "rake #{name} -- --version")
50
38
  @executable = nil
51
39
  @name = name
52
40
  @warning = true
53
-
41
+
54
42
  @run_cmd = ['ruby']
55
43
  @run_cmd.push('-r','rubygems')
56
44
  @run_cmd.push('-r','bundler/setup')
57
-
58
- yield self if block_given?()
59
-
60
- @executable = Util.find_main_executable(@bin_dir) if @executable.nil?()
61
-
45
+
46
+ yield self if block_given?
47
+
48
+ @executable = Util.find_main_executable(@bin_dir) if @executable.nil?
49
+
62
50
  @run_cmd << '-w' if @warning
63
51
  @run_cmd << File.join(@bin_dir,@executable)
64
-
65
- define()
52
+
53
+ define
66
54
  end
67
-
68
- def define()
55
+
56
+ def define
69
57
  desc @description
70
58
  task @name do |task,args|
71
59
  first_arg_index = -1
72
- name_s = @name.to_s()
73
-
60
+ name_s = @name.to_s
61
+
74
62
  # Cut out "--silent" for "rake --silent rt:run -- --version",
75
63
  # else "--silent" will be sent to the executable.
76
64
  ARGV.each_with_index do |arg,i|
@@ -78,25 +66,25 @@ module Raketeer
78
66
  # Rake task names are case-sensitive.
79
67
  if arg.include?(name_s)
80
68
  first_arg_index = i + 1
81
-
69
+
82
70
  break
83
71
  end
84
72
  end
85
-
73
+
86
74
  # In case this is called more than once in some way
87
- sh_cmd = @run_cmd.dup()
88
-
75
+ sh_cmd = @run_cmd.dup
76
+
89
77
  # Are there args for the run command?
90
78
  if first_arg_index >= 0 && first_arg_index < ARGV.length
91
79
  run_args = ARGV.slice!(first_arg_index..-1)
92
-
80
+
93
81
  # Cut out "--" for "rake run -- --version".
94
82
  # For older versions of rake, you didn't need "--", so check for it.
95
83
  run_args.slice!(0) if run_args[0] == '--'
96
-
84
+
97
85
  sh_cmd.push(*run_args)
98
86
  end
99
-
87
+
100
88
  sh(*sh_cmd)
101
89
  end
102
90
  end