kamaze-project 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +18 -0
  3. data/bin/plop +5 -0
  4. data/lib/kamaze-project.rb +39 -0
  5. data/lib/kamaze/project.rb +155 -0
  6. data/lib/kamaze/project/boot/core_ext.rb +16 -0
  7. data/lib/kamaze/project/boot/listen.rb +38 -0
  8. data/lib/kamaze/project/concern.rb +13 -0
  9. data/lib/kamaze/project/concern/cli.rb +53 -0
  10. data/lib/kamaze/project/concern/cli/with_exit_on_failure.rb +36 -0
  11. data/lib/kamaze/project/concern/env.rb +63 -0
  12. data/lib/kamaze/project/concern/helper.rb +20 -0
  13. data/lib/kamaze/project/concern/mode.rb +19 -0
  14. data/lib/kamaze/project/concern/observable.rb +132 -0
  15. data/lib/kamaze/project/concern/sh.rb +91 -0
  16. data/lib/kamaze/project/concern/tasks.rb +55 -0
  17. data/lib/kamaze/project/concern/tools.rb +27 -0
  18. data/lib/kamaze/project/config.rb +58 -0
  19. data/lib/kamaze/project/core_ext/object.rb +27 -0
  20. data/lib/kamaze/project/core_ext/pp.rb +28 -0
  21. data/lib/kamaze/project/debug.rb +136 -0
  22. data/lib/kamaze/project/dsl.rb +16 -0
  23. data/lib/kamaze/project/dsl/definition.rb +43 -0
  24. data/lib/kamaze/project/dsl/setup.rb +11 -0
  25. data/lib/kamaze/project/helper.rb +63 -0
  26. data/lib/kamaze/project/helper/inflector.rb +44 -0
  27. data/lib/kamaze/project/helper/project.rb +34 -0
  28. data/lib/kamaze/project/helper/project/config.rb +25 -0
  29. data/lib/kamaze/project/observable.rb +20 -0
  30. data/lib/kamaze/project/observer.rb +37 -0
  31. data/lib/kamaze/project/resources/Vagrantfile +128 -0
  32. data/lib/kamaze/project/resources/config/tools.yml +15 -0
  33. data/lib/kamaze/project/struct.rb +34 -0
  34. data/lib/kamaze/project/tasks/cs.rb +23 -0
  35. data/lib/kamaze/project/tasks/cs/control.rb +17 -0
  36. data/lib/kamaze/project/tasks/cs/correct.rb +17 -0
  37. data/lib/kamaze/project/tasks/cs/pre_commit.rb +66 -0
  38. data/lib/kamaze/project/tasks/doc.rb +21 -0
  39. data/lib/kamaze/project/tasks/doc/watch.rb +41 -0
  40. data/lib/kamaze/project/tasks/gem.rb +14 -0
  41. data/lib/kamaze/project/tasks/gem/build.rb +34 -0
  42. data/lib/kamaze/project/tasks/gem/compile.rb +30 -0
  43. data/lib/kamaze/project/tasks/gem/gemspec.rb +20 -0
  44. data/lib/kamaze/project/tasks/gem/install.rb +32 -0
  45. data/lib/kamaze/project/tasks/gem/push.rb +27 -0
  46. data/lib/kamaze/project/tasks/misc/gitignore.rb +29 -0
  47. data/lib/kamaze/project/tasks/shell.rb +17 -0
  48. data/lib/kamaze/project/tasks/sources.rb +6 -0
  49. data/lib/kamaze/project/tasks/sources/license.rb +35 -0
  50. data/lib/kamaze/project/tasks/test.rb +16 -0
  51. data/lib/kamaze/project/tasks/vagrant.rb +71 -0
  52. data/lib/kamaze/project/tasks/version/edit.rb +16 -0
  53. data/lib/kamaze/project/tools.rb +18 -0
  54. data/lib/kamaze/project/tools/base_tool.rb +55 -0
  55. data/lib/kamaze/project/tools/console.rb +48 -0
  56. data/lib/kamaze/project/tools/console/output.rb +120 -0
  57. data/lib/kamaze/project/tools/console/output/buffer.rb +48 -0
  58. data/lib/kamaze/project/tools/gemspec.rb +33 -0
  59. data/lib/kamaze/project/tools/gemspec/builder.rb +99 -0
  60. data/lib/kamaze/project/tools/gemspec/concern.rb +13 -0
  61. data/lib/kamaze/project/tools/gemspec/concern/reading.rb +49 -0
  62. data/lib/kamaze/project/tools/gemspec/packager.rb +67 -0
  63. data/lib/kamaze/project/tools/gemspec/packer.rb +89 -0
  64. data/lib/kamaze/project/tools/gemspec/packer/command.rb +143 -0
  65. data/lib/kamaze/project/tools/gemspec/reader.rb +70 -0
  66. data/lib/kamaze/project/tools/gemspec/reader/decorator.rb +78 -0
  67. data/lib/kamaze/project/tools/gemspec/writer.rb +127 -0
  68. data/lib/kamaze/project/tools/gemspec/writer/dep_gen.rb +61 -0
  69. data/lib/kamaze/project/tools/gemspec/writer/dependency.rb +104 -0
  70. data/lib/kamaze/project/tools/git.rb +95 -0
  71. data/lib/kamaze/project/tools/git/hooks.rb +66 -0
  72. data/lib/kamaze/project/tools/git/hooks/base_hook.rb +33 -0
  73. data/lib/kamaze/project/tools/git/hooks/pre_commit.rb +81 -0
  74. data/lib/kamaze/project/tools/git/status.rb +101 -0
  75. data/lib/kamaze/project/tools/git/status/decorator.rb +39 -0
  76. data/lib/kamaze/project/tools/git/status/file.rb +180 -0
  77. data/lib/kamaze/project/tools/git/status/files_array.rb +39 -0
  78. data/lib/kamaze/project/tools/git/status/index.rb +77 -0
  79. data/lib/kamaze/project/tools/git/status/worktree.rb +19 -0
  80. data/lib/kamaze/project/tools/git/util.rb +35 -0
  81. data/lib/kamaze/project/tools/licenser.rb +197 -0
  82. data/lib/kamaze/project/tools/packager.rb +86 -0
  83. data/lib/kamaze/project/tools/packager/filesystem.rb +178 -0
  84. data/lib/kamaze/project/tools/packager/filesystem/operator.rb +83 -0
  85. data/lib/kamaze/project/tools/packager/filesystem/operator/utils.rb +77 -0
  86. data/lib/kamaze/project/tools/process_locker.rb +106 -0
  87. data/lib/kamaze/project/tools/rspec.rb +115 -0
  88. data/lib/kamaze/project/tools/rubocop.rb +128 -0
  89. data/lib/kamaze/project/tools/rubocop/arguments.rb +19 -0
  90. data/lib/kamaze/project/tools/rubocop/config.rb +43 -0
  91. data/lib/kamaze/project/tools/shell.rb +85 -0
  92. data/lib/kamaze/project/tools/vagrant.rb +182 -0
  93. data/lib/kamaze/project/tools/vagrant/composer.rb +88 -0
  94. data/lib/kamaze/project/tools/vagrant/composer/file.rb +79 -0
  95. data/lib/kamaze/project/tools/vagrant/remote.rb +79 -0
  96. data/lib/kamaze/project/tools/vagrant/shell.rb +102 -0
  97. data/lib/kamaze/project/tools/vagrant/writer.rb +81 -0
  98. data/lib/kamaze/project/tools/yardoc.rb +75 -0
  99. data/lib/kamaze/project/tools/yardoc/file.rb +55 -0
  100. data/lib/kamaze/project/tools/yardoc/watchable.rb +70 -0
  101. data/lib/kamaze/project/tools/yardoc/watcher.rb +106 -0
  102. data/lib/kamaze/project/tools_provider.rb +161 -0
  103. data/lib/kamaze/project/tools_provider/resolver.rb +42 -0
  104. data/lib/kamaze/project/version.rb +104 -0
  105. data/lib/kamaze/project/version.yml +17 -0
  106. metadata +321 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ console: 'kamaze/project/tools/console'
3
+ gemspec_builder: 'kamaze/project/tools/gemspec/builder'
4
+ gemspec_packer: 'kamaze/project/tools/gemspec/packer'
5
+ gemspec_reader: 'kamaze/project/tools/gemspec/reader'
6
+ gemspec_writer: 'kamaze/project/tools/gemspec/writer'
7
+ git: 'kamaze/project/tools/git'
8
+ licenser: 'kamaze/project/tools/licenser'
9
+ process_locker: 'kamaze/project/tools/process_locker'
10
+ rspec: 'kamaze/project/tools/rspec'
11
+ rubocop: 'kamaze/project/tools/rubocop'
12
+ shell: 'kamaze/project/tools/shell'
13
+ vagrant: 'kamaze/project/tools/vagrant'
14
+ yardoc: 'kamaze/project/tools/yardoc'
15
+ yardoc_watcher: 'kamaze/project/tools/yardoc/watcher'
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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 'kamaze/project'
10
+ require 'ostruct'
11
+
12
+ # Generic struct (ala`` OpenStruct``)
13
+ class Kamaze::Project::Struct < OpenStruct
14
+ # Introduces some strictness on ``OpenStruct#method_missing``
15
+ #
16
+ # @raise [NoMethodError]
17
+ # @see https://apidock.com/ruby/OpenStruct/method_missing
18
+ # @return [Object]
19
+ def method_missing(method, *args)
20
+ if method[-1] != '='
21
+ unless self.to_h.include?(method.to_sym)
22
+ message = "undefined method `#{method}' for #{self}"
23
+
24
+ raise NoMethodError, message, caller(1)
25
+ end
26
+ end
27
+
28
+ super
29
+ end
30
+
31
+ def respond_to_missing?(method, include_private = false)
32
+ super
33
+ end
34
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ # A Ruby static code analyzer, based on the community Ruby style guide.
3
+ #
4
+ # @see http://batsov.com/rubocop/
5
+ # @see https://github.com/bbatsov/rubocop
6
+ #
7
+ # Share RuboCop rules across repos
8
+ # @see https://blog.percy.io/share-rubocop-rules-across-all-of-your-repos-f3281fbd71f8
9
+ # @see https://github.com/percy/percy-style
10
+ #
11
+ # ~~~~
12
+ # # .rubocop.yml
13
+ # inherit_gem:
14
+ # percy-style: [ default.yml ]
15
+ # ~~~~
16
+
17
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
18
+ # License GPLv3+: GNU GPL version 3 or later
19
+ # <http://www.gnu.org/licenses/gpl.html>.
20
+ # This is free software: you are free to change and redistribute it.
21
+ # There is NO WARRANTY, to the extent permitted by law.
22
+
23
+ [:control, :correct].each { |req| require_relative "cs/#{req}" }
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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
+ desc 'Run static code analyzer'
10
+ task 'cs:control', [:path] do |t, args|
11
+ tools.fetch(:rubocop).prepare do |c|
12
+ c.patterns = args.fetch(:path)
13
+ c.options = ['--parallel']
14
+ end.run
15
+
16
+ task.reenable
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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
+ desc 'Run static code analyzer, auto-correcting offenses'
10
+ task 'cs:correct', [:path] do |t, args|
11
+ tools.fetch(:rubocop).prepare do |c|
12
+ c.patterns = args.fetch(:path)
13
+ c.options = ['--auto-correct']
14
+ end.run
15
+
16
+ task.reenable
17
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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
+ # Sample of use (``.git/hooks/pre-commit``):
10
+ #
11
+ # ```sh
12
+ # #!/usr/bin/env sh
13
+ #
14
+ # exec bundle exec rake cs:pre-commit
15
+ # ```
16
+
17
+ # process files (index) ----------------------------------------------
18
+ process = lambda do
19
+ hook = tools.fetch(:git).hooks[:pre_commit]
20
+
21
+ hook.process_index(allow_empty: true) do |files|
22
+ return nil if files.reject(&:deleted?).empty?
23
+
24
+ tools.fetch(:rubocop).prepare do |c|
25
+ c.patterns = files.reject(&:deleted?).map(&:to_s)
26
+ end.run
27
+ end
28
+ end
29
+
30
+ # after process ------------------------------------------------------
31
+ after = lambda do |retcode|
32
+ # @raise ArgumentError
33
+ retcode = ('%<retcode>d' % { retcode: retcode }).to_i
34
+ messages = { out: nil, err: nil }
35
+ # rubocop:disable Style/FormatStringToken
36
+ case retcode
37
+ when Errno::EOPNOTSUPP::Errno
38
+ messages[:err] = "%s\n\n" % [
39
+ 'Changed files both present in index and worktree:',
40
+ ' (use "git reset HEAD <file>..." to unstage)',
41
+ ' (use "git add <file>..." to update what will be committed)',
42
+ ].join("\n")
43
+
44
+ tools.fetch(:git).status.index.unsafe_files.each do |file|
45
+ messages[:err] += "{{red:%smodified:\s\s\s#{file}}}\n" % ("\s" * 8)
46
+ end
47
+ end
48
+ # rubocop:enable Style/FormatStringToken
49
+
50
+ messages.each do |type, message|
51
+ unless message.nil?
52
+ tools.fetch(:console).public_send("std#{type}").puts(message + "\n")
53
+ end
54
+ end
55
+
56
+ exit(retcode) unless retcode.zero?
57
+ end
58
+
59
+ # task ---------------------------------------------------------------
60
+ task 'cs:pre-commit' do
61
+ begin
62
+ process.call
63
+ rescue SystemExit => e
64
+ after.call(e.status)
65
+ end
66
+ end
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright (C) 2017-2018 Dimitri Arrigoni <dimitri@arrigoni.me>
5
+ # License GPLv3+: GNU GPL version 3 or later
6
+ # <http://www.gnu.org/licenses/gpl.html>.
7
+ # This is free software: you are free to change and redistribute it.
8
+ # There is NO WARRANTY, to the extent permitted by law.
9
+
10
+ require 'rake/clean'
11
+
12
+ tools.fetch(:yardoc).tap do |yardoc|
13
+ CLOBBER.include(yardoc.output_dir)
14
+ end.yield_self do |yardoc|
15
+ desc 'Generate documentation (using YARD)'
16
+ task doc: [] do |task|
17
+ yardoc.run
18
+
19
+ task.reenable
20
+ end
21
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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 'rake/clean'
10
+
11
+ # rubocop:disable Lint/UselessAssignment
12
+
13
+ # Display start time
14
+ #
15
+ # @todo add observer on watcher
16
+ # @return [Boolean]
17
+ time = proc do
18
+ stime = Time.now.to_s.split(/\s+/)[0..1].reverse.join(' ')
19
+
20
+ tools.fetch(:console).stdout.puts("{{green:#{stime}}}")
21
+ end
22
+
23
+ # rubocop:enable Lint/UselessAssignment
24
+
25
+ # clobber -----------------------------------------------------------
26
+ tools.fetch(:yardoc).tap do |yardoc|
27
+ CLOBBER.include(yardoc.output_dir)
28
+ end
29
+
30
+ # watch --------------------------------------------------------------
31
+ desc 'Watch documentation changes'
32
+ task :'doc:watch' do |task|
33
+ # ENV['LISTEN_GEM_DEBUGGING'] = '2'
34
+ tools.fetch(:process_locker).lock!(:doc_watch) do
35
+ begin
36
+ tools.fetch(:yardoc_watcher).watch(true)
37
+ rescue SystemExit, Interrupt
38
+ exit(Errno::ECANCELED::Errno)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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 base tasks -------------------------------------------------
10
+ [:gemspec, :build].each { |req| require_relative "gem/#{req}" }
11
+
12
+ # Default task -------------------------------------------------------
13
+ desc 'Build all the packages'
14
+ task gem: [:'gem:build']
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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 'rake/clean'
10
+
11
+ builder = tools.fetch(:gemspec_builder)
12
+ writer = tools.fetch(:gemspec_writer)
13
+
14
+ # Generate gemspec file (when missing) -------------------------------
15
+ writer.write unless builder.buildable?
16
+
17
+ # clobber ------------------------------------------------------------
18
+ CLOBBER.include(builder.package_dir)
19
+
20
+ # task ---------------------------------------------------------------
21
+ file builder.buildable => builder.source_files.to_a.map(&:to_s) do
22
+ builder.build
23
+
24
+ Rake::Task['clobber'].reenable
25
+ end
26
+
27
+ # task ---------------------------------------------------------------
28
+ task 'gem:build' do |task|
29
+ [writer.to_s, builder.buildable].each do |t|
30
+ Rake::Task[t].invoke
31
+ end
32
+
33
+ task.reenable
34
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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 'rake/clean'
10
+ require_relative '../gem'
11
+
12
+ packer = tools.fetch(:gemspec_packer)
13
+ writer = tools.fetch(:gemspec_writer)
14
+
15
+ # generate gemspec file (when missing) -------------------------------
16
+ writer.write unless packer.ready?
17
+
18
+ # tasks --------------------------------------------------------------
19
+ packer.packables.each do |packable|
20
+ CLOBBER.include(packable)
21
+
22
+ desc "Compile executable: #{packable.basename}"
23
+ file packable => packer.source_files.to_a.map(&:to_s) do
24
+ tools.fetch(:process_locker).lock!(:gemspec_packer) do
25
+ packer.pack(packable)
26
+
27
+ Rake::Task['clobber'].reenable
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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
+ reader = tools.fetch(:gemspec_reader)
10
+ writer = tools.fetch(:gemspec_writer)
11
+
12
+ files = [writer.templated]
13
+ .concat((reader.read&.files).to_a)
14
+ .concat(Dir.glob(['gems.rb', 'gems.locked'])).map(&:to_s).sort
15
+
16
+ # task 'gem:gemspec': [writer.to_s]
17
+ desc 'Update gemspec'
18
+ file writer.to_s => files do
19
+ writer.write
20
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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
+ builder = tools.fetch(:gemspec_builder)
10
+
11
+ desc 'Install gem'
12
+ task 'gem:install': [builder.buildable] do |task|
13
+ require 'cliver'
14
+
15
+ command = [
16
+ [Cliver.detect(:sudo) ? [:sudo, '-H'] : nil],
17
+ [Cliver.detect!(:gem),
18
+ :install,
19
+ '--update-sources',
20
+ '--clear-sources',
21
+ '--no-user-install',
22
+ '--norc',
23
+ '--no-document',
24
+ builder.buildable]
25
+ ].flatten.compact.map(&:to_s)
26
+
27
+ begin
28
+ sh(*command, verbose: false)
29
+ rescue SystemExit, Interrupt
30
+ exit(Errno::ECANCELED::Errno)
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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
+ [nil, :gem_runner, :exceptions].each do |req|
10
+ require "rubygems/#{req}".rstrip('/')
11
+ end
12
+
13
+ # Code mostly based on gem executable
14
+ #
15
+ # @see http://guides.rubygems.org/publishing/
16
+ # @see rubygems-tasks
17
+ builder = tools.fetch(:gemspec_builder)
18
+ desc 'Push gem up to the gem server'
19
+ task 'gem:push': [builder.buildable] do
20
+ args = [:push, builder.buildable].map(&:to_s)
21
+
22
+ begin
23
+ Gem::GemRunner.new.run(args.map(&:to_s))
24
+ rescue Gem::SystemExitException => e
25
+ exit(e.exit_code)
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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 'pathname'
10
+
11
+ ::Pathname.new('.gitignore').tap do |file|
12
+ if file.exist?
13
+ # desc "Reformat #{file} file"
14
+ task file.to_s do
15
+ lines = file.read.lines
16
+ .map(&:rstrip)
17
+ .reject(&:empty?)
18
+ .reject { |m| m[0] == '#' }
19
+ .sort_by(&:downcase)
20
+
21
+ {
22
+ regular: lines.clone.reject { |m| m[0] == '!' }.freeze,
23
+ inverse: lines.clone.keep_if { |m| m[0] == '!' }.freeze,
24
+ }.values.flatten.yield_self do |rules|
25
+ rules.join("\n").tap { |content| file.write(content) }
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2017-2018 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
+ # Start a REPL
10
+ #
11
+ # @see [Kamaze::Project::Tools::Shell]
12
+
13
+ # task ---------------------------------------------------------------
14
+ desc 'Start ruby REPL'
15
+ task :shell do
16
+ tools.fetch(:shell).start
17
+ end