bundler-gem-hg 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ N2FjMTI0NjcyYWY1NmI3M2EwNThhOGRkZTNkMTc3Y2U2ZjMwYTU5Nw==
5
+ data.tar.gz: !binary |-
6
+ MGMzYmQ1Y2QyZDkwM2EwMmU5NGIyYjA5MjNmNDM1Y2QxMjNiMjVmMg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NjA2YWZhZGRiYTU4NmU0ZWNiN2ZiNzlkNWU1ZGFhYTNlYTM3Y2UxYTdhMTY3
10
+ Njc3MDQzN2NlZmVjZWI4ZjVlMzNlMTMwOTQ5YmZlZGJlMWVhMjMzNjU3OTEw
11
+ YWE5NWZlN2NhOTAxZWY4MzkwNDA5MGMwZDRlYzEwMzRjOTNmOWQ=
12
+ data.tar.gz: !binary |-
13
+ ZTRiMzY1ZmZlYTE2OTFjMWFjNzE4ZGExMmM4NDlmNWM1ZGFkYmI5OTdkZTVi
14
+ MTM4ZDI3NzQ4MjgyNDVlZDI0MzFiNjg5ZTk2MTljMjY2YmIxMDU4M2I5Y2Nh
15
+ OWQwYzQxYjc4ZDkyMDFmMTVmYjkwZTZlYWJmYTAxZWEwMWRjY2I=
@@ -0,0 +1,24 @@
1
+ syntax: glob
2
+ *.gem
3
+ *.rbc
4
+ *~
5
+ .bundle
6
+ .config
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ *.bundle
21
+ *.so
22
+ *.o
23
+ *.a
24
+ mkmf.log
data/.hgtags ADDED
@@ -0,0 +1,2 @@
1
+ 899ac04240f06ac133111bcc4a15bb40bab33219 v1.0.0
2
+ 3bc614fcdc508580459dacb088ee4b45993dc528 v1.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bundler-gem-hg.gemspec
4
+ gemspec
@@ -0,0 +1,14 @@
1
+ bundler-gem-hg - Develop gem with bundler rake tasks and mercurial
2
+ Copyright (c) 2014 Alessio Caiazza
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License.
7
+
8
+ This program is distributed in the hope that it will be useful,
9
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ GNU General Public License for more details.
12
+
13
+ You should have received a copy of the GNU General Public License
14
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -0,0 +1,32 @@
1
+ # Bundler::Gem::Hg
2
+
3
+ This gem will allow you to develop gems using mercurial instead of git.
4
+
5
+ ## Installation
6
+
7
+ Install it yourself as:
8
+
9
+ $ gem install bundler-gem-hg
10
+
11
+ ## Usage
12
+
13
+ `bundle-gem-hg` will inject some monkey-patched code into bundler and
14
+ then execute `bundle gem ALL_YOUR_PARAMS`.
15
+
16
+ If you want to see the available options use `bundle help gem`.
17
+
18
+ ## Contributing
19
+
20
+ Firstoff, any model to be used by people should consist of simple, consistent
21
+ rules. Programming is complex enough without having to worry about elaborate
22
+ branching directives. Therefore this model boils down to 3 simple rules:
23
+
24
+ 1. you do all the work on default - except for hotfixes.
25
+ 2. on stable you only do hotfixes, merges for release and tagging for
26
+ release. Only maintainers touch stable.
27
+ 3. you can use arbitrary feature-branches, as long as you don't call
28
+ them default or stable. They always start at default (since you do
29
+ all the work on default).
30
+
31
+ A more detailed explaination can be found online at
32
+ http://draketo.de/light/english/mercurial/complete-branching-strategy
@@ -0,0 +1,3 @@
1
+ # -*- mode: ruby -*-
2
+ require "bundler-gem-hg/gem_tasks"
3
+
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler'
4
+ begin
5
+ # Check if an older version of bundler is installed
6
+ $:.each do |path|
7
+ if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
8
+ err = "Please remove Bundler 0.8 versions."
9
+ err << "This can be done by running `gem cleanup bundler`."
10
+ abort(err)
11
+ end
12
+ end
13
+ require 'bundler/cli'
14
+ require 'bundler-gem-hg/cli'
15
+ #invoke the gem task
16
+ Bundler::CLI.start(["gem"] + ARGV)
17
+ rescue Bundler::BundlerError => e
18
+ Bundler.ui.error e.message
19
+ Bundler.ui.debug e.backtrace.join("\n")
20
+ exit e.status_code
21
+ rescue Interrupt => e
22
+ Bundler.ui.error "\nQuitting..."
23
+ Bundler.ui.debug e.backtrace.join("\n")
24
+ exit 1
25
+ rescue SystemExit => e
26
+ exit e.status
27
+ rescue Exception => e
28
+ Bundler.ui.error "Unfortunately, a fatal error has occurred. " +
29
+ "Please report this error to the Bundler issue tracker at " +
30
+ "https://github.com/carlhuda/bundler/issues so that we can fix it. " +
31
+ "Please include the full output of the command, your Gemfile and Gemfile.lock. " +
32
+ "Thanks!"
33
+ raise e
34
+ end
@@ -0,0 +1,24 @@
1
+ # -*- mode: ruby encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundler-gem-hg/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bundler-gem-hg"
8
+ spec.version = Bundler::GemHg::VERSION
9
+ spec.authors = ["Alessio Caiazza"]
10
+ spec.email = ["nolith@abisso.org"]
11
+ spec.summary = %q{Develop gem with bundler rake tasks and mercurial}
12
+ spec.description = %q{This gem will allow you to develop gems using mercurial instead of git}
13
+ spec.homepage = "https://bitbucket.org/nolith/bundler-gem-hg"
14
+ spec.license = "GPL3"
15
+ spec.platform = Gem::Platform::RUBY
16
+
17
+ spec.files = `hg locate -0`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "bundler", "~> 1.6"
23
+ spec.add_dependency "rake"
24
+ end
@@ -0,0 +1,7 @@
1
+ require "bundler-gem-hg/version"
2
+
3
+ module Bundler
4
+ module GemHg
5
+
6
+ end
7
+ end
@@ -0,0 +1,60 @@
1
+ #require 'bundler/vendored_thor'
2
+ #require 'rubygems/user_interaction'
3
+ #require 'rubygems/config_file'
4
+
5
+ require 'bundler/cli'
6
+
7
+ #Monkey-patching
8
+ module Bundler
9
+ class CLI
10
+
11
+ # desc "gem GEM", "Creates a skeleton for creating a rubygem using mercurial instead of git"
12
+ # method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :banner => "Generate a binary for your library."
13
+ def gem(name)
14
+ require 'bundler-gem-hg/cli/hg_gem'
15
+ Bundler::CLI::HgGem.new(options, name, self).run
16
+
17
+ # name = name.chomp("/") # remove trailing slash if present
18
+ # target = File.join(Dir.pwd, name)
19
+ # constant_name = name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
20
+ # constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
21
+ # constant_array = constant_name.split('::')
22
+ # FileUtils.mkdir_p(File.join(target, 'lib', name))
23
+ # hg_username = `hg showconfig | grep ui.username`.chomp
24
+ # author, email = if hg_username.empty? || hg_username.split("=",2).size < 2
25
+ # [ "TODO: Write your name", "TODO: Write your email address"]
26
+ # else
27
+ # full_email = hg_username.split("=",2)[1]
28
+ # splitted = full_email.split(/\s/)
29
+ # [splitted[0...-1].join(" "), splitted[-1].gsub(/<|>/,"")]
30
+ # end
31
+ # opts = {
32
+ # :name => name,
33
+ # :constant_name => constant_name,
34
+ # :constant_array => constant_array,
35
+ # :author => author,
36
+ # :email => email
37
+ # }
38
+ # template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"), opts)
39
+ # template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"), opts)
40
+ # template(File.join("newgem/LICENSE.tt"), File.join(target, "LICENSE"), opts)
41
+ # template(File.join("newgem/README.md.tt"), File.join(target, "README.md"), opts)
42
+ # template(File.join("newgem/newgem.gemspec.tt"), File.join(target, "#{name}.gemspec"), opts)
43
+ # template(File.join("newgem/lib/newgem.rb.tt"), File.join(target, "lib/#{name}.rb"), opts)
44
+ # template(File.join("newgem/lib/newgem/version.rb.tt"), File.join(target, "lib/#{name}/version.rb"), opts)
45
+ # if options[:bin]
46
+ # template(File.join("newgem/bin/newgem.tt"), File.join(target, 'bin', name), opts)
47
+ # end
48
+
49
+ # if options[:hg]
50
+ # template(File.join("newgem/hgignore.tt"), File.join(target, ".hgignore"), opts)
51
+ # init_blk = Proc.new { `hg init .`; `hg addremove`}
52
+ # else
53
+ # template(File.join("newgem/gitignore.tt"), File.join(target, ".gitignore"), opts)
54
+ # init_blk = Proc.new { `git init`; `git add .` }
55
+ # end
56
+ # Bundler.ui.info "Initializating #{options[:hg] ? 'hg' : 'git'} repo in #{target}"
57
+ # Dir.chdir(target, &init_blk)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,40 @@
1
+ require 'bundler/cli/gem'
2
+ require 'bundler-gem-hg/version'
3
+
4
+ module Bundler
5
+ class CLI::HgGem < CLI::Gem
6
+
7
+ def initialize(options, gem_name, thor)
8
+ super(options, gem_name, thor)
9
+ end
10
+
11
+ def run
12
+ super()
13
+ name = gem_name.chomp("/") # remove trailing slash if present
14
+ target = File.join(Dir.pwd, name)
15
+
16
+ Bundler.ui.info "Converting git repo to mercurial repo."
17
+ Dir.chdir(target) do
18
+ `rm -rf .git`
19
+ `hg init .`
20
+ `echo syntax: glob > .hgignore`
21
+ `cat .gitignore >> .hgignore`
22
+ `rm .gitignore`
23
+ spec = File.open("#{name}.gemspec", 'r') { |f| f.read }
24
+ File.open("#{name}.gemspec", "w") do |f|
25
+ #locate file based on mercurial
26
+ spec.gsub!("git ls-files -z", "hg locate -0")
27
+ #require bundle-gem-hg as development dep
28
+ spec.gsub!("end\n", " spec.add_development_dependency 'bundler-gem-hg', '~> #{Bundler::GemHg::VERSION}'\nend\n")
29
+
30
+ f << spec
31
+ end
32
+ rakefile = File.open("Rakefile", 'r') { |f| f.read }
33
+ File.open("Rakefile", "w") { |f| f << rakefile.sub("require \"bundler/gem_tasks","require \"bundler-gem-hg/gem_tasks") }
34
+ #TODO: consider updating README.md
35
+ `hg addremove`
36
+ end
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,46 @@
1
+ require 'bundler/gem_helper'
2
+
3
+ #monkey-patching
4
+ module Bundler
5
+ class GemHelper
6
+
7
+ def hg_push
8
+ perform_hg_push ' --rev .' #mimic the git only-current-branch-push
9
+ # the above command should push tags also
10
+ Bundler.ui.confirm "Pushed hg commits and tags for the current branch"
11
+ end
12
+ alias :git_push :hg_push
13
+
14
+ def perform_hg_push(options = '')
15
+ cmd = "hg push #{options}"
16
+ out, code = sh_with_code(cmd)
17
+ raise "Couldn't hg push. `#{cmd}' failed with the following output:\n\n#{out}\n" unless code == 0
18
+ end
19
+ alias :perform_git_push :perform_hg_push
20
+
21
+ def already_tagged?
22
+ if sh('hg tags -q').split(/\n/).include?(version_tag)
23
+ Bundler.ui.confirm "Tag #{version_tag} has already been created."
24
+ true
25
+ end
26
+ end
27
+
28
+ def clean?
29
+ sh("hg status -mard").empty?
30
+ end
31
+
32
+ def committed?
33
+ sh_with_code("hg sum -q | grep \"^commit:\"")[1] != 0
34
+ end
35
+
36
+ def tag_version
37
+ sh "hg tag -m \"Version #{version}\" #{version_tag}"
38
+ Bundler.ui.confirm "Tagged #{version_tag}."
39
+ yield if block_given?
40
+ rescue
41
+ Bundler.ui.error "Untagging #{version_tag} due to error."
42
+ sh_with_code "hg tag --remove #{version_tag}"
43
+ raise
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,2 @@
1
+ require 'bundler-gem-hg/gem_helper'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,5 @@
1
+ module Bundler
2
+ module GemHg
3
+ VERSION = "1.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bundler-gem-hg
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alessio Caiazza
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-19 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: :runtime
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: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: This gem will allow you to develop gems using mercurial instead of git
42
+ email:
43
+ - nolith@abisso.org
44
+ executables:
45
+ - bundle-gem-hg
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .hgignore
50
+ - .hgtags
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - bin/bundle-gem-hg
56
+ - bundler-gem-hg.gemspec
57
+ - lib/bundler-gem-hg.rb
58
+ - lib/bundler-gem-hg/cli.rb
59
+ - lib/bundler-gem-hg/cli/hg_gem.rb
60
+ - lib/bundler-gem-hg/gem_helper.rb
61
+ - lib/bundler-gem-hg/gem_tasks.rb
62
+ - lib/bundler-gem-hg/version.rb
63
+ homepage: https://bitbucket.org/nolith/bundler-gem-hg
64
+ licenses:
65
+ - GPL3
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.2.2
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Develop gem with bundler rake tasks and mercurial
87
+ test_files: []
88
+ has_rdoc: