runfile 0.8.1 → 0.8.2

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
  SHA1:
3
- metadata.gz: 0933690188fd6531bb41f69ce11ee1088146f8a2
4
- data.tar.gz: 0f0f6d08b110f7776827c3be7aff8df686b6fb2c
3
+ metadata.gz: f868c5e0946fecc2a7b30bd2adf23f6391b72174
4
+ data.tar.gz: 88092819b0123374fe96c0fce8040d355700e084
5
5
  SHA512:
6
- metadata.gz: 21e553877b32237b2e40e88c10a3dec1fe8d2e61fb559ed797e9901cf1d9567135eae5cd58c90120bebd0426648d716d41173ce579ab9748646bb72389219b28
7
- data.tar.gz: ee14355abce5fedf67966b39a92fd023a9cb8700a15cd5e8a9f191fb8d9ca07d5cb0e75bf4504353efff4e4ca1b9033d296e086abc0db12d1ae16f9a7e08d3f4
6
+ metadata.gz: 418a86d3652c5d80a2ddeb15efbedbaedeff6dacc02312fbd2dfdea836066d003502c7075166a01b7b0a75d09c29424884ad1c9f3d958af908a65c3e29bf17c5
7
+ data.tar.gz: 2dfa5b5c6e08ef1f1a73eeb8a9bb501c97b500ead7d7247e25d18bfaa7760cc7d4d64519416b830907ee6b0628cfd945eb34cf97bb797cb5e0131b56392dfbf3
data/README.md CHANGED
@@ -1,117 +1,117 @@
1
- Runfile - If Rake and Docopt had a baby
2
- ==================================================
3
-
4
- [![Gem](https://img.shields.io/gem/v/runfile.svg?style=flat-square)](https://rubygems.org/gems/runfile)
5
- [![Travis](https://img.shields.io/travis/DannyBen/runfile.svg?style=flat-square)](https://travis-ci.org/DannyBen/runfile)
6
- [![Code Climate](https://img.shields.io/codeclimate/github/DannyBen/runfile.svg?style=flat-square)](https://codeclimate.com/github/DannyBen/runfile)
7
- [![Gemnasium](https://img.shields.io/gemnasium/DannyBen/runfile.svg?style=flat-square)](https://gemnasium.com/DannyBen/runfile)
8
- [![Gem](https://img.shields.io/gem/dt/runfile.svg?style=flat-square)](https://rubygems.org/gems/runfile)
9
-
10
- ---
11
-
12
- A beautiful command line application framework.
13
- Rake-inspired, Docopt inside.
14
-
15
- ---
16
-
17
- **Runfile** lets you create command line applications in a way similar
18
- to [Rake](https://github.com/ruby/rake), but with the full power of
19
- [Docopt](http://docopt.org/) command line options.
20
-
21
- You create a `Runfile`, and execute commands with
22
- `run command arguments -and --flags`.
23
-
24
- ![Runfile Demo](https://raw.githubusercontent.com/DannyBen/runfile/master/demo.gif "Runfile Demo")
25
-
26
- [Learn More in the Wiki](https://github.com/DannyBen/runfile/wiki)
27
-
28
- ---
29
-
30
- Install
31
- --------------------------------------------------
32
-
33
- $ gem install runfile
34
-
35
-
36
- Quick Start
37
- --------------------------------------------------
38
-
39
- $ run new # create a new Runfile
40
- $ run --help # show the usage patterns
41
- $ vi Runfile # edit the Runfile
42
-
43
-
44
- Example
45
- --------------------------------------------------
46
-
47
- The most minimal `Runfile` looks like this:
48
-
49
- ```ruby
50
- usage "greet <name>"
51
- action :greet do |args|
52
- puts "Hello #{args['<name>']}"
53
- end
54
- ```
55
-
56
- You can then run it by executing this command:
57
-
58
- ```
59
- $ run greet Luke
60
- Hello Luke
61
- ```
62
-
63
- Executing `run` without parameters, will show the usage patterns:
64
-
65
- ```
66
- $ run
67
- Usage:
68
- run greet <name>
69
- run (-h|--help|--version)
70
- ```
71
-
72
- Executing `run --help` will show the full help document (docopt)
73
-
74
- ```
75
- $ run --help
76
- Runfile 0.0.0
77
-
78
- Usage:
79
- run greet <name>
80
- run (-h|--help|--version)
81
-
82
- Options:
83
- -h --help
84
- Show this screen
85
-
86
- --version
87
- Show version
88
- ```
89
-
90
-
91
- Runfile per project or global Runfiles
92
- --------------------------------------------------
93
-
94
- In addition to the per project `Runfile` files, it is also possible to
95
- create global runfiles that are accessible to you only or to anybody on
96
- the system.
97
-
98
- When you execute `run`, we will look for files in this order:
99
-
100
- - `Runfile` in the current directory
101
- - `*.runfile` in the current directory
102
- - `~/runfile/**/*.runfile`
103
- - `/etc/runfile/**/*.runfile`
104
-
105
- When you execute `run!`, we will ignore any local Runfile and only search
106
- for global (named) runfiles.
107
-
108
- Read more in the [Runfile Location and Filename wiki page](https://github.com/DannyBen/runfile/wiki/Runfile-Location-and-Filename)
109
-
110
-
111
- Documentation
112
- --------------------------------------------------
113
-
114
- - [Learn by Example](https://github.com/DannyBen/runfile/tree/master/examples)
115
- - [Runfile Command Reference](https://github.com/DannyBen/runfile/wiki/Runfile-Command-Reference)
116
- - [Wiki](https://github.com/DannyBen/runfile/wiki)
117
- - [Rubydoc](http://www.rubydoc.info/gems/runfile)
1
+ Runfile - If Rake and Docopt had a baby
2
+ ==================================================
3
+
4
+ [![Gem](https://img.shields.io/gem/v/runfile.svg?style=flat-square)](https://rubygems.org/gems/runfile)
5
+ [![Travis](https://img.shields.io/travis/DannyBen/runfile.svg?style=flat-square)](https://travis-ci.org/DannyBen/runfile)
6
+ [![Code Climate](https://img.shields.io/codeclimate/github/DannyBen/runfile.svg?style=flat-square)](https://codeclimate.com/github/DannyBen/runfile)
7
+ [![Gemnasium](https://img.shields.io/gemnasium/DannyBen/runfile.svg?style=flat-square)](https://gemnasium.com/DannyBen/runfile)
8
+ [![Gem](https://img.shields.io/gem/dt/runfile.svg?style=flat-square)](https://rubygems.org/gems/runfile)
9
+
10
+ ---
11
+
12
+ A beautiful command line application framework.
13
+ Rake-inspired, Docopt inside.
14
+
15
+ ---
16
+
17
+ **Runfile** lets you create command line applications in a way similar
18
+ to [Rake](https://github.com/ruby/rake), but with the full power of
19
+ [Docopt](http://docopt.org/) command line options.
20
+
21
+ You create a `Runfile`, and execute commands with
22
+ `run command arguments -and --flags`.
23
+
24
+ ![Runfile Demo](https://raw.githubusercontent.com/DannyBen/runfile/master/demo.gif "Runfile Demo")
25
+
26
+ [Learn More in the Wiki](https://github.com/DannyBen/runfile/wiki)
27
+
28
+ ---
29
+
30
+ Install
31
+ --------------------------------------------------
32
+
33
+ $ gem install runfile
34
+
35
+
36
+ Quick Start
37
+ --------------------------------------------------
38
+
39
+ $ run new # create a new Runfile
40
+ $ run --help # show the usage patterns
41
+ $ vi Runfile # edit the Runfile
42
+
43
+
44
+ Example
45
+ --------------------------------------------------
46
+
47
+ The most minimal `Runfile` looks like this:
48
+
49
+ ```ruby
50
+ usage "greet <name>"
51
+ action :greet do |args|
52
+ puts "Hello #{args['<name>']}"
53
+ end
54
+ ```
55
+
56
+ You can then run it by executing this command:
57
+
58
+ ```
59
+ $ run greet Luke
60
+ Hello Luke
61
+ ```
62
+
63
+ Executing `run` without parameters, will show the usage patterns:
64
+
65
+ ```
66
+ $ run
67
+ Usage:
68
+ run greet <name>
69
+ run (-h|--help|--version)
70
+ ```
71
+
72
+ Executing `run --help` will show the full help document (docopt)
73
+
74
+ ```
75
+ $ run --help
76
+ Runfile 0.0.0
77
+
78
+ Usage:
79
+ run greet <name>
80
+ run (-h|--help|--version)
81
+
82
+ Options:
83
+ -h --help
84
+ Show this screen
85
+
86
+ --version
87
+ Show version
88
+ ```
89
+
90
+
91
+ Runfile per project or global Runfiles
92
+ --------------------------------------------------
93
+
94
+ In addition to the per project `Runfile` files, it is also possible to
95
+ create global runfiles that are accessible to you only or to anybody on
96
+ the system.
97
+
98
+ When you execute `run`, we will look for files in this order:
99
+
100
+ - `Runfile` in the current directory
101
+ - `*.runfile` in the current directory
102
+ - `~/runfile/**/*.runfile`
103
+ - `/etc/runfile/**/*.runfile`
104
+
105
+ When you execute `run!`, we will ignore any local Runfile and only search
106
+ for global (named) runfiles.
107
+
108
+ Read more in the [Runfile Location and Filename wiki page](https://github.com/DannyBen/runfile/wiki/Runfile-Location-and-Filename)
109
+
110
+
111
+ Documentation
112
+ --------------------------------------------------
113
+
114
+ - [Learn by Example](https://github.com/DannyBen/runfile/tree/master/examples)
115
+ - [Runfile Command Reference](https://github.com/DannyBen/runfile/wiki/Runfile-Command-Reference)
116
+ - [Wiki](https://github.com/DannyBen/runfile/wiki)
117
+ - [Rubydoc](http://www.rubydoc.info/gems/runfile)
data/bin/run CHANGED
@@ -5,6 +5,7 @@ require 'runfile'
5
5
  # for dev
6
6
  # require File.dirname(__FILE__) + "/../lib/runfile"
7
7
 
8
- include Runfile
8
+ include Colsole
9
+ include Runfile::DSL
9
10
 
10
- Runner.instance.execute ARGV
11
+ Runfile::Runner.instance.execute ARGV
data/bin/run! CHANGED
@@ -5,7 +5,8 @@ require 'runfile'
5
5
  # for dev
6
6
  # require File.dirname(__FILE__) + "/../lib/runfile"
7
7
 
8
- include Runfile
8
+ include Colsole
9
+ include Runfile::DSL
9
10
 
10
11
  # This is needed in cases when you are running "run!" from a folder
11
12
  # that contains a Gemfile on a machine with RVM.
@@ -13,4 +14,4 @@ include Runfile
13
14
  # Source: https://rvm.io/integration/bundler
14
15
  ENV['NOEXEC_DISABLE'] = '1'
15
16
 
16
- Runner.instance.execute ARGV, false
17
+ Runfile::Runner.instance.execute ARGV, false
@@ -2,13 +2,12 @@ require 'docopt'
2
2
  require 'colsole'
3
3
 
4
4
  module Runfile
5
- include Colsole
6
-
7
5
  # The DocoptHelper class handles the dynamic generation of the
8
6
  # docopt document and the docopt part of the execution (meaning,
9
7
  # to call Docopt so it returns the parsed arguments or halts with
10
8
  # usage message).
11
9
  class DocoptHelper
10
+ include Colsole
12
11
 
13
12
  # The constructor expects to get all the textual details
14
13
  # needed to generate a docopt document (name, version,
data/lib/runfile/dsl.rb CHANGED
@@ -3,119 +3,121 @@
3
3
  # for handling.
4
4
 
5
5
  module Runfile
6
- private
7
-
8
- # Set the name of your Runfile program
9
- # name 'My Runfile'
10
- def name(name)
11
- Runner.instance.name = name
12
- end
13
-
14
- # Set the version of your Runfile program
15
- # version '0.1.0'
16
- def version(ver)
17
- Runner.instance.version = ver
18
- end
19
-
20
- # Set the one line summary of your Runfile program
21
- # summary 'Utilities for my server'
22
- def summary(text)
23
- Runner.instance.summary = text
24
- end
25
-
26
- # Set the usage pattern for the next action
27
- # usage 'server [--background]'
28
- def usage(text)
29
- Runner.instance.last_usage = text
30
- end
31
-
32
- # Set the help message for the next action
33
- # help 'Starts the server in the foreground or background'
34
- def help(text)
35
- Runner.instance.last_help = text
36
- end
37
-
38
- # Add an option/flag to the next action (can be called multiple
39
- # times)
40
- # option '-b --background', 'Start in the background'
41
- def option(flag, text, scope=nil)
42
- Runner.instance.add_option flag, text, scope
43
- end
44
-
45
- # Set an example command (can be called multiple times)
46
- # example 'server --background'
47
- def example(text)
48
- Runner.instance.add_example text
49
- end
50
-
51
- # Define the action
52
- # action :server do |args|
53
- # run 'rails server'
54
- # end
55
- def action(name, altname=nil, &block)
56
- Runner.instance.add_action name, altname, &block
57
- end
58
-
59
- # Define a new command namespace
60
- # command 'server'
61
- # # ... define actions here
62
- # endcommand
63
- def command(name=nil)
64
- Runner.instance.namespace = name
65
- end
66
-
67
- # Cross-call another action
68
- # execute 'other_action'
69
- def execute(command_string)
70
- Runner.instance.cross_call command_string
71
- end
72
-
73
- # Run a command, wait until it is done and continue
74
- # run 'rails server'
75
- def run(*args)
76
- ExecHandler.instance.run *args
77
- end
78
-
79
- # Run a command, wait until it is done, then exit
80
- # run! 'rails server'
81
- def run!(*args)
82
- ExecHandler.instance.run! *args
83
- end
84
-
85
- # Run a command in the background, optionally log to a log file and save
86
- # the process ID in a pid file
87
- # run_bg 'rails server', pid: 'rails', log: 'tmp/log.log'
88
- def run_bg(*args)
89
- ExecHandler.instance.run_bg *args
90
- end
91
-
92
- # Stop a command started with 'run_bg'. Provide the name of he pid file you
93
- # used in 'run_bg'
94
- # stop_bg 'rails'
95
- def stop_bg(*args)
96
- ExecHandler.instance.stop_bg *args
97
- end
98
-
99
- # Set a block to be called before each run. The block should return
100
- # the command to run, since this is intended to let the block modify
101
- # the command if it needs to.
102
- # before_run do |command|
103
- # puts "BEFORE #{command}"
104
- # command
105
- # end
106
- def before_run(&block)
107
- ExecHandler.instance.before_run &block
108
- end
109
-
110
- # Set a block to be called after each run
111
- # before_run do |command|
112
- # puts "AFTER #{command}"
113
- # end
114
- def after_run(&block)
115
- ExecHandler.instance.after_run &block
116
- end
117
-
118
- # Also allow to use 'endcommand' instead of 'command' to end
119
- # a command namespace definition
120
- alias_method :endcommand, :command
121
- end
6
+ module DSL
7
+ private
8
+
9
+ # Set the name of your Runfile program
10
+ # name 'My Runfile'
11
+ def name(name)
12
+ Runner.instance.name = name
13
+ end
14
+
15
+ # Set the version of your Runfile program
16
+ # version '0.1.0'
17
+ def version(ver)
18
+ Runner.instance.version = ver
19
+ end
20
+
21
+ # Set the one line summary of your Runfile program
22
+ # summary 'Utilities for my server'
23
+ def summary(text)
24
+ Runner.instance.summary = text
25
+ end
26
+
27
+ # Set the usage pattern for the next action
28
+ # usage 'server [--background]'
29
+ def usage(text)
30
+ Runner.instance.last_usage = text
31
+ end
32
+
33
+ # Set the help message for the next action
34
+ # help 'Starts the server in the foreground or background'
35
+ def help(text)
36
+ Runner.instance.last_help = text
37
+ end
38
+
39
+ # Add an option/flag to the next action (can be called multiple
40
+ # times)
41
+ # option '-b --background', 'Start in the background'
42
+ def option(flag, text, scope=nil)
43
+ Runner.instance.add_option flag, text, scope
44
+ end
45
+
46
+ # Set an example command (can be called multiple times)
47
+ # example 'server --background'
48
+ def example(text)
49
+ Runner.instance.add_example text
50
+ end
51
+
52
+ # Define the action
53
+ # action :server do |args|
54
+ # run 'rails server'
55
+ # end
56
+ def action(name, altname=nil, &block)
57
+ Runner.instance.add_action name, altname, &block
58
+ end
59
+
60
+ # Define a new command namespace
61
+ # command 'server'
62
+ # # ... define actions here
63
+ # endcommand
64
+ def command(name=nil)
65
+ Runner.instance.namespace = name
66
+ end
67
+
68
+ # Cross-call another action
69
+ # execute 'other_action'
70
+ def execute(command_string)
71
+ Runner.instance.cross_call command_string
72
+ end
73
+
74
+ # Run a command, wait until it is done and continue
75
+ # run 'rails server'
76
+ def run(*args)
77
+ ExecHandler.instance.run *args
78
+ end
79
+
80
+ # Run a command, wait until it is done, then exit
81
+ # run! 'rails server'
82
+ def run!(*args)
83
+ ExecHandler.instance.run! *args
84
+ end
85
+
86
+ # Run a command in the background, optionally log to a log file and save
87
+ # the process ID in a pid file
88
+ # run_bg 'rails server', pid: 'rails', log: 'tmp/log.log'
89
+ def run_bg(*args)
90
+ ExecHandler.instance.run_bg *args
91
+ end
92
+
93
+ # Stop a command started with 'run_bg'. Provide the name of he pid file you
94
+ # used in 'run_bg'
95
+ # stop_bg 'rails'
96
+ def stop_bg(*args)
97
+ ExecHandler.instance.stop_bg *args
98
+ end
99
+
100
+ # Set a block to be called before each run. The block should return
101
+ # the command to run, since this is intended to let the block modify
102
+ # the command if it needs to.
103
+ # before_run do |command|
104
+ # puts "BEFORE #{command}"
105
+ # command
106
+ # end
107
+ def before_run(&block)
108
+ ExecHandler.instance.before_run &block
109
+ end
110
+
111
+ # Set a block to be called after each run
112
+ # before_run do |command|
113
+ # puts "AFTER #{command}"
114
+ # end
115
+ def after_run(&block)
116
+ ExecHandler.instance.after_run &block
117
+ end
118
+
119
+ # Also allow to use 'endcommand' instead of 'command' to end
120
+ # a command namespace definition
121
+ alias_method :endcommand, :command
122
+ end
123
+ end
data/lib/runfile/setup.rb CHANGED
@@ -1,19 +1,19 @@
1
- module Runfile
2
- class << self
3
- # Set the directory where PID files are stored when using `run_bg`
4
- # Runfile.pid_dir = 'tmp'
5
- attr_accessor :pid_dir
6
-
7
- # Disable echoing of the command when using `run` or `run!`
8
- # Runfile.quiet = true
9
- attr_accessor :quiet
10
-
11
- # You can also configure Runfile by providing a block:
12
- # Runfile.setup do |config|
13
- # config.quiet = true
14
- # end
15
- def setup
16
- yield self
17
- end
18
- end
1
+ module Runfile
2
+ class << self
3
+ # Set the directory where PID files are stored when using `run_bg`
4
+ # Runfile.pid_dir = 'tmp'
5
+ attr_accessor :pid_dir
6
+
7
+ # Disable echoing of the command when using `run` or `run!`
8
+ # Runfile.quiet = true
9
+ attr_accessor :quiet
10
+
11
+ # You can also configure Runfile by providing a block:
12
+ # Runfile.setup do |config|
13
+ # config.quiet = true
14
+ # end
15
+ def setup
16
+ yield self
17
+ end
18
+ end
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module Runfile
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-08 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.3'
19
+ version: '0.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.3'
26
+ version: '0.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: docopt
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,42 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.3'
61
+ version: '2.4'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.3'
68
+ version: '2.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec-expectations
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.4'
75
+ version: '3.5'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.4'
82
+ version: '3.5'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rdoc
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '4.2'
89
+ version: '4.3'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '4.2'
96
+ version: '4.3'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: similar_text
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.0.4
111
+ - !ruby/object:Gem::Dependency
112
+ name: byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '9.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '9.0'
111
125
  description: Build command line applications per project with ease. Rake-inspired,
112
126
  Docopt inside.
113
127
  email: db@dannyben.com