hiiro 0.1.64 → 0.1.65

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26230a22dcc41666062bbd486f5c5f0f289f1c0f901890ff8eded9184fff6d1d
4
- data.tar.gz: 49a1d56f36ba069d0738533f1ac26b649534e7dc999822d6d44cc5bb7a9ce626
3
+ metadata.gz: ee0c1414031bed7ec09923ecd3c88bd20b72a5a64bce2bdf31234dbe03b2c2d1
4
+ data.tar.gz: 3b88d057d457e74f3a796874203e6c863b27325a9238b004f88b6aedec57cf22
5
5
  SHA512:
6
- metadata.gz: 7bf0a65e90a7e97d940eae54c2734f496161294b9d4518cca53e652594244cd5a1f7c4c36e27dfa45dc8ce1fe0e6f1db2fe01431c262a7e7647197d0675fdaca
7
- data.tar.gz: 1551df9b3fb4b018a085b2deffcd774f7677fbc9337fef7e050024162c6b8cfa402d04b1cbc32baed2304e3adb22272e09332c72698c9341fd59ba43073def78
6
+ metadata.gz: a4d11de5d29582076d40150b510b09bf8219f0713c26d59a3205f2f6704b05bffbb84205077d6340cd33c7870a5e4d6c3c83723fd273966c63c1e3ae2badcb29
7
+ data.tar.gz: 5dc971e9c3070edaa1cbf1ae92105929350fa6b4c3eced60183f46215322288ad9df975af6f307724a44cbbae6c16ac5b148e321da7a010501fe7f5be31a5539
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.64"
2
+ VERSION = "0.1.65"
3
3
  end
data/lib/hiiro.rb CHANGED
@@ -163,6 +163,10 @@ class Hiiro
163
163
  @git ||= Git.new(self, Dir.pwd)
164
164
  end
165
165
 
166
+ def attach_method(name, &block)
167
+ define_method(name.to_sym, &block)
168
+ end
169
+
166
170
  def load_plugins(*plugins)
167
171
  plugins.flatten.each { |plugin| load_plugin(plugin) }
168
172
  end
data/plugins/tasks.rb CHANGED
@@ -809,33 +809,36 @@ module Tasks
809
809
  add_subcommands(hiiro)
810
810
  end
811
811
 
812
- def self.attach_methods(hiiro)
813
- hiiro.instance_eval do
814
- def environment
815
- @environment ||= Environment.current
816
- end
817
- end
812
+ def self.attach_methods(hiiro, task_manager=nil)
813
+ environment = Environment.current
814
+
815
+ hiiro.attach_method(:environment) { environment }
816
+ hiiro.attach_method(:env) { environment }
817
+ hiiro.attach_method(:task_manager) { task_manager }
818
+ hiiro.attach_method(:tm) { task_manager }
819
+
820
+ hiiro
818
821
  end
819
822
 
820
823
  def self.add_subcommands(hiiro)
821
824
  hiiro.add_subcmd(:task) do |*args|
822
- mgr = TaskManager.new(hiiro, scope: :task)
823
- task_hiiro = Tasks.build_hiiro(hiiro, mgr)
824
- task_hiiro.run
825
+ tm = TaskManager.new(hiiro, scope: :task)
826
+ build_hiiro(hiiro, tm).run
825
827
  end
826
828
 
827
829
  hiiro.add_subcmd(:subtask) do |*args|
828
- mgr = TaskManager.new(hiiro, scope: :subtask)
829
- task_hiiro = Tasks.build_hiiro(hiiro, mgr)
830
- task_hiiro.run
830
+ tm = TaskManager.new(hiiro, scope: :subtask)
831
+ build_hiiro(hiiro, tm).run
831
832
  end
832
833
  end
833
834
 
834
- def self.build_hiiro(parent_hiiro, mgr)
835
+ def self.build_hiiro(parent_hiiro, task_manager)
835
836
  bin_name = [parent_hiiro.bin, parent_hiiro.subcmd || ''].join('-')
836
837
 
837
- Hiiro.init(bin_name:, args: parent_hiiro.args, task_manager: mgr) do |h|
838
- tm = mgr
838
+ task_hiiro = Hiiro.init(
839
+ bin_name:,
840
+ args: parent_hiiro.args,
841
+ ) do |h|
839
842
  h.add_subcmd(:list) { tm.list }
840
843
  h.add_subcmd(:ls) { tm.list }
841
844
 
@@ -893,5 +896,7 @@ module Tasks
893
896
  system(ENV['EDITOR'] || 'nvim', __FILE__)
894
897
  end
895
898
  end
899
+
900
+ attach_methods task_hiiro, task_manager
896
901
  end
897
902
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.64
4
+ version: 0.1.65
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota