runfile-tasks 0.4.0

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: 5dd4e3a43cf9f25dff922b382652fd3ee38a8623
4
+ data.tar.gz: f0f6d668c56f41a1175170a6d33c7e7e1ddc1073
5
+ SHA512:
6
+ metadata.gz: a0fc8373f66062b000aae5faa41caf41c41c89335ecfd5ab632821e72130e40e70d71ac212eb86b61939811dce63d3879d6a54c06d5f66d6e4849cf1da4cb17b
7
+ data.tar.gz: 174ef213dc3d9b13e4e960d7558cf24bb55c7c175336c23c17bf2ae1f7bcf70c75b909f73c8778c52ec7edcf8ff00e50cb6c1774d638a8de68006f053c43309d
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ Runfile Tasks
2
+ =============
3
+
@@ -0,0 +1 @@
1
+ require "runfile-tasks/all"
@@ -0,0 +1,5 @@
1
+ require "runfile-tasks/version"
2
+
3
+ require "runfile-tasks/rubygems"
4
+ require "runfile-tasks/docs"
5
+ require "runfile-tasks/testing"
@@ -0,0 +1 @@
1
+ require 'runfile-tasks/docs/all'
@@ -0,0 +1 @@
1
+ require 'runfile-tasks/docs/rdoc'
@@ -0,0 +1,25 @@
1
+ module RunfileTasks
2
+ module Docs
3
+ extend self
4
+
5
+ @@default_rdoc_options = [
6
+ "--main README.md",
7
+ "--all",
8
+ ]
9
+
10
+ def rdoc(files=nil, options=@@default_rdoc_options)
11
+ files or files = Dir['**/*.{rb,md}']
12
+ files = "'" + files.join("' '") + "'"
13
+ usage "rdoc [-- <options>...]"
14
+ help "Generate documentation using the rdoc command line tool. To pass arguments to rdoc, place them after '--'."
15
+ action :rdoc do |args|
16
+ inopts = args['<options>']
17
+ options = inopts unless inopts.empty?
18
+ options = options.join(' ')
19
+ cmd = "rdoc #{options} #{files}"
20
+ say "!txtgrn!Running: !txtpur!#{cmd}"
21
+ system cmd
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1 @@
1
+ require 'runfile-tasks/rubygems/all'
@@ -0,0 +1 @@
1
+ require 'runfile-tasks/rubygems/rubygems'
@@ -0,0 +1,64 @@
1
+ require 'fileutils'
2
+
3
+ module RunfileTasks
4
+ module RubyGems
5
+ extend self
6
+
7
+ def all(gemname, gemdir="gems")
8
+ command "gem"
9
+
10
+ spec = Gem::Specification::load "#{gemname}.gemspec"
11
+ spec or abort "Error loading #{gemname}.gemspec"
12
+ gemver = spec.version.to_s
13
+
14
+ usage "build [--install]"
15
+ help "Build gem from gemspec and move it to '#{gemdir}' folder.\nUse --install to also install it."
16
+ action :build do |args|
17
+ say "!txtgrn!Building gem"
18
+ cmd = "gem build #{gemname}.gemspec"
19
+ say "!txtgrn!Running: !txtpur!#{cmd}"
20
+ system cmd
21
+ say "!txtgrn!Moving gem file to #{gemdir}"
22
+ files = Dir["*.gem"]
23
+ Dir.exist? gemdir or FileUtils.mkdir gemdir
24
+ files.each {|f| FileUtils.mv f, gemdir }
25
+ args['--install'] and call "gem install"
26
+ end
27
+
28
+ usage "install [--remote]"
29
+ help "Install gem from local gem file or from rubygems (--remote)."
30
+ action :install do |args|
31
+ if args['--remote']
32
+ cmd = "gem install #{gemname}"
33
+ else
34
+ gemfile = "gems/#{gemname}-#{gemver}.gem"
35
+ cmd = "gem install #{gemfile}"
36
+ end
37
+ say "!txtgrn!Running: !txtpur!#{cmd}"
38
+ system cmd
39
+ end
40
+
41
+ help "Publish gem to rubygems. Make sure to 'run gem build' before you publish."
42
+ action :publish do
43
+ gemfile = "gems/#{gemname}-#{gemver}.gem"
44
+ File.exist? gemfile or abort "File not found #{gemfile}"
45
+ cmd = "gem push #{gemfile}"
46
+ say "!txtgrn!Running: !txtpur!#{cmd}"
47
+ system cmd
48
+ end
49
+
50
+ usage "yank [<version>]"
51
+ help "Yank gem from rubygems."
52
+ action :yank do |args|
53
+ ver = args['<version>'] || gemver
54
+ cmd = "gem yank #{gemname} -v #{ver}"
55
+ say "!txtgrn!Running: !txtpur!#{cmd}"
56
+ system cmd
57
+ end
58
+
59
+ endcommand
60
+ end
61
+
62
+ end
63
+
64
+ end
@@ -0,0 +1 @@
1
+ require "runfile-tasks/testing/all"
@@ -0,0 +1,3 @@
1
+ require 'runfile-tasks/testing/minitest'
2
+ require 'runfile-tasks/testing/rspec'
3
+ require 'runfile-tasks/testing/cucumber'
@@ -0,0 +1,16 @@
1
+ module RunfileTasks
2
+ module Testing
3
+ extend self
4
+
5
+ def cucumber
6
+ usage "(feature|features) [current]"
7
+ help "Run cucumber feature tests"
8
+ action :feature, :features do |args|
9
+ cmd = "cucumber"
10
+ cmd = "#{cmd} --tags @current" if args['current']
11
+ exec cmd
12
+ end
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ module RunfileTasks
2
+ module Testing
3
+ extend self
4
+
5
+ def minitest(pattern="./test/*_test.rb")
6
+ usage "test [<name>]"
7
+ help "Run all tests or a single test file."
8
+ action :test do |args|
9
+ if args['<name>']
10
+ file = pattern.sub "*", args['<name>']
11
+ say "!txtgrn!Using: !txtpur!#{file}"
12
+ require file
13
+ else
14
+ Dir[pattern].each do |file|
15
+ say "!txtgrn!Using: !txtpur!#{file}"
16
+ require file
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,32 @@
1
+ module RunfileTasks
2
+ module Testing
3
+ extend self
4
+
5
+ def rspec(opts={})
6
+ opts = { action: opts } if opts.is_a? String
7
+
8
+ opts = {
9
+ action: 'spec',
10
+ pattern: './spec/**/*_spec.rb',
11
+ command: 'rspec'
12
+ }.merge opts
13
+
14
+ usage "#{opts[:action]} [<name>]"
15
+ help "Run all specs or a single spec file matching a regex."
16
+ action opts[:action].to_sym do |args|
17
+ if args['<name>']
18
+ files = Dir[opts[:pattern]]
19
+ files.select! { |file| file =~ /#{args['<name>']}/i }
20
+ abort "Cannot find a matching spec file with #{opts[:pattern]}" if files.empty?
21
+ file = files.first
22
+ cmd = "#{opts[:command]} \"#{file}\""
23
+ else
24
+ cmd = "#{opts[:command]}"
25
+ end
26
+ say "!txtgrn!Running: !txtpur!#{cmd}"
27
+ system cmd
28
+ end
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,3 @@
1
+ module RunfileTasks
2
+ VERSION = "0.4.0"
3
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: runfile-tasks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Danny Ben Shitrit
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: runfile
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.5'
27
+ description: A collection of tasks for Runfile
28
+ email: db@dannyben.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - README.md
34
+ - lib/runfile-tasks.rb
35
+ - lib/runfile-tasks/all.rb
36
+ - lib/runfile-tasks/docs.rb
37
+ - lib/runfile-tasks/docs/all.rb
38
+ - lib/runfile-tasks/docs/rdoc.rb
39
+ - lib/runfile-tasks/rubygems.rb
40
+ - lib/runfile-tasks/rubygems/all.rb
41
+ - lib/runfile-tasks/rubygems/rubygems.rb
42
+ - lib/runfile-tasks/testing.rb
43
+ - lib/runfile-tasks/testing/all.rb
44
+ - lib/runfile-tasks/testing/cucumber.rb
45
+ - lib/runfile-tasks/testing/minitest.rb
46
+ - lib/runfile-tasks/testing/rspec.rb
47
+ - lib/runfile-tasks/version.rb
48
+ homepage: https://github.com/DannyBen/runfile-tasks
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.4.6
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Runfile tasks collection
72
+ test_files: []