rubygems-tasks 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -1
  3. data/.travis.yml +9 -0
  4. data/ChangeLog.md +8 -0
  5. data/LICENSE.txt +1 -1
  6. data/README.md +22 -12
  7. data/Rakefile +4 -49
  8. data/gemspec.yml +10 -4
  9. data/lib/rubygems/tasks.rb +140 -2
  10. data/lib/rubygems/tasks/build/gem.rb +0 -2
  11. data/lib/rubygems/tasks/build/tar.rb +0 -2
  12. data/lib/rubygems/tasks/build/task.rb +9 -14
  13. data/lib/rubygems/tasks/console.rb +0 -3
  14. data/lib/rubygems/tasks/install.rb +1 -1
  15. data/lib/rubygems/tasks/project.rb +3 -3
  16. data/lib/rubygems/tasks/push.rb +2 -2
  17. data/lib/rubygems/tasks/sign/checksum.rb +3 -2
  18. data/lib/rubygems/tasks/sign/pgp.rb +1 -1
  19. data/lib/rubygems/tasks/sign/task.rb +13 -17
  20. data/lib/rubygems/tasks/task.rb +7 -7
  21. data/rubygems-tasks.gemspec +38 -87
  22. data/spec/console_spec.rb +10 -14
  23. data/spec/install_spec.rb +1 -1
  24. data/spec/project_spec.rb +30 -27
  25. data/spec/projects/bundler-project/.gitignore +17 -0
  26. data/spec/projects/bundler-project/Gemfile +4 -0
  27. data/spec/projects/bundler-project/LICENSE +22 -0
  28. data/spec/projects/bundler-project/README.md +29 -0
  29. data/spec/projects/bundler-project/Rakefile +2 -0
  30. data/spec/projects/bundler-project/bundler-project.gemspec +19 -0
  31. data/spec/projects/bundler-project/lib/bundler-project.rb +7 -0
  32. data/spec/projects/bundler-project/lib/bundler-project/version.rb +5 -0
  33. data/spec/projects/rubygems-multi-project/.gitignore +17 -0
  34. data/spec/projects/rubygems-multi-project/LICENSE.txt +22 -0
  35. data/spec/projects/rubygems-multi-project/README.md +21 -0
  36. data/spec/projects/rubygems-multi-project/lib/rubygems/project/version.rb +5 -0
  37. data/spec/projects/rubygems-multi-project/rubygems-project-lite.gemspec +19 -0
  38. data/spec/projects/rubygems-multi-project/rubygems-project.gemspec +19 -0
  39. data/spec/projects/rubygems-project/.gitignore +17 -0
  40. data/spec/projects/rubygems-project/LICENSE.txt +22 -0
  41. data/spec/projects/rubygems-project/README.md +21 -0
  42. data/spec/projects/rubygems-project/lib/rubygems/project/version.rb +5 -0
  43. data/spec/projects/rubygems-project/rubygems-project.gemspec +19 -0
  44. data/spec/push_spec.rb +2 -2
  45. data/spec/rake_context.rb +1 -3
  46. data/spec/scm/push_spec.rb +7 -7
  47. data/spec/scm/status_spec.rb +6 -6
  48. data/spec/scm/tag_spec.rb +18 -18
  49. data/spec/sign/pgp_spec.rb +1 -1
  50. data/spec/spec_helper.rb +25 -8
  51. data/spec/tasks_spec.rb +195 -55
  52. metadata +89 -83
  53. data/lib/rubygems/tasks/tasks.rb +0 -147
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e30996ab5613db9af366535a259cac3855b8e656a8611b2c6bdf3ed1f657e6a0
4
+ data.tar.gz: f432dd0dc3df8a8ce075afb54f90a39cb2ff3308eda13be9de632273dd65ae76
5
+ SHA512:
6
+ metadata.gz: a3440f9a95b1e17fcb735fc4172b220d3cb271ef075eca0cbb405dcc6f7ea73bc2f038e4fd4835bf3774ec6af65fc2b84f8fd2956379f91eabd4b9c0f31b7080
7
+ data.tar.gz: a7522d3f00a6f4cb132049296d0e53fc0be2ee3927ab46595cdf320c43c35570363790be15c455108f3284a1d1bf3877ea37f8dd964db74bd1b90102c645966f
data/.gitignore CHANGED
@@ -1,3 +1,2 @@
1
1
  doc/
