bundler-geminabox 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 081559b4721a05b3972971d7fb3c57a383ec5760
4
+ data.tar.gz: 826568045c34b5149a2d60a1823418199ffffc71
5
+ SHA512:
6
+ metadata.gz: 81ade12ace40df72db63dcf00a036ca776d71b478e8478fd0a96645ffeca379f1fc03c3b5b4e86775958c1ca4df20967e9b3d0ea96cff1ff03128139d04920e4
7
+ data.tar.gz: d2578ad4310b059daefec4f83109e23eab23cfa31bf3ae8a985afda4da80ff635b6fc435ba3c2a68eaba8d0049ee57fb1093e0fab0bd8089020be67f20364acd
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bundler-geminabox (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.0)
10
+ diff-lcs (1.2.5)
11
+ method_source (0.8.2)
12
+ pry (0.10.1)
13
+ coderay (~> 1.1.0)
14
+ method_source (~> 0.8.1)
15
+ slop (~> 3.4)
16
+ pry-nav (0.2.4)
17
+ pry (>= 0.9.10, < 0.11.0)
18
+ rake (10.3.2)
19
+ rspec (3.1.0)
20
+ rspec-core (~> 3.1.0)
21
+ rspec-expectations (~> 3.1.0)
22
+ rspec-mocks (~> 3.1.0)
23
+ rspec-core (3.1.7)
24
+ rspec-support (~> 3.1.0)
25
+ rspec-expectations (3.1.2)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.1.0)
28
+ rspec-mocks (3.1.3)
29
+ rspec-support (~> 3.1.0)
30
+ rspec-support (3.1.2)
31
+ slop (3.6.0)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ bundler (~> 1.6)
38
+ bundler-geminabox!
39
+ pry
40
+ pry-nav
41
+ rake
42
+ rspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Naotoshi Seo
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # Bundler::Geminabox
2
+
3
+ This gem provides `rake geminabox_release` command to release gem on internal rubygems server such as [geminabox](https://github.com/geminabox/geminabox),
4
+ and disable `rake release` command for foolproof.
5
+
6
+ ## Installation
7
+
8
+ Add following to your Gemfile:
9
+
10
+ ```
11
+ gem 'bundler-geminabox'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ ```
17
+ $ bundle
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ### How to release a gem
23
+
24
+ Modify Rakefile as:
25
+
26
+ ```diff
27
+ - require "bundler/gem_tasks"
28
+ + require "bundler/geminabox/gem_tasks"
29
+ ```
30
+
31
+ Run following to release your gem to your internal rubygems server:
32
+
33
+ ```
34
+ GEMINABOX=https://your.rubygems.org bundle exec rake geminabox_release
35
+ ```
36
+
37
+ Note that `rake release` is disabled not to release to rubygems.org mistakenly.
38
+
39
+ ### How to fetch gems from your.rubygems.jp
40
+
41
+ Write your application's Gemfile as:
42
+
43
+ ```ruby
44
+ source 'https://rubygems.org'
45
+ source 'https://your.rubygems.org' # latter gets query earlier
46
+
47
+ gem 'your_awesome_geminabox_gem'
48
+ ```
49
+
50
+ And then execute:
51
+
52
+ $ bundle
53
+
54
+ ### How to create a new gem
55
+
56
+ This gem also provides a command to create a skelton for a new gem to be released to https://your.rubygems.org
57
+
58
+ Run
59
+
60
+ ```
61
+ GEMINABOX=https://your.rubygems.org bundle-geminabox gem GEM
62
+ ```
63
+
64
+ instead of
65
+
66
+ ```
67
+ bundle gem GEM
68
+ ```
69
+
70
+ Example:
71
+
72
+ ```
73
+ $ GEMINABOX=https://your.rubygems.org bundle-geminabox gem foo
74
+ create foo/Gemfile
75
+ create foo/.gitignore
76
+ create foo/lib/foo.rb
77
+ create foo/lib/foo/version.rb
78
+ create foo/LICENSE.txt
79
+ create foo/foo.gemspec
80
+ create foo/.consolerc
81
+ create foo/Rakefile
82
+ create foo/README.md
83
+ force foo/Gemfile
84
+ force foo/Rakefile
85
+ ```
86
+
87
+ Note that `Gemfile` and `Rakefile` are updated.
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+
5
+ lib_dir = File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
6
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
7
+
8
+ require 'bundler/geminabox'
9
+
10
+ Bundler::Geminabox::CLI.start(ARGV, debug: true)
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+
5
+ lib_dir = File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
6
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
7
+
8
+ require 'bundler/geminabox'
9
+
10
+ Bundler::Geminabox::CLI.start(ARGV, debug: true)
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundler/geminabox/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bundler-geminabox"
8
+ spec.version = Bundler::Geminabox::VERSION
9
+ spec.authors = ["Naotoshi Seo"]
10
+ spec.email = ["sonots@gmail.com"]
11
+ spec.summary = %q{Provides rake geminabox_release to release gems to internal rubygems}
12
+ spec.description = %q{Provides rake geminabox_release to release gems to internal rubygems, and disable rake release}
13
+ spec.homepage = "https://github.com/sonots/bundler-geminabox"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "pry"
25
+ spec.add_development_dependency "pry-nav"
26
+ end
@@ -0,0 +1,28 @@
1
+ module Bundler
2
+ module Geminabox
3
+ class CLI::Gem
4
+ attr_reader :options, :gem_name, :thor
5
+ def initialize(options, gem_name, thor)
6
+ @options = options
7
+ @gem_name = gem_name
8
+ @thor = thor
9
+ end
10
+
11
+ def run
12
+ name = gem_name.chomp("/") # remove trailing slash if present
13
+ target = File.join(Dir.pwd, name)
14
+ underscored_name = name.tr('-', '_')
15
+ opts = {
16
+ :rubygems => ENV['GEMINABOX'] || 'https://your.rubygems.org',
17
+ :name => name,
18
+ :underscored_name => underscored_name,
19
+ :test => options[:test],
20
+ :ext => options[:ext]
21
+ }
22
+ opts[:force] = true
23
+ thor.template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"), opts)
24
+ thor.template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"), opts)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,22 @@
1
+ require 'bundler/cli'
2
+
3
+ module Bundler
4
+ module Geminabox
5
+ class CLI < Thor
6
+ include Thor::Actions
7
+
8
+ desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem"
9
+ method_option :ext, :type => :boolean, :default => false, :banner => "Generate the boilerplate for C extension code"
10
+ method_option :test, :type => :string, :lazy_default => 'rspec', :aliases => '-t', :banner =>
11
+ "Generate a test directory for your library: 'rspec' is the default, but 'minitest' is also supported."
12
+
13
+ def gem(name)
14
+ Bundler::CLI.start(ARGV, :debug => true)
15
+
16
+ require 'bundler/geminabox/cli/gem'
17
+ self.class.source_root(File.join(__dir__, 'templates'))
18
+ Gem.new(options, name, self).run
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,55 @@
1
+ require 'bundler/gem_helper'
2
+ require 'forwardable'
3
+
4
+ module Bundler
5
+ module Geminabox
6
+ class GemHelper
7
+ extend Forwardable
8
+ include Rake::DSL if defined? Rake::DSL
9
+
10
+ GEMINABOX = ENV['GEMINABOX'] || 'https://your.rubygems.org'
11
+
12
+ class << self
13
+ def install_tasks(opts = {})
14
+ obj = Bundler::GemHelper.new(opts[:dir], opts[:name])
15
+ obj.install
16
+ new(obj).install
17
+ end
18
+ end
19
+
20
+ def_delegators :@obj, :version_tag, :name, :version, :built_gem_path,
21
+ :guard_clean, :build_gem, :tag_version, :git_push, :already_tagged?, :gem_push?
22
+
23
+ def initialize(obj)
24
+ @obj = obj
25
+ end
26
+
27
+ def install
28
+ Rake::Task[:release].clear
29
+ desc "[WARN] Release to rubygems.org is prohibited, use rake geminabox_release."
30
+ task 'release' do
31
+ abort 'gem release to rubygems.org is prohibited.'
32
+ end
33
+
34
+ desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to #{GEMINABOX}"
35
+ task 'geminabox_release' => 'build' do
36
+ geminabox_release_gem(built_gem_path)
37
+ end
38
+ end
39
+
40
+ protected
41
+
42
+ def geminabox_release_gem(built_gem_path=nil)
43
+ guard_clean
44
+ built_gem_path ||= build_gem
45
+ tag_version { git_push } unless already_tagged?
46
+ geminabox_rubygem_push(built_gem_path) if gem_push? # custom
47
+ end
48
+
49
+ def geminabox_rubygem_push(path)
50
+ sh("gem push '#{path}' --host #{GEMINABOX}")
51
+ Bundler.ui.confirm "Pushed #{name} #{version} to #{GEMINABOX}."
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,2 @@
1
+ require 'bundler/geminabox/gem_helper'
2
+ Bundler::Geminabox::GemHelper.install_tasks
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+ source '<%=config[:rubygems]%>' # latter gets query earlier
3
+
4
+ # Specify your gem's dependencies in <%=config[:name]%>.gemspec
5
+ gemspec
@@ -0,0 +1,25 @@
1
+ require "bundler/geminabox/gem_tasks"
2
+
3
+ <% if config[:test] == 'minitest' -%>
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ end
9
+
10
+ task :default => :test
11
+ <% elsif config[:test] == 'rspec' -%>
12
+ require "rspec/core/rake_task"
13
+
14
+ RSpec::Core::RakeTask.new(:spec)
15
+
16
+ task :default => :spec
17
+ <% end -%>
18
+
19
+ <% if config[:ext] -%>
20
+ require "rake/extensiontask"
21
+
22
+ Rake::ExtensionTask.new("<%=config[:underscored_name]%>") do |ext|
23
+ ext.lib_dir = "lib/<%=config[:namespaced_path]%>"
24
+ end
25
+ <% end -%>
@@ -0,0 +1,5 @@
1
+ module Bundler
2
+ module Geminabox
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ require 'bundler/geminabox/version'
2
+ require 'bundler/geminabox/cli'
3
+
data/spec/cli_spec.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require 'bundler/geminabox/cli'
3
+
4
+ describe Bundler::Geminabox::CLI do
5
+ BIN_DIR = File.join(ROOT, 'bin')
6
+ TMP_DIR = File.join(ROOT, 'foo')
7
+
8
+ context 'bundle-geminabox gem' do
9
+ before :all do
10
+ system("GEMINABOX=https://rubygems.mydomain.com #{File.join(BIN_DIR, 'bundle-geminabox')} gem foo")
11
+ end
12
+
13
+ after :all do
14
+ FileUtils.rm_r(File.join(ROOT, 'foo'))
15
+ end
16
+
17
+ context 'Gemfile' do
18
+ subject { File.read(File.join(TMP_DIR, 'Gemfile')) }
19
+ it { expect(subject).to include("source 'https://rubygems.mydomain.com'") }
20
+ end
21
+
22
+ context 'Rakefile' do
23
+ subject { File.read(File.join(TMP_DIR, 'Rakefile')) }
24
+ it { expect(subject).to include('require "bundler/geminabox/gem_tasks"') }
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'bundler/geminabox/gem_tasks' do
4
+ context 'rake -T' do
5
+ it { expect(system("rake -T")).to be_truthy }
6
+ end
7
+ end
8
+
@@ -0,0 +1,2 @@
1
+ ROOT = File.expand_path('../../', __FILE__)
2
+ $LOAD_PATH.unshift File.join(ROOT, 'lib')
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler-geminabox
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Naotoshi Seo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-nav
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Provides rake geminabox_release to release gems to internal rubygems,
84
+ and disable rake release
85
+ email:
86
+ - sonots@gmail.com
87
+ executables:
88
+ - bundle-geminabox
89
+ - bundler-geminabox
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - Gemfile
94
+ - Gemfile.lock
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - bin/bundle-geminabox
99
+ - bin/bundler-geminabox
100
+ - bundler-geminabox.gemspec
101
+ - lib/bundler/geminabox.rb
102
+ - lib/bundler/geminabox/cli.rb
103
+ - lib/bundler/geminabox/cli/gem.rb
104
+ - lib/bundler/geminabox/gem_helper.rb
105
+ - lib/bundler/geminabox/gem_tasks.rb
106
+ - lib/bundler/geminabox/templates/newgem/Gemfile.tt
107
+ - lib/bundler/geminabox/templates/newgem/Rakefile.tt
108
+ - lib/bundler/geminabox/version.rb
109
+ - spec/cli_spec.rb
110
+ - spec/gem_tasks_spec.rb
111
+ - spec/spec_helper.rb
112
+ homepage: https://github.com/sonots/bundler-geminabox
113
+ licenses:
114
+ - MIT
115
+ metadata: {}
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 2.2.2
133
+ signing_key:
134
+ specification_version: 4
135
+ summary: Provides rake geminabox_release to release gems to internal rubygems
136
+ test_files:
137
+ - spec/cli_spec.rb
138
+ - spec/gem_tasks_spec.rb
139
+ - spec/spec_helper.rb