kamaze-project 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +9 -9
- data/lib/kamaze-project.rb +1 -31
- data/lib/kamaze/project.rb +37 -31
- data/lib/kamaze/project/autoload.rb +38 -0
- data/lib/kamaze/project/boot/core_ext.rb +8 -8
- data/lib/kamaze/project/boot/listen.rb +11 -13
- data/lib/kamaze/project/bundled.rb +79 -0
- data/lib/kamaze/project/concern.rb +17 -2
- data/lib/kamaze/project/concern/cli.rb +3 -1
- data/lib/kamaze/project/concern/cli/with_exit_on_failure.rb +2 -6
- data/lib/kamaze/project/concern/env.rb +14 -12
- data/lib/kamaze/project/concern/helper.rb +1 -2
- data/lib/kamaze/project/concern/mode.rb +1 -1
- data/lib/kamaze/project/concern/observable.rb +12 -11
- data/lib/kamaze/project/concern/sh.rb +7 -7
- data/lib/kamaze/project/concern/tasks.rb +36 -10
- data/lib/kamaze/project/concern/tools.rb +2 -3
- data/lib/kamaze/project/config.rb +1 -1
- data/lib/kamaze/project/core_ext/object.rb +17 -8
- data/lib/kamaze/project/core_ext/pp.rb +14 -16
- data/lib/kamaze/project/debug.rb +47 -48
- data/lib/kamaze/project/dsl.rb +9 -5
- data/lib/kamaze/project/dsl/definition.rb +6 -12
- data/lib/kamaze/project/dsl/setup.rb +1 -3
- data/lib/kamaze/project/helper.rb +1 -1
- data/lib/kamaze/project/helper/inflector.rb +9 -27
- data/lib/kamaze/project/helper/project.rb +1 -1
- data/lib/kamaze/project/helper/project/config.rb +1 -1
- data/lib/kamaze/project/inflector.rb +15 -0
- data/lib/kamaze/project/observable.rb +1 -4
- data/lib/kamaze/project/observer.rb +1 -1
- data/lib/kamaze/project/resources/Vagrantfile +1 -1
- data/lib/kamaze/project/struct.rb +1 -1
- data/lib/kamaze/project/tasks/cs.rb +1 -1
- data/lib/kamaze/project/tasks/cs/control.rb +1 -1
- data/lib/kamaze/project/tasks/cs/correct.rb +1 -1
- data/lib/kamaze/project/tasks/cs/pre_commit.rb +4 -6
- data/lib/kamaze/project/tasks/doc.rb +2 -4
- data/lib/kamaze/project/tasks/doc/watch.rb +4 -6
- data/lib/kamaze/project/tasks/gem.rb +15 -6
- data/lib/kamaze/project/tasks/gem/build.rb +33 -17
- data/lib/kamaze/project/tasks/gem/compile.rb +1 -1
- data/lib/kamaze/project/tasks/gem/gemspec.rb +12 -11
- data/lib/kamaze/project/tasks/gem/install.rb +1 -1
- data/lib/kamaze/project/tasks/gem/push.rb +16 -17
- data/lib/kamaze/project/tasks/misc/gitignore.rb +1 -1
- data/lib/kamaze/project/tasks/shell.rb +1 -1
- data/lib/kamaze/project/tasks/sources.rb +1 -1
- data/lib/kamaze/project/tasks/sources/license.rb +1 -1
- data/lib/kamaze/project/tasks/test.rb +3 -5
- data/lib/kamaze/project/tasks/vagrant.rb +1 -1
- data/lib/kamaze/project/tasks/version/edit.rb +1 -1
- data/lib/kamaze/project/tools.rb +18 -6
- data/lib/kamaze/project/tools/base_tool.rb +6 -2
- data/lib/kamaze/project/tools/console.rb +4 -13
- data/lib/kamaze/project/tools/console/output.rb +14 -6
- data/lib/kamaze/project/tools/console/output/buffer.rb +8 -3
- data/lib/kamaze/project/tools/gemspec.rb +11 -21
- data/lib/kamaze/project/tools/gemspec/builder.rb +43 -31
- data/lib/kamaze/project/tools/gemspec/concern.rb +6 -1
- data/lib/kamaze/project/tools/gemspec/concern/reading.rb +2 -5
- data/lib/kamaze/project/tools/gemspec/packager.rb +10 -10
- data/lib/kamaze/project/tools/gemspec/packer.rb +11 -15
- data/lib/kamaze/project/tools/gemspec/packer/command.rb +1 -1
- data/lib/kamaze/project/tools/gemspec/reader.rb +22 -14
- data/lib/kamaze/project/tools/gemspec/reader/decorator.rb +3 -6
- data/lib/kamaze/project/tools/gemspec/writer.rb +43 -19
- data/lib/kamaze/project/tools/gemspec/writer/dep_gen.rb +9 -6
- data/lib/kamaze/project/tools/gemspec/writer/dependency.rb +1 -1
- data/lib/kamaze/project/tools/git.rb +13 -31
- data/lib/kamaze/project/tools/git/hooks.rb +12 -6
- data/lib/kamaze/project/tools/git/hooks/base_hook.rb +3 -11
- data/lib/kamaze/project/tools/git/hooks/pre_commit.rb +3 -7
- data/lib/kamaze/project/tools/git/status.rb +13 -9
- data/lib/kamaze/project/tools/git/status/decorator.rb +1 -1
- data/lib/kamaze/project/tools/git/status/file.rb +2 -1
- data/lib/kamaze/project/tools/git/status/files_array.rb +1 -1
- data/lib/kamaze/project/tools/git/status/index.rb +1 -1
- data/lib/kamaze/project/tools/git/status/worktree.rb +1 -1
- data/lib/kamaze/project/tools/git/util.rb +1 -1
- data/lib/kamaze/project/tools/licenser.rb +2 -2
- data/lib/kamaze/project/tools/packager.rb +12 -22
- data/lib/kamaze/project/tools/packager/filesystem.rb +11 -3
- data/lib/kamaze/project/tools/packager/filesystem/operator.rb +19 -11
- data/lib/kamaze/project/tools/packager/filesystem/operator/utils.rb +22 -16
- data/lib/kamaze/project/tools/process_locker.rb +67 -36
- data/lib/kamaze/project/tools/rspec.rb +5 -3
- data/lib/kamaze/project/tools/rubocop.rb +30 -40
- data/lib/kamaze/project/tools/rubocop/arguments.rb +1 -1
- data/lib/kamaze/project/tools/rubocop/config.rb +2 -4
- data/lib/kamaze/project/tools/shell.rb +7 -8
- data/lib/kamaze/project/tools/vagrant.rb +6 -16
- data/lib/kamaze/project/tools/vagrant/composer.rb +1 -1
- data/lib/kamaze/project/tools/vagrant/composer/file.rb +1 -1
- data/lib/kamaze/project/tools/vagrant/remote.rb +1 -1
- data/lib/kamaze/project/tools/vagrant/shell.rb +1 -1
- data/lib/kamaze/project/tools/vagrant/writer.rb +1 -1
- data/lib/kamaze/project/tools/yardoc.rb +14 -17
- data/lib/kamaze/project/tools/yardoc/file.rb +7 -7
- data/lib/kamaze/project/tools/yardoc/watchable.rb +9 -15
- data/lib/kamaze/project/tools/yardoc/watcher.rb +28 -35
- data/lib/kamaze/project/tools_provider.rb +28 -40
- data/lib/kamaze/project/tools_provider/resolver.rb +1 -1
- data/lib/kamaze/project/version.rb +5 -94
- data/lib/kamaze/project/version.yml +5 -5
- metadata +23 -64
- data/bin/plop +0 -5
data/lib/kamaze/project/dsl.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -8,9 +8,13 @@
|
|
8
8
|
|
9
9
|
require_relative '../project'
|
10
10
|
|
11
|
-
#
|
12
|
-
|
13
|
-
|
11
|
+
# namespace for dsl concerns
|
12
|
+
module Kamaze::Project::DSL
|
13
|
+
# @formatter:off
|
14
|
+
{
|
15
|
+
Definition: 'definition'
|
16
|
+
}.each do |s, fp|
|
17
|
+
autoload(s, "#{__dir__}/dsl/#{fp}")
|
14
18
|
end
|
19
|
+
# @formatter:on
|
15
20
|
end
|
16
|
-
# rubocop:enable Style/Documentation
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -8,13 +8,6 @@
|
|
8
8
|
|
9
9
|
require_relative '../dsl'
|
10
10
|
|
11
|
-
# rubocop:disable Style/Documentation
|
12
|
-
module Kamaze::Project::DSL
|
13
|
-
module Definition
|
14
|
-
end
|
15
|
-
end
|
16
|
-
# rubocop:enable Style/Documentation
|
17
|
-
|
18
11
|
# ``DSL::Definition`` provides access to ``project`` and ``tools`` methods
|
19
12
|
module Kamaze::Project::DSL::Definition
|
20
13
|
protected
|
@@ -23,7 +16,7 @@ module Kamaze::Project::DSL::Definition
|
|
23
16
|
#
|
24
17
|
# @return [Kamaze::Project]
|
25
18
|
def project
|
26
|
-
@project_dsl_stored ||= Kamaze.
|
19
|
+
@project_dsl_stored ||= Kamaze::Project.instance
|
27
20
|
end
|
28
21
|
|
29
22
|
# Get tools
|
@@ -35,9 +28,10 @@ module Kamaze::Project::DSL::Definition
|
|
35
28
|
|
36
29
|
private
|
37
30
|
|
31
|
+
# @return [self]
|
38
32
|
def project_dsl_reset
|
39
|
-
|
40
|
-
|
41
|
-
|
33
|
+
self.tap do
|
34
|
+
@project_dsl_stored = nil
|
35
|
+
end
|
42
36
|
end
|
43
37
|
end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
7
7
|
# There is NO WARRANTY, to the extent permitted by law.
|
8
8
|
|
9
|
-
require_relative 'definition'
|
10
|
-
|
11
9
|
self.extend Kamaze::Project::DSL::Definition
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -1,44 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
7
7
|
# There is NO WARRANTY, to the extent permitted by law.
|
8
8
|
|
9
|
-
|
9
|
+
require_relative '../helper'
|
10
10
|
|
11
11
|
# Inflector built on top of ``Dry::Inflector``
|
12
|
-
class Kamaze::Project::Helper::Inflector
|
13
|
-
def initialize
|
14
|
-
require 'dry/inflector'
|
15
|
-
|
16
|
-
@inflector = Dry::Inflector.new
|
17
|
-
end
|
18
|
-
|
12
|
+
class Kamaze::Project::Helper::Inflector < Kamaze::Project::Inflector
|
19
13
|
# Load constant from a loadable/requirable path
|
20
14
|
#
|
21
15
|
# @param [String] loadable
|
22
16
|
# @return [Object]
|
17
|
+
#
|
18
|
+
# @raise LoadError
|
19
|
+
# @raise TypeError
|
23
20
|
def resolve(loadable)
|
24
|
-
loadable
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@inflector.constantize(@inflector.classify(loadable))
|
29
|
-
end
|
30
|
-
|
31
|
-
def method_missing(method, *args, &block)
|
32
|
-
if respond_to_missing?(method)
|
33
|
-
@inflector.public_send(method, *args, &block)
|
34
|
-
else
|
35
|
-
super
|
21
|
+
(loadable.to_s.empty? ? nil : loadable.to_s).yield_self do |f|
|
22
|
+
require f
|
23
|
+
self.constantize(self.classify(f))
|
36
24
|
end
|
37
25
|
end
|
38
|
-
|
39
|
-
def respond_to_missing?(method, include_private = false)
|
40
|
-
return true if @inflector.respond_to?(method, include_private)
|
41
|
-
|
42
|
-
super(method, include_private)
|
43
|
-
end
|
44
26
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
|
+
# License GPLv3+: GNU GPL version 3 or later
|
5
|
+
# <http://www.gnu.org/licenses/gpl.html>.
|
6
|
+
# This is free software: you are free to change and redistribute it.
|
7
|
+
# There is NO WARRANTY, to the extent permitted by law.
|
8
|
+
|
9
|
+
require_relative '../project'
|
10
|
+
|
11
|
+
require 'dry/inflector'
|
12
|
+
|
13
|
+
# Inflector
|
14
|
+
class Kamaze::Project::Inflector < Dry::Inflector
|
15
|
+
end
|
@@ -1,15 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
7
7
|
# There is NO WARRANTY, to the extent permitted by law.
|
8
8
|
|
9
9
|
require_relative '../project'
|
10
|
-
require_relative 'concern/observable'
|
11
|
-
# implicitely require observer
|
12
|
-
require_relative 'observer'
|
13
10
|
|
14
11
|
# Observable provides the methods for managing the associated observers.
|
15
12
|
#
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# percy-style: [ default.yml ]
|
15
15
|
# ~~~~
|
16
16
|
|
17
|
-
# Copyright (C) 2017-
|
17
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
18
18
|
# License GPLv3+: GNU GPL version 3 or later
|
19
19
|
# <http://www.gnu.org/licenses/gpl.html>.
|
20
20
|
# This is free software: you are free to change and redistribute it.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -58,9 +58,7 @@ end
|
|
58
58
|
|
59
59
|
# task ---------------------------------------------------------------
|
60
60
|
task 'cs:pre-commit' do
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
after.call(e.status)
|
65
|
-
end
|
61
|
+
process.call
|
62
|
+
rescue SystemExit => e
|
63
|
+
after.call(e.status)
|
66
64
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
# Copyright (C) 2017-
|
4
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
5
5
|
# License GPLv3+: GNU GPL version 3 or later
|
6
6
|
# <http://www.gnu.org/licenses/gpl.html>.
|
7
7
|
# This is free software: you are free to change and redistribute it.
|
@@ -14,8 +14,6 @@ tools.fetch(:yardoc).tap do |yardoc|
|
|
14
14
|
end.yield_self do |yardoc|
|
15
15
|
desc 'Generate documentation (using YARD)'
|
16
16
|
task doc: [] do |task|
|
17
|
-
yardoc.run
|
18
|
-
|
19
|
-
task.reenable
|
17
|
+
task.reenable.tap { yardoc.run }
|
20
18
|
end
|
21
19
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -32,10 +32,8 @@ desc 'Watch documentation changes'
|
|
32
32
|
task :'doc:watch' do |task|
|
33
33
|
# ENV['LISTEN_GEM_DEBUGGING'] = '2'
|
34
34
|
tools.fetch(:process_locker).lock!(:doc_watch) do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
exit(Errno::ECANCELED::Errno)
|
39
|
-
end
|
35
|
+
tools.fetch(:yardoc_watcher).watch(true)
|
36
|
+
rescue SystemExit, Interrupt
|
37
|
+
exit(Errno::ECANCELED::Errno)
|
40
38
|
end
|
41
39
|
end
|
@@ -1,14 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
7
7
|
# There is NO WARRANTY, to the extent permitted by law.
|
8
8
|
|
9
|
-
#
|
10
|
-
|
9
|
+
# @type [Kamaze::Project::Tools::Gemspec::Writer] writer
|
10
|
+
tools.fetch(:gemspec_writer).tap do |writer|
|
11
|
+
writer.write(preserve_mtime: true) unless writer.generated.file?
|
11
12
|
|
12
|
-
#
|
13
|
-
|
14
|
-
|
13
|
+
# Require base tasks ----------------------------------------------
|
14
|
+
[:gemspec, :build].each { |req| require_relative "gem/#{req}" }
|
15
|
+
|
16
|
+
# Default task ----------------------------------------------------
|
17
|
+
desc 'Build all the packages'
|
18
|
+
# rubocop:disable Style/SymbolProc
|
19
|
+
task(gem: [writer.to_s, :'gem:build']) do |task|
|
20
|
+
task.reenable
|
21
|
+
end
|
22
|
+
# rubocop:enable Style/SymbolProc
|
23
|
+
end
|
@@ -1,34 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
7
7
|
# There is NO WARRANTY, to the extent permitted by law.
|
8
8
|
|
9
9
|
require 'rake/clean'
|
10
|
+
autoload(:YAML, 'yaml')
|
11
|
+
autoload(:Pathname, 'pathname')
|
10
12
|
|
11
|
-
builder =
|
12
|
-
|
13
|
+
builder = lambda do |method, *args|
|
14
|
+
tools.fetch(:gemspec_builder).public_send(*[method].push(*args))
|
15
|
+
end
|
16
|
+
|
17
|
+
writer = lambda do |method, *args|
|
18
|
+
tools.fetch(:gemspec_writer).public_send(*[method].push(*args))
|
19
|
+
end
|
13
20
|
|
14
|
-
|
15
|
-
|
21
|
+
runner = lambda do
|
22
|
+
mtime = builder.call(:source_files)
|
23
|
+
.to_a
|
24
|
+
.concat([writer.call(:to_s)])
|
25
|
+
.map { |fp| Pathname.new(fp) }
|
26
|
+
.map(&:mtime).max || Time.now
|
27
|
+
|
28
|
+
lambda do
|
29
|
+
builder.call(:buildable).yield_self { |build| build.file? ? File.mtime(build) : nil }
|
30
|
+
end.call.tap do |build_mtime|
|
31
|
+
if build_mtime.nil? || (build_mtime and mtime > build_mtime)
|
32
|
+
builder.call(:build)
|
33
|
+
Rake::Task[:clobber].reenable
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
16
37
|
|
17
38
|
# clobber ------------------------------------------------------------
|
18
|
-
CLOBBER.include(builder.package_dir)
|
39
|
+
CLOBBER.include(builder.call(:package_dir))
|
19
40
|
|
20
41
|
# task ---------------------------------------------------------------
|
21
|
-
|
22
|
-
|
42
|
+
task(:'gem:build', [writer.call(:to_s)]) do |task|
|
43
|
+
task.reenable.tap do
|
44
|
+
runner.call
|
23
45
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
# task ---------------------------------------------------------------
|
28
|
-
task 'gem:build' do |task|
|
29
|
-
[writer.to_s, builder.buildable].each do |t|
|
30
|
-
Rake::Task[t].invoke
|
46
|
+
[writer.call(:to_s), builder.call(:buildable)].each do |t|
|
47
|
+
Rake::Task[t].invoke
|
48
|
+
end
|
31
49
|
end
|
32
|
-
|
33
|
-
task.reenable
|
34
50
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
@@ -1,20 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (C) 2017-
|
3
|
+
# Copyright (C) 2017-2021 Dimitri Arrigoni <dimitri@arrigoni.me>
|
4
4
|
# License GPLv3+: GNU GPL version 3 or later
|
5
5
|
# <http://www.gnu.org/licenses/gpl.html>.
|
6
6
|
# This is free software: you are free to change and redistribute it.
|
7
7
|
# There is NO WARRANTY, to the extent permitted by law.
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
# @type [Kamaze::Project::Tools::Gemspec::Writer] writer
|
10
|
+
tools.fetch(:gemspec_writer).tap do |writer|
|
11
|
+
task writer.to_s => [:'gem:gemspec'] do |task| # rubocop:disable Style/SymbolProc
|
12
|
+
task.reenable
|
13
|
+
end
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
file writer.to_s => files do
|
19
|
-
writer.write
|
15
|
+
desc 'Update gemspec'
|
16
|
+
task 'gem:gemspec' do |task|
|
17
|
+
task.reenable.tap do
|
18
|
+
writer.write(preserve_mtime: true)
|
19
|
+
end
|
20
|
+
end
|
20
21
|
end
|