fasten 0.7.0 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d815525a239cf976ae822a2a08d5c3be07ec006c07c7af991c68ce9bcf19b56
4
- data.tar.gz: a9be85ef4553f17a9629315e55e6beb1dd28ed1db4c447964909826e5cd2650e
3
+ metadata.gz: 11979aaa284fe109e187356c936bd43c51099e2cd19c2b2376b32bd272026940
4
+ data.tar.gz: 1a3ac4ff25cf4beaf38e0964adf200a51c9556e3b743fd1074320a29d35eef99
5
5
  SHA512:
6
- metadata.gz: 3278db70005e8503299247c54eea40b4469de82e8729a4a839aa6d166070a96c4a71d1284d5bd3ab6702b19d080dddf74ef7a29ccc7a37a4308b452c2e854dbe
7
- data.tar.gz: 43cc2129b54bfd13f4863cbc528e6d00ccf2a016976b389ff7a9dc6fbceff14f68e5b0d8ce555a28c6692ecb41f1ebfbfcc93dcaf0db4f9e1b21d3ad7de75464
6
+ metadata.gz: 616e6c45931550b4a9abd0b4484947758e3be7386d5a7ef53532b56f761cee58026978b71752f8631cd8ce8a105251a2736ecda0f0f5c9b3c83cf936669e8919
7
+ data.tar.gz: bd0f916f1577983c3d5e51527a61c0e2f699c74c10706a94a3848339c65f784e66370fb6233631f4bd4bac1d6adb7171ec4bb0bca5aa9e50f4b12f6aed3c0014
data/.gitignore CHANGED
@@ -9,6 +9,7 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
- .fasten
12
+ /fasten/log
13
+ /demo/fasten/log
13
14
  *.testfile
14
15
  .DS_Store
@@ -10,6 +10,16 @@ Metrics/BlockLength:
10
10
  - 'Rakefile'
11
11
  - '**/*.rake'
12
12
  - 'spec/**/*.rb'
13
+ - 'fasten.gemspec'
14
+ Metrics:
15
+ Exclude:
16
+ - 'lib/fasten/ui/curses.rb'
17
+ Naming:
18
+ Exclude:
19
+ - 'lib/fasten/ui/curses.rb'
20
+ Style:
21
+ Exclude:
22
+ - 'lib/fasten/ui/curses.rb'
13
23
  Metrics/AbcSize:
14
24
  Max: 17
15
25
  Metrics/MethodLength:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fasten (0.7.0)
4
+ fasten (0.7.2)
5
5
  binding_of_caller
6
6
  hirb
7
7
  os
data/README.md CHANGED
@@ -23,8 +23,8 @@ It has been released so people can try it and make feature requests, comments an
23
23
  - [x] process are preferred on POSIX systems, otherwise threads are used
24
24
  - [x] default number of workers is the # of real cpu cores on the system
25
25
  - [x] in case of task Error or Exception, the whole run will be stopped
26
- - [x] runner saves a log file in `$(pwd)/.fasten/log/runner/*name_of_runner*.log`
27
- - [x] each task saves its STDERR/STDOUT to a log file in `$(pwd)/.fasten/log/task/*name_of_task*.log`
26
+ - [x] runner saves a log file in `$(pwd)/fasten/log/runner/*name_of_runner*.log`
27
+ - [x] each task saves its STDERR/STDOUT to a log file in `$(pwd)/fasten/log/task/*name_of_task*.log`
28
28
  - [x] once finished, statistics are saved in `$HOME/.fasten/stats/*name_of_runner*.csv`, which include: status (DONE, FAIL), duration, average, stdev, error and count
29
29
  - [x] display a summary table of the execution
30
30
 
@@ -73,7 +73,7 @@ Or install it yourself as:
73
73
 
74
74
  ## Usage
75
75
 
76
- TODO: Write usage instructions here. See spec for sample code.
76
+ TODO: Write usage instructions here. Right now, check spec directory for sample code.
77
77
 
78
78
  ## Development
79
79
 
@@ -83,7 +83,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
83
83
 
84
84
  ## Contributing
85
85
 
86
- Bug reports and pull requests are welcome on GitHub at https://github.com/a0/fasten. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
86
+ Bug reports and pull requests are welcome on GitHub at https://github.com/a0/a0-fasten-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
87
87
 
88
88
  ## License
89
89
 
@@ -91,4 +91,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
91
91
 
92
92
  ## Code of Conduct
93
93
 
94
- Everyone interacting in the Fasten project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/a0/fasten/blob/master/CODE_OF_CONDUCT.md).
94
+ Everyone interacting in the Fasten project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/a0/a0-fasten-ruby/blob/master/CODE_OF_CONDUCT.md).
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = 'Fasten your seatbelts! Run jobs in parallel, intelligently.'
13
13
  spec.description = 'Fasten your seatbelts! Run jobs in parallel, intelligently.'
14
- spec.homepage = 'https://github.com/a0/fasten/'
14
+ spec.homepage = 'https://github.com/a0/a0-fasten-ruby/'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
@@ -35,6 +35,10 @@ module Fasten
35
35
  runner(**options).register(&block)
36
36
  end
37
37
 
38
+ def default_name
39
+ File.basename(Dir.getwd)
40
+ end
41
+
38
42
  def default_workers
39
43
  Parallel.physical_processor_count
40
44
  end
