gong 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +151 -0
  3. data/bin/gong +3 -0
  4. data/gong.gemspec +56 -0
  5. data/lib/gong.rb +57 -0
  6. metadata +47 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fd286cd4720efa216ad7a316fa433343fe08a7ff
4
+ data.tar.gz: 7505ef789726a00783d40567b3890a82d56b421d
5
+ SHA512:
6
+ metadata.gz: 1df593ede9201483d6ecf91f2b95f4405a05ac221ee02e2d4f219a32371d4856c3833d3f1c99cd5215194853e3e2a9f89148370af5fa37ce51463ece8826f150
7
+ data.tar.gz: 3e5ce4af42644f6a8e9fa53fc2e5a1738e7ab1a4a87d0481eb31718d1b79704355c4488896639deb6d0db9c7a07c57fb213a26453d881a47fe0dd645c2c4581c
@@ -0,0 +1,151 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'date'
4
+
5
+ #############################################################################
6
+ #
7
+ # Helper functions
8
+ #
9
+ #############################################################################
10
+
11
+ def name
12
+ @name ||= Dir['*.gemspec'].first.split('.').first
13
+ end
14
+
15
+ def version
16
+ #line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
17
+ #line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
+ "0.0.1"
19
+ end
20
+
21
+ def date
22
+ Date.today.to_s
23
+ end
24
+
25
+ def rubyforge_project
26
+ name
27
+ end
28
+
29
+ def gemspec_file
30
+ "#{name}.gemspec"
31
+ end
32
+
33
+ def gem_file
34
+ "#{name}-#{version}.gem"
35
+ end
36
+
37
+ def replace_header(head, header_name)
38
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
39
+ end
40
+
41
+ #############################################################################
42
+ #
43
+ # Standard tasks
44
+ #
45
+ #############################################################################
46
+
47
+ task :default => :test
48
+
49
+ require 'rake/testtask'
50
+ Rake::TestTask.new(:test) do |test|
51
+ test.libs << 'lib' << 'test'
52
+ test.pattern = 'test/**/test_*.rb'
53
+ test.verbose = true
54
+ end
55
+
56
+ desc "Generate RCov test coverage and open in your browser"
57
+ task :coverage do
58
+ require 'rcov'
59
+ sh "rm -fr coverage"
60
+ sh "rcov test/test_*.rb"
61
+ sh "open coverage/index.html"
62
+ end
63
+
64
+ require 'rake/rdoctask'
65
+ Rake::RDocTask.new do |rdoc|
66
+ rdoc.rdoc_dir = 'rdoc'
67
+ rdoc.title = "#{name} #{version}"
68
+ rdoc.rdoc_files.include('README*')
69
+ rdoc.rdoc_files.include('lib/**/*.rb')
70
+ end
71
+
72
+ desc "Open an irb session preloaded with this library"
73
+ task :console do
74
+ sh "irb -rubygems -r ./lib/#{name}.rb"
75
+ end
76
+
77
+ #############################################################################
78
+ #
79
+ # Custom tasks (add your own tasks here)
80
+ #
81
+ #############################################################################
82
+
83
+
84
+
85
+ #############################################################################
86
+ #
87
+ # Packaging tasks
88
+ #
89
+ #############################################################################
90
+
91
+ desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
92
+ task :release => :build do
93
+ unless `git branch` =~ /^\* master$/
94
+ puts "You must be on the master branch to release!"
95
+ exit!
96
+ end
97
+ #sh "git commit --allow-empty -a -m 'Release #{version}'"
98
+ #sh "git tag v#{version}"
99
+ sh "git push origin master"
100
+ #sh "git push origin v#{version}"
101
+ sh "gem push pkg/#{name}-#{version}.gem"
102
+ end
103
+
104
+ desc "Build #{gem_file} into the pkg directory"
105
+ task :build => :gemspec do
106
+ sh "mkdir -p pkg"
107
+ sh "gem build #{gemspec_file}"
108
+ sh "mv #{gem_file} pkg"
109
+ end
110
+
111
+ desc "Generate #{gemspec_file}"
112
+ task :gemspec => :validate do
113
+ # read spec file and split out manifest section
114
+ spec = File.read(gemspec_file)
115
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
116
+
117
+ # replace name version and date
118
+ replace_header(head, :name)
119
+ replace_header(head, :version)
120
+ replace_header(head, :date)
121
+ #comment this out if your rubyforge_project has a different name
122
+ replace_header(head, :rubyforge_project)
123
+
124
+ # determine file list from git ls-files
125
+ files = `git ls-files`.
126
+ split("\n").
127
+ sort.
128
+ reject { |file| file =~ /^\./ }.
129
+ reject { |file| file =~ /^(rdoc|pkg)/ }.
130
+ map { |file| " #{file}" }.
131
+ join("\n")
132
+
133
+ # piece file back together and write
134
+ manifest = " s.files = %w[\n#{files}\n ]\n"
135
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
136
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
137
+ puts "Updated #{gemspec_file}"
138
+ end
139
+
140
+ desc "Validate #{gemspec_file}"
141
+ task :validate do
142
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
143
+ unless libfiles.empty?
144
+ puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
145
+ exit!
146
+ end
147
+ unless Dir['VERSION*'].empty?
148
+ puts "A `VERSION` file at root level violates Gem best practices."
149
+ exit!
150
+ end
151
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
3
+ require 'gong'
@@ -0,0 +1,56 @@
1
+ # This is the rakegem gemspec template. Make sure you read and understand
2
+ ## all of the comments. Some sections require modification, and others can
3
+ ## be deleted if you don't need them. Once you understand the contents of
4
+ ## this file, feel free to delete any comments that begin with two hash marks.
5
+ ## You can find comprehensive Gem::Specification documentation, at
6
+ ## http://docs.rubygems.org/read/chapter/20
7
+
8
+ Gem::Specification.new do |s|
9
+ s.specification_version = 2 if s.respond_to? :specification_version=
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.rubygems_version = '2.3.3'
12
+
13
+ ## Leave these as is they will be modified for you by the rake gemspec task.
14
+ ## If your rubyforge_project name is different, then edit it and comment out
15
+ ## the sub! line in the Rakefile
16
+ s.name = 'gong'
17
+ s.version = '0.0.1'
18
+ s.date = '2018-07-10'
19
+ s.rubyforge_project = 'gong'
20
+
21
+ ## Make sure your summary is short. The description may be as long
22
+ ## as you like.
23
+ s.summary = "GONG: Gem on Github"
24
+ s.description = "The easiest way to release gem versions on GitHub"
25
+
26
+ ## List the primary authors. If there are a bunch of authors, it's probably
27
+ ## better to set the email to an email list or something. If you don't have
28
+ ## a custom homepage, consider using your GitHub URL or the like.
29
+ s.authors = ["Carlos Abraham"]
30
+ s.email = 'abrahamm@19cah.com'
31
+ s.homepage = 'https://github.com/19cah/gong'
32
+
33
+ ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
34
+ ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
35
+ s.require_paths = %w[lib]
36
+
37
+ ## If your gem includes any executables, list them here.
38
+ s.executables = ["gong"]
39
+ s.default_executable = 'gong'
40
+
41
+ ## Leave this section as-is. It will be automatically generated from the
42
+ ## contents of your Git repository via the gemspec task. DO NOT REMOVE
43
+ ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
44
+ # = MANIFEST =
45
+ s.files = %w[
46
+ Rakefile
47
+ bin/gong
48
+ gong.gemspec
49
+ lib/gong.rb
50
+ ]
51
+ # = MANIFEST =
52
+
53
+ ## Test files will be grabbed from the file list. Make sure the path glob
54
+ ## matches what you actually use.
55
+ s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
56
+ end
@@ -0,0 +1,57 @@
1
+ require 'optparse'
2
+ require 'rubygems'
3
+
4
+ def help()
5
+ return "$ gong --help
6
+
7
+ Gong: gem to github
8
+
9
+ Usage
10
+ $ gong <version>
11
+
12
+ Version can be:
13
+ patch | minor | major | prepatch | preminor | premajor | prerelease | 1.2.3
14
+
15
+ Options
16
+ --no-cleanup Skips cleanup of git and ruby gems
17
+ --tag Publish under a given dist-tag
18
+
19
+ Examples
20
+ $ gong
21
+ $ gong patch
22
+ $ gong 2.3.0
23
+ $ gong 1.0.3-beta.2 --tag=beta
24
+ "
25
+ end
26
+
27
+ # def publish()
28
+ # exec "git checkout master"
29
+ # exec ""
30
+ # end
31
+ #
32
+ #
33
+ # publish()
34
+
35
+ options = {}
36
+
37
+ OptionParser.new do |parser|
38
+ parser.banner = "Usage: $ gong [options]
39
+
40
+ Version can be:
41
+ patch | minor | major | prepatch | preminor | premajor | prerelease | 1.2.3
42
+ "
43
+ parser.on("-v", "--version", "Print package version") do |v|
44
+ spec = Gem::Specification::load("../gong.gemspec")
45
+ puts spec.version
46
+ end
47
+ parser.on("", "--no-cleanup", "Skips cleanup of git and ruby gems") do ||
48
+ puts "todo"
49
+ end
50
+ parser.on("-h", "--help", "Show this help message") do ||
51
+ puts parser
52
+ end
53
+ parser.on("", "--tag", "Print package version") do |v|
54
+ spec = Gem::Specification::load("../gong.gemspec")
55
+ puts spec.version
56
+ end
57
+ end.parse!
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gong
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Carlos Abraham
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The easiest way to release gem versions on GitHub
14
+ email: abrahamm@19cah.com
15
+ executables:
16
+ - gong
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - Rakefile
21
+ - bin/gong
22
+ - gong.gemspec
23
+ - lib/gong.rb
24
+ homepage: https://github.com/19cah/gong
25
+ licenses: []
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project: gong
43
+ rubygems_version: 2.5.2
44
+ signing_key:
45
+ specification_version: 2
46
+ summary: 'GONG: Gem on Github'
47
+ test_files: []