exctl 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "exctl"
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joseph Wecker"]
12
- s.date = "2013-11-13"
12
+ s.date = "2013-11-17"
13
13
  s.description = "Allows you to create a command-line dispatcher for a project to consolidate dev, release, and runtime workflows."
14
14
  s.email = "joseph.wecker@gmail.com"
15
15
  s.executables = ["exctl"]
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31
31
  "exctl.gemspec",
32
32
  "lib/exctl.rb",
33
33
  "lib/exctl/cli.rb",
34
+ "lib/exctl/commands.rb",
34
35
  "lib/exctl/dispatch.rb",
35
36
  "lib/shorthand.rb",
36
37
  "notes.md",
@@ -0,0 +1,61 @@
1
+ module Exctl
2
+ class Cmd
3
+ attr_accessor :name, :synopsis, :desc, :args, :priority, :prerequisites
4
+ attr_accessor :priority, :finished, :run
5
+ def initialize(ns, name, opts)
6
+ @ns = ns.dup
7
+ @name = name
8
+ @opts = opts
9
+ end
10
+
11
+ def full_name
12
+ @full_name ||= (@ns + [@name]).map(&:to_s).join('.')
13
+ end
14
+ end
15
+
16
+ class Commands
17
+ include Enumerable
18
+ def initialize(proj_root)
19
+ @root = proj_root
20
+ @cmd_manifests = Path[@root]['**/**/.commands']
21
+ @namespace = []
22
+ #@bin_files = `find '#{@root}' -executable -type f -print0`.split("\x00")
23
+ #pp @bin_files
24
+ end
25
+
26
+ def each(&block) commands.each(&block) end
27
+
28
+ def commands
29
+ return @commands unless @commands.nil?
30
+
31
+ # 1. Commands in manifests
32
+ # 2. Default commands (unless overridden already)
33
+ # 3. Commands found in 'scripts' etc. (unless overridden)
34
+
35
+ @commands = []
36
+ @cmd_manifests.each do |cf|
37
+ cmd_path = cf.short(Path[@root]).to_s.split('/')[0..-2]
38
+ cmd_path.shift if ['bin','scripts'].include?(cmd_path[0])
39
+ @namespace = cmd_path.dup
40
+ eval(File.read(cf), binding, cf.to_s)
41
+ @namespace = []
42
+ end
43
+ @commands
44
+ end
45
+
46
+ # ------ Interface ------
47
+ def family(name, opts={}, &block)
48
+ @namespace << name
49
+ yield
50
+ @namespace.pop
51
+ end
52
+
53
+ def task(name, opts={}, &block)
54
+ cmd = Cmd.new(@namespace, name, opts)
55
+ init_res = yield cmd
56
+ if init_res
57
+ @commands << cmd
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,5 +1,11 @@
1
- module Exctl::Dispatch
2
- def self.dispatch(args)
1
+ require 'exctl/commands'
3
2
 
3
+ module Exctl
4
+ class Dispatch
5
+ def self.dispatch(proj_root, args)
6
+ commands = Exctl::Commands.new(proj_root)
7
+
8
+ pp commands.map{|c| c.full_name}
9
+ end
4
10
  end
5
11
  end
data/notes.md CHANGED
@@ -1,5 +1,4 @@
1
1
 
2
-
3
2
  why?
4
3
  ----
5
4
 
@@ -1 +1,85 @@
1
+ #
2
+ # all|dev|tst|loc|srv
3
+ # -------------------
4
+ #
5
+ # - (ideally) determine which commands are available
6
+ # - determine rebar.config parameters
7
+ # - determine ...app parameters
8
+ # - determine app configurations
9
+ # - determine reltool.config configurations
10
+ # - allow / disallow various generated-node control commands
11
+ # - possibly different sanity checks (for example) in runtime system itself
12
+ #
13
+ #
14
+ # (all processes)
15
+ # ---------------
16
+ # - semantic versioning and version awareness
17
+ #
18
+ # immersion process
19
+ # -----------------
20
+ #
21
+ # iteration process
22
+ # -----------------
23
+ #
24
+ # - *bump major/minor/build number*
25
+ # - rejects if git not ready
26
+ # - possibly ensures that various checks and reports built? (bump compliance policy)
27
+ # - sets correct tag for git
28
+ # - ideally simple build part of vsn is # of commits since last tag
29
+ # - also sets it in all the appropriate files (erlang, release-related, etc.)
30
+ #
31
+ # - per major/minor/build
32
+ # - compliance tests that must pass
33
+ # - certain percent coverage
34
+ # - certain tests passing
35
+ # - xref tests passing
36
+ # - dialyzer analysis all passing
37
+ # - in-app sanity tests
38
+ # - quickcheck style tests (proper)
39
+ # - source-code formatting (erl_tidy?)
40
+ # - other reports (often can be generated simultaneously- for example profiling during quickcheck)
41
+ # - tests / sanity tests / coverage (etc. from above but w/o killing bump)
42
+ # - profiling results (percept, fprof, eprof, cover, cprof)
43
+ # - benchmark results (statistics(runtime)., timer:tc/3)
44
+ # - documentation generates & is relevant (test somehow?)
45
+ #
46
+ # deployment process
47
+ # ------------------
48
+ # -
49
+ #
50
+ # maintenance process
51
+ # -------------------
52
+ #
53
+ #
54
+ #
55
+
56
+
57
+ # version
58
+ # version.bump.major
59
+ # version.bump.minor
60
+ # version.bump.patch
61
+ #
62
+ # -- if rebar detected --
63
+ # rebar:*
64
+ #
65
+ # deps
66
+ # deps.get (tests them afterward also)
67
+ # deps.compile
68
+ # deps.update
69
+ # deps.clean
70
+ # deps.unlock
71
+ # deps.rm
72
+ #
73
+ # test [suites=SUITES] [tests=TESTS]
1
74
  #
75
+ # test:dialyzer
76
+ # test:
77
+ #
78
+ #
79
+ # run
80
+ # run:... (from node)
81
+ #
82
+ #
83
+ # ------ erlang
84
+ # annotation for functions that should only be exported when unit testing
85
+ #
@@ -11,4 +11,4 @@ $PROJ_ROOT = File.expand_path(File.join(this_dir, RELATIVE_PROJ_ROOT_DIR))
11
11
  $LOAD_PATH.unshift File.join(File.expand_path(File.dirname(__FILE__)), ".exctl")
12
12
  require 'exctl'
13
13
  require 'exctl/dispatch'
14
- Exctl::Dispatch::dispatch(ARGV)
14
+ Exctl::Dispatch::dispatch($PROJ_ROOT, ARGV)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exctl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-13 00:00:00.000000000 Z
12
+ date: 2013-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
@@ -98,6 +98,7 @@ files:
98
98
  - exctl.gemspec
99
99
  - lib/exctl.rb
100
100
  - lib/exctl/cli.rb
101
+ - lib/exctl/commands.rb
101
102
  - lib/exctl/dispatch.rb
102
103
  - lib/shorthand.rb
103
104
  - notes.md
@@ -120,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
121
  version: '0'
121
122
  segments:
122
123
  - 0
123
- hash: -1281049067078405370
124
+ hash: 910234353792112644
124
125
  required_rubygems_version: !ruby/object:Gem::Requirement
125
126
  none: false
126
127
  requirements: