gemstash 1.0.2 → 1.0.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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/lib/gemstash/cli.rb +46 -0
  4. data/lib/gemstash/cli/setup.rb +1 -1
  5. data/lib/gemstash/env.rb +5 -0
  6. data/lib/gemstash/man/gemstash-authorize.1 +50 -0
  7. data/lib/gemstash/man/gemstash-authorize.1.txt +45 -0
  8. data/lib/gemstash/man/gemstash-configuration.5 +133 -0
  9. data/lib/gemstash/man/gemstash-configuration.5.txt +121 -0
  10. data/lib/gemstash/man/gemstash-customize.7 +224 -0
  11. data/lib/gemstash/man/gemstash-customize.7.txt +137 -0
  12. data/lib/gemstash/man/gemstash-debugging.7 +34 -0
  13. data/lib/gemstash/man/gemstash-debugging.7.txt +29 -0
  14. data/lib/gemstash/man/gemstash-deploy.7 +40 -0
  15. data/lib/gemstash/man/gemstash-deploy.7.txt +34 -0
  16. data/lib/gemstash/man/gemstash-mirror.7 +40 -0
  17. data/lib/gemstash/man/gemstash-mirror.7.txt +33 -0
  18. data/lib/gemstash/man/gemstash-multiple-sources.7 +89 -0
  19. data/lib/gemstash/man/gemstash-multiple-sources.7.txt +71 -0
  20. data/lib/gemstash/man/gemstash-private-gems.7 +195 -0
  21. data/lib/gemstash/man/gemstash-private-gems.7.txt +133 -0
  22. data/lib/gemstash/man/gemstash-readme.7 +204 -0
  23. data/lib/gemstash/man/gemstash-readme.7.txt +160 -0
  24. data/lib/gemstash/man/gemstash-setup.1 +41 -0
  25. data/lib/gemstash/man/gemstash-setup.1.txt +38 -0
  26. data/lib/gemstash/man/gemstash-start.1 +25 -0
  27. data/lib/gemstash/man/gemstash-start.1.txt +25 -0
  28. data/lib/gemstash/man/gemstash-status.1 +19 -0
  29. data/lib/gemstash/man/gemstash-status.1.txt +21 -0
  30. data/lib/gemstash/man/gemstash-stop.1 +19 -0
  31. data/lib/gemstash/man/gemstash-stop.1.txt +21 -0
  32. data/lib/gemstash/man/gemstash-version.1 +22 -0
  33. data/lib/gemstash/man/gemstash-version.1.txt +21 -0
  34. data/lib/gemstash/storage.rb +7 -4
  35. data/lib/gemstash/version.rb +1 -1
  36. metadata +79 -48
  37. data/Gemfile +0 -4
  38. data/README.md +0 -161
  39. data/Rakefile +0 -25
  40. data/bin/console +0 -14
  41. data/bin/gemstash +0 -3
  42. data/bin/setup +0 -5
  43. data/docs/config.md +0 -136
  44. data/docs/debug.md +0 -24
  45. data/docs/deploy.md +0 -30
  46. data/docs/mirror.md +0 -30
  47. data/docs/multiple_sources.md +0 -68
  48. data/docs/private_gems.md +0 -140
  49. data/docs/reference.md +0 -323
  50. data/gemstash.gemspec +0 -49
  51. data/gemstash.png +0 -0
  52. data/rake/changelog.citrus +0 -157
  53. data/rake/changelog.rb +0 -201
  54. data/rake/table_of_contents.rb +0 -36
