run-gem-dev 0.2.1 → 0.3.0

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
  SHA1:
3
- metadata.gz: 9f4becc4c33f12c3e9ef070640d59997a4996fea
4
- data.tar.gz: 09f19e7a4201de89c06e0e03ecc4087a03955645
3
+ metadata.gz: 0ff8b646a7a71c811dee5e09ec8a239f680cb95e
4
+ data.tar.gz: 0d5bb97562ceb39e2922e527d1da8782a1baa651
5
5
  SHA512:
6
- metadata.gz: 652402d9065a6a08249d5dfb228d63f7902b0a339e0e112e87c19a3e9732cbe5427d749560f10098a01d3c8c1126dbddce21254a4c2e6202c9be3096c706e28a
7
- data.tar.gz: b80b6b21b1947ccc55d1d199799db1388755b79e15406e5550254defe5946175e37e8ccd1715c3aa50005a8a9b0a071652574cc228ab75f5869b37baecceca6c
6
+ metadata.gz: d3de7b053629412a4c343da5df2092979adfdbdaebd71ee833135217acdd2957e2a24d0cf901f700e0e9d87b7df583ac9639a3cb14d143c018b99e17b08acc62
7
+ data.tar.gz: 747c8baaf45c19396719e583405213e1dd672402b8117359c6bade1358c9c5593f1b2a97c4dc39f9d6008f31d3c3c4d2b61adff2b2a9377d0d69035b58f3228b
data/README.md CHANGED
@@ -2,6 +2,7 @@ Run Gem Dev
2
2
  ===========
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/run-gem-dev.svg)](http://badge.fury.io/rb/run-gem-dev)
5
+ [![Build Status](https://travis-ci.org/DannyBen/run-gem-dev.svg?branch=master)](https://travis-ci.org/DannyBen/run-gem-dev)
5
6
 
6
7
  [Runfile](https://github.com/DannyBen/runfile) tasks for gem developers.
7
8
 
@@ -26,6 +27,9 @@ RunGemDev::gem_tasks 'my-gem-name'
26
27
  # Add test task (minitest)
27
28
  RunGemDev::minitest_tasks
28
29
 
30
+ # Add rspec task
31
+ RunGemDev::rspec_tasks
32
+
29
33
  # Add rdoc task
30
34
  RunGemDev::rdoc_tasks
31
35
 
@@ -41,5 +45,6 @@ RunGemDev::rdoc_tasks
41
45
  run gem publish
42
46
  run gem yank [<version>]
43
47
  run test [<name>]
48
+ run spec [<name>]
44
49
  run rdoc [-- <options>...]
45
50
 
@@ -1,2 +1,5 @@
1
1
  require "run-gem-dev/version"
2
- require "run-gem-dev/tasks"
2
+ require "run-gem-dev/gem_tasks"
3
+ require "run-gem-dev/rdoc_tasks"
4
+ require "run-gem-dev/minitest_tasks"
5
+ require "run-gem-dev/rspec_tasks"
@@ -1,21 +1,7 @@
1
- # This module provides Runfile tasks for gem developers.
2
- # The tasks are divided to three categories:
3
- #
4
- # 1. Rubygems tasks (publish, build etc)
5
- # 2. Tests tasks (using minitest)
6
- # 3. Rdoc tasks
7
-
8
1
  require 'fileutils'
9
2
 
10
3
  module RunGemDev
11
4
 
12
- @@default_rdoc_options = [
13
- "--main README.md",
14
- "--all",
15
- ]
16
-
17
-
18
- # Add rubygems tasks: build, install, publish and yank
19
5
  def self.gem_tasks(gemname, gemdir="gems")
20
6
  command "gem"
21
7
 
@@ -32,6 +18,7 @@ module RunGemDev
32
18
  system cmd
33
19
  say "!txtgrn!Moving gem file to #{gemdir}"
34
20
  files = Dir["*.gem"]
21
+ Dir.exist? gemdir or FileUtils.mkdir gemdir
35
22
  files.each {|f| FileUtils.mv f, gemdir }
36
23
  args['--install'] and call "gem install"
37
24
  end
@@ -70,37 +57,4 @@ module RunGemDev
70
57
  endcommand
71
58
  end
72
59
 
73
- # Add minitest task
74
- def self.minitest_tasks(pattern="./test/test_*.rb")
75
- usage "test [<name>]"
76
- help "Run all tests or a single test file."
77
- action :test do |args|
78
- if args['<name>']
79
- file = pattern.sub "*", args['<name>']
80
- say "!txtgrn!Using: !txtpur!#{file}"
81
- require file
82
- else
83
- Dir[pattern].each do |file|
84
- say "!txtgrn!Using: !txtpur!#{file}"
85
- require file
86
- end
87
- end
88
- end
89
- end
90
-
91
- # Add rdoc task
92
- def self.rdoc_tasks(files=nil, options=@@default_rdoc_options)
93
- files or files = Dir['**/*.{rb,md}']
94
- files = "'" + files.join("' '") + "'"
95
- usage "rdoc [-- <options>...]"
96
- help "Generate documentation using the rdoc command line tool. To pass arguments to rdoc, place them after '--'."
97
- action :rdoc do |args|
98
- inopts = args['<options>']
99
- options = inopts unless inopts.empty?
100
- options = options.join(' ')
101
- cmd = "rdoc #{options} #{files}"
102
- say "!txtgrn!Running: !txtpur!#{cmd}"
103
- system cmd
104
- end
105
- end
106
60
  end
@@ -0,0 +1,20 @@
1
+ module RunGemDev
2
+
3
+ def self.minitest_tasks(pattern="./test/*_test.rb")
4
+ usage "test [<name>]"
5
+ help "Run all tests or a single test file."
6
+ action :test do |args|
7
+ if args['<name>']
8
+ file = pattern.sub "*", args['<name>']
9
+ say "!txtgrn!Using: !txtpur!#{file}"
10
+ require file
11
+ else
12
+ Dir[pattern].each do |file|
13
+ say "!txtgrn!Using: !txtpur!#{file}"
14
+ require file
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,23 @@
1
+ module RunGemDev
2
+
3
+ @@default_rdoc_options = [
4
+ "--main README.md",
5
+ "--all",
6
+ ]
7
+
8
+ def self.rdoc_tasks(files=nil, options=@@default_rdoc_options)
9
+ files or files = Dir['**/*.{rb,md}']
10
+ files = "'" + files.join("' '") + "'"
11
+ usage "rdoc [-- <options>...]"
12
+ help "Generate documentation using the rdoc command line tool. To pass arguments to rdoc, place them after '--'."
13
+ action :rdoc do |args|
14
+ inopts = args['<options>']
15
+ options = inopts unless inopts.empty?
16
+ options = options.join(' ')
17
+ cmd = "rdoc #{options} #{files}"
18
+ say "!txtgrn!Running: !txtpur!#{cmd}"
19
+ system cmd
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,29 @@
1
+ module RunGemDev
2
+
3
+ def self.rspec_tasks(opts={})
4
+ opts = { action: opts } if opts.is_a? String
5
+
6
+ opts = {
7
+ action: 'spec',
8
+ pattern: './spec/**/*_spec.rb',
9
+ command: 'rspec'
10
+ }.merge opts
11
+
12
+ usage "#{opts[:action]} [<name>]"
13
+ help "Run all specs or a single spec file matching a regex."
14
+ action opts[:action].to_sym do |args|
15
+ if args['<name>']
16
+ files = Dir[opts[:pattern]]
17
+ files.select! { |file| file =~ /#{args['<name>']}/i }
18
+ abort "Cannot find a matching spec file with #{opts[:pattern]}" if files.empty?
19
+ file = files.first
20
+ cmd = "#{opts[:command]} \"#{file}\""
21
+ else
22
+ cmd = "#{opts[:command]}"
23
+ end
24
+ say "!txtgrn!Running: !txtpur!#{cmd}"
25
+ system cmd
26
+ end
27
+ end
28
+
29
+ end
@@ -1,5 +1,3 @@
1
1
  module RunGemDev
2
-
3
- # Version constant, used by gemspec
4
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
5
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run-gem-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
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: 2015-05-30 00:00:00.000000000 Z
11
+ date: 2016-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: runfile
@@ -60,7 +60,10 @@ extra_rdoc_files: []
60
60
  files:
61
61
  - README.md
62
62
  - lib/run-gem-dev.rb
63
- - lib/run-gem-dev/tasks.rb
63
+ - lib/run-gem-dev/gem_tasks.rb
64
+ - lib/run-gem-dev/minitest_tasks.rb
65
+ - lib/run-gem-dev/rdoc_tasks.rb
66
+ - lib/run-gem-dev/rspec_tasks.rb
64
67
  - lib/run-gem-dev/version.rb
65
68
  homepage: https://github.com/DannyBen/run-gem-dev
66
69
  licenses:
@@ -82,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
85
  version: '0'
83
86
  requirements: []
84
87
  rubyforge_project:
85
- rubygems_version: 2.4.7
88
+ rubygems_version: 2.4.6
86
89
  signing_key:
87
90
  specification_version: 4
88
91
  summary: Runfile tasks for gem developers