c42 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4b90e523311c3d050cf4d5200875e76f9b3a4fd9
4
+ data.tar.gz: c9e4308382bfc8372d4027a4990d18cee56df8fd
5
+ SHA512:
6
+ metadata.gz: e2ac7dae107d4ae60791ab3c4a7375c03a529a29a91bbbc54da09237112783c807b4208076bb84b1272b86426d0d2a86e9d07b15d7bb5f548ae82400f2f53156
7
+ data.tar.gz: ae12608b692ef4b9e92be850c9de9e0403f88474c011b87eb8aac84f1f8b3abf8cbc3c29914b21c15fa81f62ad39abd156a623e4e61076238cda84d7040798bf
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # C42
2
+ C42 is based on Thor but with simple override implementation and loading recursively
data/bin/c42 ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby -*-
3
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)+"/../lib"))
4
+
5
+ require "c42/runner"
6
+ C42::Runner.run
data/c42.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib/", __FILE__)
3
+ $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
4
+ require "c42/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.add_runtime_dependency "thor", "~> 0.20.0"
8
+ spec.add_development_dependency "bundler", "~> 1.0"
9
+ spec.authors = ["commit42"]
10
+ spec.description = "C42 is an internal toolkit for chores based on Thor."
11
+ spec.email = "contact@commit42.fr"
12
+ spec.executables = %w(c42)
13
+ spec.files = %w(c42.gemspec) + Dir["*.md", "bin/*", "lib/**/*.rb"]
14
+ spec.homepage = "http://commit42.fr"
15
+ spec.licenses = %w(MIT)
16
+ spec.name = "c42"
17
+ spec.require_paths = %w(lib)
18
+ spec.required_ruby_version = ">= 2.2.0"
19
+ spec.required_rubygems_version = ">= 2.2.0"
20
+ spec.summary = spec.description
21
+ spec.version = C42::VERSION
22
+ end
data/lib/c42.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/version"
2
+
3
+ module C42
4
+ class << self
5
+
6
+ end
7
+ end
@@ -0,0 +1,27 @@
1
+ require "thor"
2
+
3
+ module C42
4
+ class C42file < ::Thor
5
+ class << self
6
+ def task(name, &block)
7
+ self.instance_eval do
8
+ define_method name, &block
9
+ end
10
+ end
11
+
12
+ def shell_proxy(name, command)
13
+ self.instance_eval do
14
+ task name do |*args|
15
+ Kernel.send(
16
+ :exec,
17
+ *(
18
+ [command.is_a?(String) ? command.split(" ") : command].flatten |
19
+ (args || [])
20
+ )
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
data/lib/c42/runner.rb ADDED
@@ -0,0 +1,27 @@
1
+ require "pathname"
2
+ require "c42/c42file"
3
+ require "thor/util"
4
+
5
+ module C42
6
+ class Runner
7
+ C42_HOME_FILE = File.expand_path("~/.c42/C42file").freeze
8
+
9
+ def self.run
10
+ c42s = []
11
+ Pathname.pwd.ascend do |path|
12
+ c42s << Dir[Thor::Util.escape_globs(path)+"/C42file"]
13
+ c42s << Dir[Thor::Util.escape_globs(path)+"/tasks/.c42"]
14
+ end
15
+ c42s << C42_HOME_FILE if File.exists?(C42_HOME_FILE)
16
+ c42s.flatten!
17
+
18
+ c42file = C42::C42file
19
+ c42s.reverse.each do |file|
20
+ content = File.binread(file)
21
+ c42file = Class.new(c42file)
22
+ c42file.class_eval(content)
23
+ end
24
+ c42file.start
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module C42
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: c42
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - commit42
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.20.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.20.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ description: C42 is an internal toolkit for chores based on Thor.
42
+ email: contact@commit42.fr
43
+ executables:
44
+ - c42
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - README.md
49
+ - bin/c42
50
+ - c42.gemspec
51
+ - lib/c42.rb
52
+ - lib/c42/c42file.rb
53
+ - lib/c42/runner.rb
54
+ - lib/c42/version.rb
55
+ homepage: http://commit42.fr
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 2.2.0
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 2.2.0
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.5.1
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: C42 is an internal toolkit for chores based on Thor.
79
+ test_files: []