run-gem-dev 0.1.2 → 0.1.3

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: 8384400d2fed3a7e13b975cc131cd24725566d7b
4
- data.tar.gz: b511593f4c8a460b038876d547ae12da884c463c
3
+ metadata.gz: a8852b79f7c805890bb95af6c1c48c1d7050b4dd
4
+ data.tar.gz: 5b56626ea677a9836d5ae2668a922f5139a8161d
5
5
  SHA512:
6
- metadata.gz: 4e60c0c146e5671db7e492055c337171b1f6c1f7a06ccbcb622dab6e4c59b43bfedd4d9f52380e6cf0f1e1d19b6ddc9ea8a1d2cd6bdce6697a098da9d6785e1e
7
- data.tar.gz: 192a6ed53997c7cfb9a11a1e44f4238ef46a35668c985bb9f554ed60e14780236907cca4aa876e259cd4def5800da4256ec0a78a1bc42c8ef747c12af2cb9799
6
+ metadata.gz: d38bc615d650149ad85f4f5bc9bbc8a4f42362244f32c9e3bdeaad04d36dde5c9620bd6c2e62e49fd4cdfd1891411dc6b23cd31700bf7f231e9821261c3da23f
7
+ data.tar.gz: 625ec6632cf0d7eaca59cefaae5c74e422289b1c4322a8a345ab47e43a9204cfd2aad479c5c571a20e7872a53c22b7c189f674a9935820f576918d28b21b1471
data/README.md CHANGED
@@ -20,22 +20,30 @@ name "My Gem Runfile"
20
20
  summary "Tasks for my gem"
21
21
  version "0.1.0"
22
22
 
23
- RunGemDev::Tasks.embed 'run-gem-dev'
23
+ # Add rubygems tasks (publish, install etc.)
24
+ RunGemDev::gem_tasks 'my-gem-name'
25
+
26
+ # Add test task (minitest)
27
+ RunGemDev::test_tasks
28
+
29
+ # Add rdoc task
30
+ RunGemDev::rdoc_tasks
24
31
 
25
32
  # Your other tasks here
33
+ # ...
26
34
 
27
35
  ```
28
36
 
29
37
  ## Available Tasks
30
38
 
31
- run gem build [<folder>]
32
- run gem install
39
+ run gem build [--install]
40
+ run gem install [--remote]
33
41
  run gem publish
34
42
  run gem yank [<version>]
35
- run gem test [<name>]
36
-
43
+ run test [<name>]
44
+ run rdoc [-- <options>...]
45
+ run addtest <command>
37
46
 
38
47
  ## Todo
39
48
 
40
- - Docs
41
49
  - Add `init` (scaffold gemspec and folders)
@@ -1,61 +1,98 @@
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
1
7
 
2
8
  module RunGemDev
3
- def self.tasks(gemname, gemdir="gems")
9
+
10
+ @@default_rdoc_options = [
11
+ "--main README.md",
12
+ "--all",
13
+ ]
14
+
15
+
16
+ # Add rubygems tasks: build, install, publish and yank
17
+ def self.gem_tasks(gemname, gemdir="gems")
4
18
  command "gem"
5
19
 
6
20
  spec = Gem::Specification::load "#{gemname}.gemspec"
7
21
  spec or abort "Error loading #{gemname}.gemspec"
8
22
  gemver = spec.version.to_s
9
-
23
+
10
24
  usage "build [--install]"
11
25
  help "Build gem from gemspec and move it to '#{gemdir}' folder.\nUse --install to also install it."
12
26
  action :build do |args|
13
- say "Building gem..."
27
+ say "!txtgrn!Building gem"
14
28
  cmd = "gem build #{gemname}.gemspec"
15
- say "Running: #{cmd}"
29
+ say "!txtgrn!Running: !txtpur!#{cmd}"
16
30
  system cmd
17
- say "Moving to #{gemdir}..."
31
+ say "!txtgrn!Moving gem file to #{gemdir}"
18
32
  files = Dir["*.gem"]
19
33
  files.each {|f| FileUtils.mv f, gemdir }
20
34
  args['--install'] and call "gem install"
21
35
  end
22
36
 
23
- help "Install local gem"
24
- action :install do
25
- gemfile = "gems/#{gemname}-#{gemver}.gem"
26
- cmd = "gem install #{gemfile}"
27
- say "Running: #{cmd}"
37
+ usage "install [--remote]"
38
+ help "Install gem from local gem file or from rubygems (--remote)."
39
+ action :install do |args|
40
+ if args['--remote']
41
+ cmd = "gem install #{gemname}"
42
+ else
43
+ gemfile = "gems/#{gemname}-#{gemver}.gem"
44
+ cmd = "gem install #{gemfile}"
45
+ end
46
+ say "!txtgrn!Running: !txtpur!#{cmd}"
28
47
  system cmd
29
48
  end
30
49
 
31
- help "Publish gem to rubygems"
50
+ help "Publish gem to rubygems. Make sure to 'run gem build' before you publish."
32
51
  action :publish do
33
52
  gemfile = "gems/#{gemname}-#{gemver}.gem"
34
53
  File.exist? gemfile or abort "File not found #{gemfile}"
35
54
  cmd = "gem push #{gemfile}"
36
- say "Running: #{cmd}"
55
+ say "!txtgrn!Running: !txtpur!#{cmd}"
37
56
  system cmd
38
57
  end
39
58
 
40
59
  usage "yank [<version>]"
41
- help "Yank gem from rubygems"
60
+ help "Yank gem from rubygems."
42
61
  action :yank do |args|
43
62
  ver = args['<version>'] || gemver
44
63
  cmd = "gem yank #{gemname} -v #{ver}"
45
- say "Running: #{cmd}"
64
+ say "!txtgrn!Running: !txtpur!#{cmd}"
46
65
  system cmd
47
- end
66
+ end
67
+
68
+ endcommand
69
+ end
48
70
 
71
+ # Add minitest task
72
+ def self.test_tasks
49
73
  usage "test [<name>]"
50
- help "Run all tests or a single test file"
74
+ help "Run all tests or a single test file."
51
75
  action :test do |args|
52
76
  name = args['<name>'] || "*"
53
77
  cmd = "ruby -Itest test/test_#{name}.rb"
54
- say "Running: #{cmd}"
78
+ say "!txtgrn!Running: !txtpur!#{cmd}"
55
79
  system cmd
56
80
  end
57
-
58
- endcommand
59
81
  end
60
82
 
83
+ # Add rdoc task
84
+ def self.rdoc_tasks(files=nil, options=@@default_rdoc_options)
85
+ files or files = Dir['**/*.{rb,md}']
86
+ files = "'" + files.join("' '") + "'"
87
+ usage "rdoc [-- <options>...]"
88
+ help "Generate documentation using the rdoc command line tool. To pass arguments to rdoc, place them after '--'."
89
+ action :rdoc do |args|
90
+ inopts = args['<options>']
91
+ options = inopts unless inopts.empty?
92
+ options = options.join(' ')
93
+ cmd = "rdoc #{options} #{files}"
94
+ say "!txtgrn!Running: !txtpur!#{cmd}"
95
+ system cmd
96
+ end
97
+ end
61
98
  end
@@ -1,3 +1,5 @@
1
1
  module RunGemDev
2
- VERSION = "0.1.2"
2
+
3
+ # Version constant, used by gemspec
4
+ VERSION = "0.1.3"
3
5
  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.1.2
4
+ version: 0.1.3
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-27 00:00:00.000000000 Z
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: runfile