@@ -1,49 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "gemstash/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "gemstash"
8
- spec.version = Gemstash::VERSION
9
- spec.authors = ["Andre Arko"]
10
- spec.email = ["andre@arko.net"]
11
- spec.platform = "java" if RUBY_PLATFORM == "java"
12
-
13
- spec.summary = "A place to stash gems you'll need"
14
- spec.description = "Gemstash acts as a local RubyGems server, caching \
15
- copies of gems from RubyGems.org automatically, and eventually letting \
16
- you push your own private gems as well."
17
- spec.homepage = "https://github.com/bundler/gemstash"
18
- spec.license = "MIT"
19
-
20
- spec.files = `git ls-files -z`.split("\x0").reject {|f|
21
- f.match(%r{^(test|spec|features)/})
22
- }
23
- spec.bindir = "exe"
24
- spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
25
- spec.require_paths = ["lib"]
26
-
27
- spec.add_runtime_dependency "dalli", "~> 2.7"
28
- spec.add_runtime_dependency "lru_redux", "~> 1.1"
29
- spec.add_runtime_dependency "puma", "~> 2.14"
30
- spec.add_runtime_dependency "sequel", "~> 4.26"
31
- spec.add_runtime_dependency "sinatra", "~> 1.4"
32
- spec.add_runtime_dependency "thor", "~> 0.19"
33
- spec.add_runtime_dependency "faraday", "~> 0.9"
34
- spec.add_runtime_dependency "faraday_middleware", "~> 0.10"
35
-
36
- if RUBY_PLATFORM == "java"
37
- spec.add_runtime_dependency "jdbc-sqlite3", "~> 3.8"
38
- else
39
- spec.add_runtime_dependency "sqlite3", "~> 1.3"
40
- end
41
-
42
- spec.add_development_dependency "bundler", "~> 1.11"
43
- spec.add_development_dependency "citrus", "~> 3.0"
44
- spec.add_development_dependency "octokit", "~> 4.2"
45
- spec.add_development_dependency "rack-test", "~> 0.6"
46
- spec.add_development_dependency "rake", "~> 10.0"
47
- spec.add_development_dependency "rspec", "~> 3.3"
48
- spec.add_development_dependency "rubocop", "0.35.1"
49
- end
Binary file
@@ -1,157 +0,0 @@
1
- # Resulting structure:
2
- #
3
- # versions[]
4
- # number
5
- # date
6
- # description
7
- # sections[]
8
- # title
9
- # description
10
- # changes[]
11
- # comment
12
- # pull_requests[]
13
- # number
14
- # url
15
- # authors[]
16
- # username
17
- # url
18
- grammar Changelog::Grammar
19
- rule versions
20
- (version+) {
21
- def versions
22
- captures[:version]
23
- end
24
- }
25
- end
26
-
27
- rule version
28
- (version_header version_section*) {
29
- def number
30
- capture(:version_header).capture(:version_number).value
31
- end
32
-
33
- def date
34
- capture(:version_header).capture(:date).value
35
- end
36
-
37
- def description
38
- result = capture(:version_header).capture(:description)
39
- result.value if result
40
- end
41
-
42
- def sections
43
- captures[:version_section]
44
- end
45
-
46
- def pull_requests
47
- sections.map(&:changes).flatten.map(&:pull_requests).flatten
48
- end
49
- }
50
- end
51
-
52
- rule version_header
53
- "## " version_number:(/\d+(\.\d+)*(\.pre\.\d+)?/) " (" date:(/\d{4}-\d{2}-\d{2}/) ")\n\n"
54
- description?
55
- end
56
-
57
- rule version_section
58
- ("### " title:(/[^\n]*/) "\n\n" description? changes?) {
59
- def title
60
- capture(:title).value
61
- end
62
-
63
- def heading
64
- "### #{title}\n\n#{description}"
65
- end
66
-
67
- def description
68
- capture(:description).value if capture(:description)
69
- end
70
-
71
- def changes
72
- if capture(:changes)
73
- capture(:changes).captures[:change]
74
- else
75
- []
76
- end
77
- end
78
- }
79
- end
80
-
81
- rule description
82
- paragraph+
83
- end
84
-
85
- rule paragraph
86
- (" " !"- " /(\w|`)[^\n]*/ "\n")+ "\n"
87
- end
88
-
89
- rule changes
90
- change+ "\n"?
91
- end
92
-
93
- rule change
94
- (" - " comment:(/[^()\n]*/) pull_requests_and_authors? "\n") {
95
- def comment
96
- capture(:comment).value
97
- end
98
-
99
- def pull_requests
100
- pull_requests_and_authors(:pull_requests)
101
- end
102
-
103
- def authors
104
- pull_requests_and_authors(:authors)
105
- end
106
-
107
- private
108
-
109
- def pull_requests_and_authors(type)
110
- return [] unless capture(:pull_requests_and_authors)
111
- return [] unless capture(:pull_requests_and_authors).capture(type)
112
- singular = type.to_s.sub(/s$/, "").to_sym
113
- capture(:pull_requests_and_authors).capture(type).capture(singular) || []
114
- end
115
- }
116
- end
117
-
118
- rule pull_requests_and_authors
119
- "(" pull_requests ", " authors ")"
120
- end
121
-
122
- rule pull_requests
123
- pull_request (", " pull_request)*
124
- end
125
-
126
- rule pull_request
127
- ("[#" number:(/\d+/) "](" github_url ")") {
128
- def number
129
- capture(:number).value
130
- end
131
-
132
- def url
133
- capture(:github_url).value
134
- end
135
- }
136
- end
137
-
138
- rule authors
139
- author (", " author)*
140
- end
141
-
142
- rule author
143
- ("[@" username:(/\w+/) "](" github_url ")") {
144
- def username
145
- capture(:username).value
146
- end
147
-
148
- def url
149
- capture(:github_url).value
150
- end
151
- }
152
- end
153
-
154
- rule github_url
155
- "https://github.com" path:(/\/\w*/)*
156
- end
157
- end
@@ -1,201 +0,0 @@
1
- require "set"
2
-
3
- # Helper class for updating CHANGELOG.md
4
- class Changelog
5
- attr_reader :changelog_file, :parsed, :parsed_current_version, :parsed_last_version, :missing_pull_requests
6
-
7
- def initialize
8
- @changelog_file = File.expand_path("../../CHANGELOG.md", __FILE__)
9
- end
10
-
11
- def run
12
- ensure_new_version_specified
13
- parse_changelog
14
- fetch_missing_pull_requests
15
- update_changelog
16
- end
17
-
18
- def ensure_new_version_specified
19
- tags = `git tag -l`
20
- return unless tags.include? Changelog.current_version
21
- Changelog.error("Please update lib/gemstash/version.rb with the new version first!")
22
- end
23
-
24
- def parse_changelog
25
- require "citrus"
26
- Citrus.load(File.expand_path("../changelog.citrus", __FILE__))
27
- @parsed = Changelog::Grammar.parse(File.read(changelog_file))
28
- @parsed_current_version = @parsed.versions.find {|version| version.number == Changelog.current_version }
29
-
30
- if @parsed_current_version
31
- index = @parsed.versions.index(@parsed_current_version)
32
- @parsed_last_version = @parsed.versions[index + 1]
33
- else
34
- @parsed_last_version = @parsed.versions.first
35
- end
36
- end
37
-
38
- def last_version
39
- @last_version ||= begin
40
- version = parsed_last_version.number
41
-
42
- unless version =~ /\A\d+(\.\d+)*(\.pre\.\d+)?\z/
43
- error("Invalid last version: #{version}, instead use something like 1.1.0, or 1.1.0.pre.2")
44
- end
45
-
46
- version
47
- end
48
- end
49
-
50
- def octokit
51
- @octokit ||= begin
52
- require "octokit"
53
- token_path = File.expand_path("../../.rake_github_token", __FILE__)
54
-
55
- if File.exist?(token_path)
56
- options = { access_token: File.read(token_path).strip }
57
- else
58
- puts "\e[31mWARNING:\e[0m You do not have a GitHub OAuth token configured"
59
- puts "Please generate one at: https://github.com/settings/tokens"
60
- puts "And store it at: #{token_path}"
61
- puts "Otherwise you might hit rate limits while running this"
62
- print "Continue without token? [yes/no] "
63
- abort("Please create your token and retry") unless STDIN.gets.strip.downcase == "yes"
64
- options = {}
65
- end
66
-
67
- client = Octokit::Client.new(options)
68
- client.auto_paginate = true
69
- client
70
- end
71
- end
72
-
73
- def fetch_missing_pull_requests
74
- @missing_pull_requests = missing_pull_request_numbers.map {|pr| fetch_pull_request(pr) }
75
- end
76
-
77
- def fetch_pull_request(number)
78
- puts "Fetching pull request ##{number}"
79
- octokit.pull_request("bundler/gemstash", number)
80
- end
81
-
82
- def missing_pull_request_numbers
83
- @missing_pull_request_numbers ||= begin
84
- commits = `git log --oneline HEAD ^v#{last_version} --grep "^Merge pull request"`.split("\n")
85
- pull_requests = commits.map {|commit| commit[/Merge pull request #(\d+)/, 1].to_i }
86
- documented = Set.new
87
-
88
- if parsed_current_version
89
- parsed_current_version.pull_requests.each do |pr|
90
- documented << pr.number.to_i
91
- end
92
- end
93
-
94
- pull_requests.sort.reject {|pr| documented.include?(pr) }
95
- end
96
- end
97
-
98
- def update_changelog
99
- return if missing_pull_requests.empty?
100
-
101
- File.open(changelog_file, "w") do |file|
102
- begin
103
- write_current_version(file)
104
- ensure
105
- parsed.versions.each do |version|
106
- next if version == parsed_current_version
107
- file.write version.value
108
- end
109
- end
110
- end
111
- end
112
-
113
- def write_current_version(file)
114
- pull_requests_by_section = missing_pull_requests.group_by {|pr| section_for(pr) }
115
- file.puts "## #{Changelog.current_version} (#{current_date})"
116
- file.puts
117
-
118
- if parsed_current_version
119
- file.puts parsed_current_version.description if parsed_current_version.description
120
-
121
- parsed_current_version.sections.each do |section|
122
- if pull_requests_by_section[section.title].to_a.empty?
123
- file.write section.value
124
- else
125
- file.write section.heading
126
- section.changes.each {|change| file.write change.value }
127
- write_pull_requests(file, pull_requests_by_section[section.title])
128
- file.puts
129
- pull_requests_by_section.delete(section.title)
130
- end
131
- end
132
- end
133
-
134
- pull_requests_by_section.keys.sort.each do |section_title|
135
- file.puts "### #{section_title}"
136
- file.puts
137
- write_pull_requests(file, pull_requests_by_section[section_title])
138
- file.puts
139
- end
140
- end
141
-
142
- def section_for(pull_request)
143
- puts "Fetching issue for ##{pull_request.number}"
144
- issue = pull_request.rels[:issue].get.data
145
- labels = issue.labels.map(&:name)
146
-
147
- if labels.include?("bug")
148
- "Bugfixes"
149
- elsif labels.include?("enhancement")
150
- "Features"
151
- else
152
- "Changes"
153
- end
154
- end
155
-
156
- def write_pull_requests(file, pull_requests)
157
- pull_requests.each do |pr|
158
- puts "Fetching commits for ##{pr.number}"
159
- commits = pr.rels[:commits].get.data
160
- authors = commits.map {|commit| author_link(commit) }.uniq
161
- file.puts " - #{pr.title} ([##{pr.number}](#{pr.html_url}), #{authors.join(", ")})"
162
- end
163
- end
164
-
165
- def author_link(commit)
166
- @author_links ||= {}
167
- author = commit.author
168
-
169
- if author
170
- "[@#{author.login}](#{author.html_url})"
171
- elsif @author_links[commit.commit.author.name]
172
- @author_links[commit.commit.author.name]
173
- else
174
- puts "Cannot find GitHub link for author: #{commit.commit.author.name}"
175
- print "What is their GitHub username? "
176
- username = STDIN.gets.strip
177
- @author_links[commit.commit.author.name] = "[@#{username}](https://github.com/#{username})"
178
- end
179
- end
180
-
181
- def current_date
182
- @current_date ||= Time.now.strftime("%Y-%m-%d")
183
- end
184
-
185
- def self.error(msg)
186
- STDERR.puts(msg)
187
- exit(false)
188
- end
189
-
190
- def self.current_version
191
- @current_version ||= begin
192
- require_relative "../lib/gemstash/version.rb"
193
-
194
- unless Gemstash::VERSION =~ /\A\d+(\.\d+)*(\.pre\.\d+)?\z/
195
- error("Invalid version: #{Gemstash::VERSION}, instead use something like 1.1.0, or 1.1.0.pre.2")
196
- end
197
-
198
- Gemstash::VERSION
199
- end
200
- end
201
- end
@@ -1,36 +0,0 @@
1
- require "pathname"
2
-
3
- # Helper class for generating the table of contents in markdown files.
4
- class TableOfContents
5
- attr_reader :toc_dir, :toc, :docs_dir
6
-
7
- def initialize
8
- @toc_dir = Pathname.new(File.expand_path("../../tmp", __FILE__))
9
- @toc = @toc_dir.join("gh-md-toc")
10
- @docs_dir = Pathname.new(File.expand_path("../../docs", __FILE__))
11
- end
12
-
13
- def run
14
- cache_toc_script
15
- update_toc("reference.md")
16
- end
17
-
18
- def update_toc(doc)
19
- doc = docs_dir.join(doc)
20
- old_contents = File.read(doc)
21
- old_contents.sub!(/\A.*?^---$/m, "---")
22
- File.write(doc, old_contents)
23
- toc_contents = `"#{toc}" "#{doc}"`
24
- toc_contents.sub!(/Created by.*$/, "")
25
- File.write(doc, "#{toc_contents}\n#{old_contents}")
26
- end
27
-
28
- def cache_toc_script
29
- return if toc.exist?
30
- require "open-uri"
31
- toc_contents = open("https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc", &:read)
32
- Dir.mkdir(toc_dir) unless toc_dir.exist?
33
- File.write(toc, toc_contents)
34
- File.chmod(0776, toc)
35
- end
36
- end