2
2
  pkg/
3
- data/projects/
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ before_install:
3
+ - sudo apt-get install git subversion mercurial
4
+ - gem install rspec -v "~> 3.0"
5
+ rvm:
6
+ - 2.5
7
+ - 2.6
8
+ - 2.7
9
+ - jruby
@@ -1,3 +1,11 @@
1
+ ### 0.2.5 / 2020-03-02
2
+
3
+ * Require Ruby >= 2.0.0.
4
+ * Added irb as a dependencies.
5
+ * Fixed issue where `file` tasks were defined in namespaces resulting in task
6
+ names such as `namespace:path/to/file` instead of simply `path/to/file`.
7
+ * Set gemspec license to MIT.
8
+
1
9
  ### 0.2.4 / 2013-04-8
2
10
 
3
11
  * Use the new `Gem::Package` class when running under Ruby 2.0.0.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2013 Hal Brodigan
1
+ Copyright (c) 2011-2020 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # rubygems-tasks
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/postmodern/rubygems-tasks.png?branch=master)](https://travis-ci.org/postmodern/rubygems-tasks)
4
+
3
5
  * [Source](https://github.com/postmodern/rubygems-tasks)
4
6
  * [Issues](https://github.com/postmodern/rubygems-tasks/issues)
5
7
  * [Email](mailto:postmodern.mod3 at gmail.com)
@@ -33,7 +35,7 @@ This is what rubygems-tasks seeks to provide.
33
35
  * Provides tasks to build, install and push gems to [rubygems.org].
34
36
  * Loads all project metadata from the `.gemspec` file.
35
37
  * Supports loading multiple `.gemspec` files.
36
- * Supports pushing gems to alternate [Gemcutter] servers.
38
+ * Supports pushing gems to alternate [gem server]s.
37
39
  * Supports optionally building `.tar.gz` and `.zip` archives.
38
40
  * `build:tar`
39
41
  * `build:zip`
@@ -55,6 +57,11 @@ This is what rubygems-tasks seeks to provide.
55
57
  * **Does not** inject dependencies into gems.
56
58
  * **Zero** dependencies.
57
59
 
60
+ ## Requirements
61
+
62
+ * [ruby] >= 2.0.0
63
+ * [rake]
64
+
58
65
  ## Install
59
66
 
60
67
  $ gem install rubygems-tasks
@@ -67,7 +74,7 @@ Specifying an alternate Ruby Console to run:
67
74
  tasks.console.command = 'pry'
68
75
  end
69
76
 
70
- Enable pushing gems to an in-house [Gemcutter] server:
77
+ Enable pushing gems to an in-house [gem server]:
71
78
 
72
79
  Gem::Tasks.new do |tasks|
73
80
  tasks.push.host = 'gems.company.com'
@@ -75,23 +82,23 @@ Enable pushing gems to an in-house [Gemcutter] server:
75
82
 
76
83
  Disable the `push` task:
77
84
 
78
- Gem::Tasks.new(:push => false)
85
+ Gem::Tasks.new(push: false)
79
86
 
80
87
  Enable building `.tar.gz` and `.zip` archives:
81
88
 
82
- Gem::Tasks.new(:build => {:tar => true, :zip => true})
89
+ Gem::Tasks.new(build: {tar: true, zip: true})
83
90
 
84
91
  Enable Checksums and PGP signatures for built packages:
85
92
 
86
- Gem::Tasks.new(:sign => {:checksum => true, :pgp => true})
93
+ Gem::Tasks.new(sign: {checksum: true, pgp: true})
87
94
 
88
95
  Selectively defining tasks:
89
96
 
90
- Gem::Build::Tar.new
91
- Gem::SCM::Status.new
92
- Gem::SCM::Tag.new(:format => 'REL-%s')
93
- Gem::Sign::Checksum.new
94
- Gem::Console.new
97
+ Gem::Tasks::Build::Tar.new
98
+ Gem::Tasks::SCM::Status.new
99
+ Gem::Tasks::SCM::Tag.new(format: 'REL-%s')
100
+ Gem::Tasks::Sign::Checksum.new
101
+ Gem::Tasks::Console.new
95
102
 
96
103
  ## Synopsis
97
104
 
@@ -102,7 +109,7 @@ Selectively defining tasks:
102
109
 
103
110
  ## Copyright
104
111
 
105
- Copyright (c) 2011-2013 Hal Brodigan
112
+ Copyright (c) 2011-2020 Hal Brodigan
106
113
 
107
114
  See {file:LICENSE.txt} for details.
108
115
 
@@ -114,4 +121,7 @@ See {file:LICENSE.txt} for details.
114
121
  [Hoe]: https://github.com/seattlerb/hoe#readme
115
122
 
116
123
  [rubygems.org]: https://rubygems.org/
117
- [Gemcutter]: https://github.com/rubygems/rubygems.org#readme
124
+ [gem server]: https://github.com/rubygems/rubygems.org#readme
125
+
126
+ [ruby]: https://www.ruby-lang.org/
127
+ [rake]: https://rubygems.org/gems/rake
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'rake'
3
2
 
4
3
  lib_dir = File.expand_path('lib',File.dirname(__FILE__))
@@ -6,12 +5,12 @@ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
6
5
 
7
6
  require 'rubygems/tasks'
8
7
  Gem::Tasks.new(
9
- :build => {:gem => true, :tar => true},
10
- :sign => {:checksum => true, :pgp => true}
8
+ build: {gem: true, tar: true},
9
+ sign: {checksum: true, pgp: true}
11
10
  )
12
11
 
13
12
  begin
14
- gem 'rspec', '~> 2.4'
13
+ gem 'rspec', '~> 3.0'
15
14
  require 'rspec/core/rake_task'
16
15
 
17
16
  RSpec::Core::RakeTask.new
@@ -24,7 +23,7 @@ task :test => :spec
24
23
  task :default => :spec
25
24
 
26
25
  begin
27
- gem 'yard', '~> 0.7'
26
+ gem 'yard', '~> 0.8'
28
27
  require 'yard'
29
28
 
30
29
  YARD::Rake::YardocTask.new
@@ -33,47 +32,3 @@ rescue LoadError => e
33
32
  abort 'Please run `gem install yard` to install YARD.'
34
33
  end
35
34
  end
36
-
37
- require 'net/https'
38
- require 'uri'
39
-
40
- DOWNLOAD_URI = 'http://cloud.github.com/downloads/postmodern/rubygems-tasks/'
41
- PROJECTS_DIR = File.join('data','projects')
42
- PROJECTS = %w[rubygems-project rubygems-multi-project bundler-project]
43
-
44
- directory PROJECTS_DIR
45
-
46
- PROJECTS.each do |project|
47
- project_file = "#{project}.tar.gz"
48
- project_path = File.join(PROJECTS_DIR,project_file)
49
- project_dir = File.join(PROJECTS_DIR,project)
50
-
51
- file project_path => PROJECTS_DIR do
52
- Net::HTTP.get_response(URI(DOWNLOAD_URI + project_file)) do |response|
53
- size, total = 0, response.header['Content-Length'].to_i
54
-
55
- puts ">>> Downloading to #{project_file} to #{project_path} ..."
56
-
57
- File.open(project_path,"wb") do |file|
58
- response.read_body do |chunk|
59
- file.write(chunk)
60
-
61
- size += chunk.size
62
- printf "\r>>> [%d / %d] %d%% ...", size, total, ((size * 100) / total)
63
- end
64
- end
65
-
66
- puts
67
- end
68
- end
69
-
70
- task project_dir => project_path do
71
- unless File.directory?(project_dir)
72
- sh 'tar', 'xzf', project_path, '-C', PROJECTS_DIR
73
- end
74
- end
75
-
76
- task 'data:projects' => project_dir
77
- end
78
-
79
- task :spec => 'data:projects'
@@ -1,14 +1,20 @@
1
1
  name: rubygems-tasks
2
- version: 0.2.4
2
+ version: 0.2.5
3
3
  summary: Rake tasks for managing and releasing Ruby Gems.
4
- description:
4
+ description: |
5
5
  Agnostic and unobtrusive Rake tasks for managing and releasing Ruby Gems.
6
6
 
7
7
  authors: Postmodern
8
+ license: MIT
8
9
  email: postmodern.mod3@gmail.com
9
10
  homepage: https://github.com/postmodern/rubygems-tasks#readme
10
11
  has_yard: true
11
12
 
13
+ required_ruby_version: ">= 2.0.0"
14
+
15
+ dependencies:
16
+ irb: ~> 1.0
17
+
12
18
  development_dependencies:
13
- rspec: ~> 2.4
14
- yard: ~> 0.7
19
+ rspec: ~> 3.0
20
+ yard: ~> 0.8
@@ -2,8 +2,146 @@ require 'rubygems/tasks/console'
2
2
  require 'rubygems/tasks/build'
3
3
  require 'rubygems/tasks/install'
4
4
  require 'rubygems/tasks/scm'
5
- require 'rubygems/tasks/scm'
6
5
  require 'rubygems/tasks/push'
7
6
  require 'rubygems/tasks/release'
8
7
  require 'rubygems/tasks/sign'
9
- require 'rubygems/tasks/tasks'
8
+
9
+ require 'rake/tasklib'
10
+ require 'ostruct'
11
+
12
+ module Gem
13
+ #
14
+ # Defines basic Rake tasks for managing and releasing projects:
15
+ #
16
+ # * {Build::Gem build:gem}
17
+ # * {Build::Tar build:tar}
18
+ # * {Build::Zip build:zip}
19
+ # * {SCM::Status scm:status}
20
+ # * {SCM::Push scm:push}
21
+ # * {SCM::Tag scm:tag}
22
+ # * {Console console}
23
+ # * {Install install}
24
+ # * {Push push}
25
+ # * {Release release}
26
+ # * {Sign::Checksum sign:checksum}
27
+ # * {Sign::PGP sign:pgp}
28
+ #
29
+ class Tasks
30
+
31
+ #
32
+ # The `build` tasks.
33
+ #
34
+ # @return [OpenStruct]
35
+ # The collection of `build` tasks.
36
+ #
37
+ attr_reader :build
38
+
39
+ #
40
+ # The `scm` tasks.
41
+ #
42
+ # @return [OpenStruct]
43
+ # The collection of `scm` tasks.
44
+ #
45
+ attr_reader :scm
46
+
47
+ #
48
+ # The `sign` tasks.
49
+ #
50
+ # @return [OpenStruct]
51
+ # The collection of `sign` tasks.
52
+ #
53
+ attr_reader :sign
54
+
55
+ # The {Console console} task.
56
+ attr_reader :console
57
+
58
+ # The {Install install} task.
59
+ attr_reader :install
60
+
61
+ # The {Push push} task.
62
+ attr_reader :push
63
+
64
+ # The {Release release} task.
65
+ attr_reader :release
66
+
67
+ #
68
+ # Initializes the project tasks.
69
+ #
70
+ # @param [Hash{Symbol => Hash}] options
71
+ # Enables or disables individual tasks.
72
+ #
73
+ # @option options [Hash{Symbol => Boolean}] :build
74
+ # Enables or disables the `build` tasks.
75
+ #
76
+ # @option options [Hash{Symbol => Boolean}] :scm
77
+ # Enables or disables the `scm` tasks.
78
+ #
79
+ # @option options [Boolean] :console (true)
80
+ # Enables or disables the {Console console} task.
81
+ #
82
+ # @option options [Boolean] :install (true)
83
+ # Enables or disables the {Install install} task.
84
+ #
85
+ # @option options [Boolean] :push (true)
86
+ # Enables or disables the {Push push} task.
87
+ #
88
+ # @option options [Boolean] :release (true)
89
+ # Enables or disables the {Release release} task.
90
+ #
91
+ # @option options [Hash{Symbol => Boolean}] :sign
92
+ # Enables or disables the `sign` tasks.
93
+ #
94
+ # @yield [tasks]
95
+ # If a block is given, it will be passed the newly created tasks,
96
+ # before they are fully defined.
97
+ #
98
+ # @yieldparam [Tasks] tasks
99
+ # The newly created tasks.
100
+ #
101
+ # @example Enables building of `.gem` and `.tar.gz` packages:
102
+ # Gem::Tasks.new(build: {gem: true, tar: true})
103
+ #
104
+ # @example Disables pushing `.gem` packages to [rubygems.org](rubygems.org):
105
+ # Gem::Tasks.new(push: false)
106
+ #
107
+ # @example Configures the version tag format:
108
+ # Gem::Tasks.new do |tasks|
109
+ # tasks.scm.tag.format = "release-%s"
110
+ # end
111
+ #
112
+ def initialize(options={})
113
+ build_options = options.fetch(:build,{})
114
+ scm_options = options.fetch(:scm,{})
115
+ sign_options = options.fetch(:sign,{})
116
+
117
+ @scm = OpenStruct.new
118
+ @build = OpenStruct.new
119
+ @sign = OpenStruct.new
120
+
121
+ if build_options
122
+ @build.gem = (Build::Gem.new if build_options.fetch(:gem,true))
123
+ @build.tar = (Build::Tar.new if build_options[:tar])
124
+ @build.zip = (Build::Zip.new if build_options[:zip])
125
+ end
126
+
127
+ if scm_options
128
+ @scm.status = (SCM::Status.new if scm_options.fetch(:status,true))
129
+ @scm.tag = (SCM::Tag.new if scm_options.fetch(:tag,true))
130
+ @scm.push = (SCM::Push.new if scm_options.fetch(:push,true))
131
+ end
132
+
133
+ if sign_options
134
+ @sign.checksum = (Sign::Checksum.new if sign_options[:checksum])
135
+ @sign.pgp = (Sign::PGP.new if sign_options[:pgp])
136
+ end
137
+
138
+ @console = (Console.new if options.fetch(:console,true))
139
+ @install = (Install.new if options.fetch(:install,true))
140
+ @push = (Push.new if options.fetch(:push,true))
141
+ @release = (Release.new if options.fetch(:release,true))
142
+
143
+ yield self if block_given?
144
+ end
145
+
146
+ end
147
+ end
@@ -1,7 +1,5 @@
1
1
  require 'rubygems/tasks/build/task'
2
2
 
3
- require 'fileutils'
4
-
5
3
  if Gem::VERSION > '2.' then require 'rubygems/package'
6
4
  else require 'rubygems/builder'
7
5
  end
@@ -1,7 +1,5 @@
1
1
  require 'rubygems/tasks/build/task'
2
2
 
3
- require 'set'
4
-
5
3
  module Gem
6
4
  class Tasks
7
5
  module Build
@@ -34,25 +34,20 @@ module Gem
34
34
  task :validate
35
35
 
36
36
  @project.builds.each do |build,packages|
37
- namespace :build do
38
- namespace name do
39
- gemspec = @project.gemspecs[build]
40
- path = packages[extname]
37
+ gemspec = @project.gemspecs[build]
38
+ path = packages[extname]
41
39
 
42
- # define file tasks, so the packages are not needless re-built
43
- file(path => [Project::PKG_DIR, *gemspec.files]) do
44
- invoke :validate
40
+ # define file tasks, so the packages are not needless re-built
41
+ file(path => [Project::PKG_DIR, *gemspec.files]) do
42
+ invoke :validate
45
43
 
46
- status "Building #{File.basename(path)} ..."
44
+ status "Building #{File.basename(path)} ..."
47
45
 
48
- build(path,gemspec)
49
- end
50
-
51
- task build => path
52
- end
46
+ build(path,gemspec)
53
47
  end
54
48
 
55
- task "build:#{build}" => "build:#{name}:#{build}"
49
+ task "build:#{name}:#{build}" => path
50
+ task "build:#{build}" => "build:#{name}:#{build}"
56
51
  end
57
52
 
58
53
  gemspec_tasks "build:#{name}"
@@ -77,9 +77,6 @@ module Gem
77
77
  # add -I options for lib/ or ext/ directories
78
78
  arguments.push(*require_paths.map { |dir| "-I#{dir}" })
79
79
 
80
- # add a -rrubygems to explicitly load rubygems on Ruby 1.8
81
- arguments.push('-rrubygems') if RUBY_VERSION < '1.9'
82
-
83
80
  # add an -r option to require the library
84
81
  arguments.push('-r' + require_file)
85
82
 
@@ -54,7 +54,7 @@ module Gem
54
54
  # @api semipublic
55
55
  #
56
56
  def install(path)
57
- run 'gem', 'install', '-q', path
57
+ gem 'install', '-q', path
58
58
  end
59
59
 
60
60
  end