@@ -75,21 +79,29 @@ module Fasten
75
79
  return @opt_parser if defined? @opt_parser
76
80
 
77
81
  @options = { developer: false }
82
+ @load_path = []
78
83
 
79
84
  @opt_parser = OptionParser.new do |opts|
80
- opts.banner = "Usage: #{$PROGRAM_NAME} [options] FILE/DIRECTORY"
85
+ opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
81
86
  opts.separator ''
82
- opts.separator 'Example: fasten --name deploy --summary deploy_script.rb'
87
+ opts.separator 'Examples:'
88
+ opts.separator ' fasten # load and run all task from fasten/*_fasten.rb'
89
+ opts.separator ' fasten -f tasks.rb # load task from ruby script'
90
+ opts.separator ' fasten -y tasks.yml # load task from yaml file'
83
91
  opts.separator ''
84
92
  opts.separator 'Options:'
85
93
 
86
- opts.on '-n NAME', '--name=NAME', String, 'Name of this runner, used to display and save stats' do |name|
94
+ opts.on '-n NAME', '--name=NAME', String, "Change name of this runner (default: #{default_name} from current directory)" do |name|
87
95
  @options[:name] = name
88
96
  end
97
+ opts.on '-f PATH', '--file=PATH', String, 'File or folder with ruby code' do |path|
98
+ @load_path << path
99
+ end
89
100
  opts.on '-w WORKERS', '--workers=WORKERS', Numeric, "Number of processes/threads to use (default: #{default_workers} on this machine)" do |workers|
90
101
  @options[:workers] = workers
91
102
  end
92
103
  opts.on '-s', '--[no-]summary', TrueClass, 'Display summary at the end of execution' do |boolean|
104
+ puts "SUMMAMRY: #{boolean}"
93
105
  @options[:summary] = boolean
94
106
  end
95
107
  opts.on '--ui=UI', String, "Type of UI: curses, console. (default: #{default_ui_mode} on this machine)" do |ui_mode|
@@ -120,10 +132,10 @@ module Fasten
120
132
  def invoke
121
133
  opt_parser.parse!
122
134
 
123
- show_help if ARGV.length.zero?
135
+ runner @options
136
+ load_fasten @load_path
124
137
 
125
- runner(@options)
126
- load_fasten ARGV
138
+ show_help if runner.task_list.empty?
127
139
 
128
140
  runner.perform
129
141
  end
@@ -22,16 +22,16 @@ module Fasten
22
22
 
23
23
  attr_accessor :name, :workers, :worker_class, :fasten_dir, :developer, :stats, :summary, :ui_mode, :worker_list, :use_threads, :queue
24
24
 
25
- def initialize(name: nil,
25
+ def initialize(name: Fasten.default_name,
26
26
  developer: Fasten.default_developer, summary: nil, ui_mode: Fasten.default_ui_mode, workers: Fasten.default_workers,
27
- worker_class: Worker, fasten_dir: '.fasten', use_threads: !OS.posix?)
27
+ worker_class: Worker, fasten_dir: 'fasten', use_threads: !OS.posix?)
28
28
  reconfigure(name: name, developer: developer, summary: summary, ui_mode: ui_mode, workers: workers,
29
29
  worker_class: worker_class, fasten_dir: fasten_dir, use_threads: use_threads)
30
30
  end
31
31
 
32
32
  def reconfigure(**options)
33
33
  self.stats = options[:name] && true if options[:name] || options.key?(:stats)
34
- self.name = options[:name] || "#{self.class} #{$PID}" if options.key?(:name)
34
+ self.name = options[:name] || "#{self.class.to_s.gsub('::', '-')}-#{$PID}" if options.key?(:name)
35
35
  self.workers = options[:workers] if options.key?(:workers)
36
36
  self.worker_class = options[:worker_class] if options.key?(:worker_class)
37
37
  self.fasten_dir = options[:fasten_dir] if options.key?(:fasten_dir)
@@ -225,7 +225,7 @@ module Fasten
225
225
 
226
226
  unless worker
227
227
  @worker_id = (@worker_id || 0) + 1
228
- worker = worker_class.new runner: self, name: "#{worker_class}-#{format '%02X', @worker_id}", use_threads: use_threads
228
+ worker = worker_class.new runner: self, name: "#{worker_class.to_s.gsub('::', '-')}-#{format '%02X', @worker_id}", use_threads: use_threads
229
229
  worker.start
230
230
  worker_list << worker
231
231
 
@@ -12,7 +12,7 @@ module Fasten
12
12
  Fasten::UI::Console.new(runner: self)
13
13
  end
14
14
  rescue StandardError, LoadError
15
- @ui = Fasten::UI::Console.new(runner: self)
15
+ @ui ||= Fasten::UI::Console.new(runner: self)
16
16
  end
17
17
 
18
18
  def run_ui
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fasten
4
- VERSION = '0.7.0'
4
+ VERSION = '0.7.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fasten
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldrin Martoq
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-07 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -191,7 +191,7 @@ files:
191
191
  - lib/fasten/ui/curses.rb
192
192
  - lib/fasten/version.rb
193
193
  - lib/fasten/worker.rb
194
- homepage: https://github.com/a0/fasten/
194
+ homepage: https://github.com/a0/a0-fasten-ruby/
195
195
  licenses:
196
196
  - MIT
197
197
  metadata: