gempage 0.0.1

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjIyMWY2MGQ5NTJlMzY0YTA0YmZjMGU0ODA3YTk4YmUwNDY1NTc5Mw==
5
+ data.tar.gz: !binary |-
6
+ MzBmN2M0MmIzZDZkYmZkNzBjZjAxNmMyY2UxMTRmMTJiYmUwOGU4OA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZGFhYWUzNzQ5NmYyNWM1YjI4NTdkNTkwZTgzOWQ1ODYyMjUwMTg3MmIyYzYw
10
+ MWYwYWM4YTBkMjQyOTk4OGZjYmMzMWJhZjRmNjBiYzJmNWFhYjFkMjZjN2Iw
11
+ MWNhNjczYzk4YjllZWY3M2Q0ZDM0NDc3OTFkN2I2MjM4ODVmZTM=
12
+ data.tar.gz: !binary |-
13
+ NzY4OTdmN2MyZjVmNjM2OWU5NjQ2ZDRhYmJmMDVlMjRhYmEwZjRkN2ZkY2Uz
14
+ ZjdhN2M0NTM4NWM4ZGNhMmQyNGQ3ZjM2OGU4MWRjMjNjNmZlYWJlNmEyMjNh
15
+ ZDJkZTE2OWQ5MzRhNTYxYjgzYzBhODIxMDg4NTdhYjFhM2IwYzk=
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ public/gempage
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jane Sebastian
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.
@@ -0,0 +1,40 @@
1
+ # Gempage
2
+
3
+ Gempage generates a reference web page listing all the gems installed within a Rails application. It is based
4
+ off a version I use within my prototyping application. Best case scenario it speeds up the process of finding
5
+ source code and documentation of the gems you are using. And though the overall design is simplistic and rather
6
+ garish (I like color), who doesn't like adorable octocat icons everywhere? And the dual group gems are my favorite.
7
+
8
+ A live example: [http://fathomless-tundra-4874.herokuapp.com/gempage](http://fathomless-tundra-4874.herokuapp.com/gempage)
9
+
10
+ This is very much a work in progress and is at a minimal viable project level now.
11
+
12
+ ## Installation
13
+
14
+ This is not currently an 'actual' gem, especially in current state, so it has to be locally installed as a vendored gem in order to work.
15
+
16
+ 1. Checkout the source code: `git clone git@github.com:careful-with-that-axe/gempage.git`
17
+
18
+ 2. In the gempage directory run `gem build gempage.gemspec` and `gem install path_to_gempage_directory/gempage-0.0.1.gem`
19
+
20
+ 3. In a rails application directory run the following command to `vendor` the gem: `gem unpack gempage --target vendor/gems`
21
+
22
+ 4. Add `gem 'gempage', :path => "vendor/gems/gempage-0.0.1"` to your Gemfile, then run `bundle`
23
+
24
+ 5. Within terminal in your application root directory type and enter `gempage' to create the Gemfile HTML listing.
25
+
26
+ 6. From within Rails console type and enter `Gempage.generate`.
27
+
28
+ 7. The page will be viewable at `http://{your_application_url}/gempage`
29
+
30
+ ## Plans for the Future
31
+
32
+ * Hover state now has gem info, that should look better and have author, downloads and other details in it.
33
+ * Version information, require: false, etc should display within the gem.
34
+ * Ack! This thing needs tests, it should have been TDD project if had time.
35
+ * Minify assets.
36
+ * Design more space sensitive, lots of scrolling now.
37
+ * Users should be able to specify a color scheme. *Update*: This functionality has been added though the available color schemes are very limited and dubious.
38
+ * Order by group and gem name rather than placement in Gemfile?
39
+ * Create an api of my own to supplement missing content, it doesn't save as much time if so many links are missing
40
+ * Integrate with a RailsCast project to add those links to the appropriate gems.
@@ -0,0 +1,20 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ namespace :assets do
5
+ desc "Compiles all assets"
6
+ task :compile do
7
+ puts "Compiling assets"
8
+ require 'sprockets'
9
+ assets = Sprockets::Environment.new
10
+ assets.append_path 'assets/stylesheets'
11
+ assets['application.css'].write_to('public/application.css')
12
+ assets['pastels.scss'].write_to('public/colorschemes/pastels.css')
13
+ assets['random.scss'].write_to('public/colorschemes/random.css')
14
+ end
15
+ end
16
+
17
+ RSpec::Core::RakeTask.new
18
+
19
+ task :default => :spec
20
+ task :test => :spec
@@ -0,0 +1,2 @@
1
+ //= require ./screen
2
+ //= require ./colors
@@ -0,0 +1,75 @@
1
+ // Colors from: http://www.colourlovers.com/business/trends/branding/7880/Papeterie_Haute-Ville_Logo
2
+ // gem-color-0 defaults to dark gray
3
+
4
+ // midnight blue
5
+ .gem-color-1 {
6
+ border: 3px solid #113F8C;
7
+ color: #113F8C;
8
+ a {
9
+ color: #113F8C;
10
+ }
11
+ }
12
+ // forest green
13
+ .gem-color-2 {
14
+ border: 3px solid #32742C;
15
+ color: #32742C;
16
+ a {
17
+ color: #32742C;
18
+ }
19
+ }
20
+ // orange
21
+ .gem-color-3 {
22
+ border: 3px solid #F18D05;
23
+ color: #F18D05;
24
+ a {
25
+ color: #F18D05;
26
+ }
27
+ }
28
+ // fuchsia
29
+ .gem-color-4 {
30
+ border: 3px solid #D70060;
31
+ color: #D70060;
32
+ a {
33
+ color: #D70060;
34
+ }
35
+ }
36
+ // teal
37
+ .gem-color-5 {
38
+ border: 3px solid #01A4A4;
39
+ color: #01A4A4;
40
+ a {
41
+ color: #01A4A4;
42
+ }
43
+ }
44
+ // kelly green
45
+ .gem-color-6 {
46
+ border: 3px solid #61AE24;
47
+ color: #61AE24;
48
+ a {
49
+ color: #61AE24;
50
+ }
51
+ }
52
+ // aqua blue
53
+ .gem-color-7 {
54
+ border: 3px solid #00A1CB;
55
+ color: #00A1CB;
56
+ a {
57
+ color: #00A1CB;
58
+ }
59
+ }
60
+ // mustard
61
+ .gem-color-8 {
62
+ border: 3px solid #D0D102;
63
+ color: #D0D102;
64
+ a {
65
+ color: #D0D102;
66
+ }
67
+ }
68
+ // red
69
+ .gem-color-9 {
70
+ border: 3px solid #E54028;
71
+ color: #E54028;
72
+ a {
73
+ color: #E54028;
74
+ }
75
+ }
@@ -0,0 +1,75 @@
1
+ // Colors from: http://www.colourlovers.com/pattern/3942206/Archis_%E2%99%A5_%E2%99%A5_%E2%99%A5
2
+ // gem-color-0 defaults to dark gray
3
+
4
+ // mint
5
+ .gem-color-1 {
6
+ border: 3px solid #E0FDEC;
7
+ color: #E0FDEC;
8
+ a {
9
+ color: #E0FDEC;
10
+ }
11
+ }
12
+ // buttercream
13
+ .gem-color-2 {
14
+ border: 3px solid #FFF6AB;
15
+ color: #FFF6AB;
16
+ a {
17
+ color: #FFF6AB;
18
+ }
19
+ }
20
+ // aquamarine
21
+ .gem-color-3 {
22
+ border: 3px solid #6CE1D9;
23
+ color: #6CE1D9;
24
+ a {
25
+ color: #6CE1D9;
26
+ }
27
+ }
28
+ // pink
29
+ .gem-color-4 {
30
+ border: 3px solid #F95174;
31
+ color: #F95174;
32
+ a {
33
+ color: #F95174;
34
+ }
35
+ }
36
+ // forest green
37
+ .gem-color-5 {
38
+ border: 3px solid #4B6355;
39
+ color: #4B6355;
40
+ a {
41
+ color: #4B6355;
42
+ }
43
+ }
44
+ // taupe
45
+ .gem-color-6 {
46
+ border: 3px solid #F1E2CB;
47
+ color: #F1E2CB;
48
+ a {
49
+ color: #F1E2CB;
50
+ }
51
+ }
52
+ // rose
53
+ .gem-color-7 {
54
+ border: 3px solid #FCCCD2;
55
+ color: #FCCCD2;
56
+ a {
57
+ color: #FCCCD2;
58
+ }
59
+ }
60
+ // slate
61
+ .gem-color-8 {
62
+ border: 3px solid #6A8491;
63
+ color: #6A8491;
64
+ a {
65
+ color: #6A8491;
66
+ }
67
+ }
68
+ // green
69
+ .gem-color-9 {
70
+ border: 3px solid #7DCE84;
71
+ color: #7DCE84;
72
+ a {
73
+ color: #7DCE84;
74
+ }
75
+ }
@@ -0,0 +1,73 @@
1
+ // gem-color-0 defaults to dark gray
2
+
3
+ .gem-color-1 {
4
+ border: 3px solid #FE0101;
5
+ color: #FE0101;
6
+ a {
7
+ color: #FE0101;
8
+ }
9
+ }
10
+
11
+ .gem-color-2 {
12
+ border: 3px solid #FE6002;
13
+ color: #FE6002;
14
+ a {
15
+ color: #FE6002;
16
+ }
17
+ }
18
+
19
+ .gem-color-3 {
20
+ border: 3px solid #CC3FF9;
21
+ color: #CC3FF9;
22
+ a {
23
+ color: #CC3FF9;
24
+ }
25
+ }
26
+
27
+ .gem-color-4 {
28
+ border: 3px solid #E1CA2F;
29
+ color: #E1CA2F;
30
+ a {
31
+ color: #E1CA2F;
32
+ }
33
+ }
34
+
35
+ .gem-color-5 {
36
+ border: 3px solid #FF8566;
37
+ color: #FF8566;
38
+ a {
39
+ color: #FF8566;
40
+ }
41
+ }
42
+
43
+ .gem-color-6 {
44
+ border: 3px solid #09E8F8;
45
+ color: #09E8F8;
46
+ a {
47
+ color: #09E8F8;
48
+ }
49
+ }
50
+
51
+ .gem-color-7 {
52
+ border: 3px solid #F1FD23;
53
+ color: #F1FD23;
54
+ a {
55
+ color: #F1FD23;
56
+ }
57
+ }
58
+
59
+ .gem-color-8 {
60
+ border: 3px solid #64BE4C;
61
+ color: #64BE4C;
62
+ a {
63
+ color: #64BE4C;
64
+ }
65
+ }
66
+
67
+ .gem-color-9 {
68
+ border: 3px solid #C38135;
69
+ color: #C38135;
70
+ a {
71
+ color: #C38135;
72
+ }
73
+ }
@@ -0,0 +1,80 @@
1
+ body {
2
+ font: normal 15px/1.5 Verdana, Geneva, sans-serif;
3
+ }
4
+ a {
5
+ text-decoration: none;
6
+ color: #113F8C;
7
+ }
8
+ .gem-section {
9
+ margin: 30px;
10
+ overflow: auto;
11
+ }
12
+
13
+ .gem-group-heading {
14
+ float: left;
15
+ overflow: auto;
16
+ border-top: 1px solid #e3e3e3;
17
+ border-left: 1px solid #e3e3e3;
18
+ padding-bottom: 30px;
19
+ margin-top: 15px;
20
+ }
21
+
22
+ .gem-group-heading h4 {
23
+ font-size: 20px;
24
+ line-height: 1.5;
25
+ padding: 0 30px;
26
+ }
27
+
28
+ .gem-group {
29
+ width: 95%;
30
+ float: left;
31
+ margin: -30px 0 0 60px;
32
+ overflow: auto;
33
+ }
34
+ .gems {
35
+ overflow: auto;
36
+ margin: 20px 50px;
37
+ }
38
+ .main-gem {
39
+ position: relative;
40
+ float: left;
41
+ width: 220px;
42
+ height: 160px;
43
+ }
44
+ .gem {
45
+ position: absolute;
46
+ width: 170px;
47
+ height: 110px;
48
+ border-radius: 10px;
49
+ overflow: hidden;
50
+ padding: 10px;
51
+ border: 3px solid #616161;
52
+ color: #616161;
53
+ a {
54
+ color: #616161;
55
+ }
56
+ }
57
+
58
+ .documentation {
59
+ font-size: 30px;
60
+ position: absolute;
61
+ font-weight: bold;
62
+ bottom: -28px;
63
+ left: -18px;
64
+ }
65
+ .gem h4 {
66
+ font: bold 15px Verdana;
67
+ line-height: 1.2;
68
+ padding: 10px 0 5px 10px;
69
+ margin: 0;
70
+ a {
71
+ color: gray;
72
+ }
73
+ }
74
+ .github {
75
+ font-size: 30px;
76
+ font-weight: bold;
77
+ position: absolute;
78
+ bottom: -22px;
79
+ right: -23px;
80
+ }
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gempage'
4
+ require 'optparse'
5
+
6
+ options = {}
7
+
8
+ opt_parser = OptionParser.new do |opt|
9
+ opt.separator ""
10
+ opt.separator "Commands"
11
+ opt.separator " generate: create gempage"
12
+ opt.separator ""
13
+ opt.separator "Options"
14
+
15
+ opt.on("-c","--colors [COLORSCHEME]", [:default, :pastels, :random], "which garish color scheme to use? options are default|pastels|random") do |colorscheme|
16
+ options[:colorscheme] = colorscheme
17
+ end
18
+
19
+ opt.on("-h","--help","help") do
20
+ puts opt_parser
21
+ end
22
+ end
23
+
24
+ opt_parser.parse!
25
+
26
+ case ARGV[0]
27
+ when "generate"
28
+ Gempage.generate(options)
29
+ else
30
+ puts opt_parser
31
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gempage/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "gempage"
8
+ s.version = Gempage::VERSION
9
+ s.authors = ["Jane S. Sebastian"]
10
+ s.email = ["jane@betatetra.com"]
11
+ s.description = %Q{A reference page for gems installed within a Rails application.}
12
+ s.summary = %Q{Work in progress yo.}
13
+ s.homepage = "https://github.com/careful-with-that-axe/gempage"
14
+ s.license = "MIT"
15
+
16
+ s.files = `git ls-files`.split($/)
17
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency "bundler", "~> 1.3"
22
+ s.add_development_dependency 'rake'
23
+ s.add_development_dependency 'sprockets'
24
+ s.add_development_dependency 'uglifier'
25
+ s.add_development_dependency 'sass'
26
+ s.add_development_dependency 'rake'
27
+ s.add_development_dependency 'rspec'
28
+ end
@@ -0,0 +1,58 @@
1
+ require "gempage/version"
2
+
3
+ require 'erb'
4
+ require 'fileutils'
5
+ require 'gempage/configuration'
6
+ require 'gempage/import'
7
+ Gempage.send :extend, Gempage::Configuration
8
+
9
+ module Gempage
10
+ class << self
11
+
12
+ def generate(options = nil)
13
+ format(grouped_result, options)
14
+ end
15
+
16
+ def result
17
+ return @result if defined? @result
18
+ Gempage::Import::Importer.new(gemfile_path).gem_list
19
+ end
20
+
21
+ def grouped_result
22
+ return @grouped_result if defined? @grouped_result
23
+ result.group_by{ |result| result[:category] }
24
+ end
25
+
26
+ def format(grouped_result, options)
27
+ create_stylesheet('application', options)
28
+ create_index(grouped_result)
29
+ puts output_message(grouped_result, result)
30
+ end
31
+
32
+ def create_index(result)
33
+ File.open(File.join(gempage_path, "index.html"), "w+") do |file|
34
+ file.puts template('layout').result(binding)
35
+ end
36
+ end
37
+
38
+ def create_stylesheet(name, options)
39
+ colorscheme_file = "../public/colorschemes/#{options[:colorscheme].to_s}.css"
40
+
41
+ File.open(File.join(asset_gempage_path, "application.css"), "w+") do |file|
42
+ file.puts File.readlines(File.join(File.dirname(__FILE__), '../public/application.css'))
43
+ if options[:colorscheme] && File.exist?(File.join(File.dirname(__FILE__), colorscheme_file))
44
+ file.puts File.readlines(File.join(File.dirname(__FILE__), colorscheme_file))
45
+ end
46
+ end
47
+ end
48
+
49
+ def template(name)
50
+ ERB.new(File.read(File.join(File.dirname(__FILE__), '../views/', "#{name}.erb")))
51
+ end
52
+
53
+ def output_message(grouped_result, result)
54
+ "Gem list generated for #{grouped_result.length} gem groups and #{result.length} gems to #{gempage_path}."
55
+ end
56
+
57
+ end
58
+ end
@@ -0,0 +1,36 @@
1
+ require 'fileutils'
2
+
3
+ module Gempage::Configuration
4
+
5
+ def root(root=nil)
6
+ return @root if defined? @root and root.nil?
7
+ @root = File.expand_path(root || Dir.getwd)
8
+ end
9
+
10
+ def gempage_dir(dir=nil)
11
+ return @gempage_dir if defined? @gempage_dir and dir.nil?
12
+ @gempage_dir = (dir || 'public/gempage')
13
+ end
14
+
15
+ def gempage_path
16
+ gempage_path = File.join(root, gempage_dir)
17
+ FileUtils.mkdir_p gempage_path
18
+ gempage_path
19
+ end
20
+
21
+ def asset_gempage_path
22
+ return @asset_gempage_path if defined? @asset_gempage_path and @asset_gempage_path
23
+ @asset_gempage_path = File.join(gempage_path, 'assets', Gempage::VERSION)
24
+ FileUtils.mkdir_p(@asset_gempage_path)
25
+ @asset_gempage_path
26
+ end
27
+
28
+ def assets_path(name)
29
+ File.join(@asset_gempage_path, name)
30
+ end
31
+
32
+ def gemfile_path
33
+ File.join(root, 'Gemfile')
34
+ end
35
+
36
+ end
@@ -0,0 +1,114 @@
1
+ require 'fileutils'
2
+ require 'json'
3
+
4
+ module Gempage::Import
5
+ class Importer
6
+
7
+ attr_reader :gem_list
8
+
9
+ def initialize(gemfile_path)
10
+ @gemfile_path = gemfile_path
11
+ @gem_list = gem_list
12
+ end
13
+
14
+ def gem_list
15
+ if gemfile_lines
16
+ gems = process_gems(normalize(gemfile_lines))
17
+ final_gems = []
18
+ gems.each do |gem_listing|
19
+ final_gems << add_rubygem_content(gem_listing) if find_gem(gem_listing[:name])
20
+ end
21
+ else
22
+ puts "There is no Gemfile to process... how odd."
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def gemfile_lines
29
+ File.readlines(@gemfile_path) if File.exists? @gemfile_path
30
+ end
31
+
32
+ def normalize(gemfile)
33
+ # Strip white space, keep only lines starting with gem, group
34
+ # or end, normalize to single quotes, remove trailing comments
35
+ gemfile.map { |x| x.strip.gsub(/"/,"'") }
36
+ .reject { |x| x.empty? || !x.match(/^(gem|group|end)/) }
37
+ .map { |x| x.gsub(/\s?#.*$/, '') }
38
+ end
39
+
40
+ def process_gems(data, group = 'all', gems = [])
41
+ data.each_with_index do |line, index|
42
+ if line.match(/^gem\s/)
43
+ add_gem(gems, group, line)
44
+ else
45
+ if line.match(/^group/)
46
+ group = get_group(line)
47
+ return process_gems(data[(index + 1)..-1], group, gems)
48
+ else line.match(/^end/)
49
+ group = 'all'
50
+ end
51
+ end
52
+ end
53
+ gems
54
+ end
55
+
56
+ def get_group(line)
57
+ group = line.match(/^group\s+(.+)\sdo$/)
58
+ group ? group[1] : nil
59
+ end
60
+
61
+ def add_gem(gems, group, line)
62
+ gems << gem_details(line, group) if gem_details(line, group)
63
+ end
64
+
65
+ def gem_details(line, group)
66
+ gem_pieces = line.match(/^gem\s'([\w|-]+)',?\s?(.*)/)
67
+ gem_pieces ? { name: gem_pieces[1], category: group, configuration: gem_pieces[2] } : nil
68
+ end
69
+
70
+ def find_gem(name)
71
+ url = "https://rubygems.org/api/v1/gems/#{name}.json"
72
+ JSON.parse(response_body(url)) if response_body(url)
73
+ end
74
+
75
+ def response_body(url)
76
+ request = Net::HTTP.new URI(url).host
77
+ response = request.request_get URI(url).path
78
+ response.code.to_i == 200 ? response.body : false
79
+ end
80
+
81
+ def add_rubygem_content(gem_listing)
82
+ rubygem = find_gem(gem_listing[:name])
83
+ documentation_uri = get_documentation_uri(rubygem['documentation_uri'], rubygem['homepage_uri'])
84
+ source_code_uri = get_source_code_uri(rubygem['source_code_uri'], rubygem['homepage_uri'])
85
+ homepage_uri = get_homepage_uri(rubygem['homepage_uri'])
86
+ if rubygem
87
+ gem_listing[:downloads] = rubygem['downloads']
88
+ gem_listing[:version] = rubygem['version']
89
+ gem_listing[:authors] = rubygem['authors']
90
+ gem_listing[:info] = rubygem['info']
91
+ gem_listing[:documentation_uri] = documentation_uri
92
+ gem_listing[:source_code_uri] = source_code_uri
93
+ gem_listing[:homepage_uri] = homepage_uri
94
+ gem_listing
95
+ else
96
+ puts "None such #{name} gem... #{name} will not be in the Gem Reference"
97
+ false
98
+ end
99
+ end
100
+
101
+ def get_homepage_uri(homepage_uri)
102
+ homepage_uri && homepage_uri != '' ? homepage_uri : nil
103
+ end
104
+
105
+ def get_documentation_uri(documentation_uri, source_code_uri)
106
+ documentation_uri && documentation_uri != '' && documentation_uri != source_code_uri ? documentation_uri : nil
107
+ end
108
+
109
+ def get_source_code_uri(source_code_uri, homepage_uri)
110
+ source_code_uri && source_code_uri != '' ? source_code_uri : nil
111
+ !source_code_uri && homepage_uri && homepage_uri.match(/github\.com/) ? homepage_uri : source_code_uri
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,3 @@
1
+ module Gempage
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,128 @@
1
+ body {
2
+ font: normal 15px/1.5 Verdana, Geneva, sans-serif; }
3
+
4
+ a {
5
+ text-decoration: none;
6
+ color: #113F8C; }
7
+
8
+ .gem-section {
9
+ margin: 30px;
10
+ overflow: auto; }
11
+
12
+ .gem-group-heading {
13
+ float: left;
14
+ overflow: auto;
15
+ border-top: 1px solid #e3e3e3;
16
+ border-left: 1px solid #e3e3e3;
17
+ padding-bottom: 30px;
18
+ margin-top: 15px; }
19
+
20
+ .gem-group-heading h4 {
21
+ font-size: 20px;
22
+ line-height: 1.5;
23
+ padding: 0 30px; }
24
+
25
+ .gem-group {
26
+ width: 95%;
27
+ float: left;
28
+ margin: -30px 0 0 60px;
29
+ overflow: auto; }
30
+
31
+ .gems {
32
+ overflow: auto;
33
+ margin: 20px 50px; }
34
+
35
+ .main-gem {
36
+ position: relative;
37
+ float: left;
38
+ width: 220px;
39
+ height: 160px; }
40
+
41
+ .gem {
42
+ position: absolute;
43
+ width: 170px;
44
+ height: 110px;
45
+ border-radius: 10px;
46
+ overflow: hidden;
47
+ padding: 10px;
48
+ border: 3px solid #616161;
49
+ color: #616161; }
50
+ .gem a {
51
+ color: #616161; }
52
+
53
+ .documentation {
54
+ font-size: 30px;
55
+ position: absolute;
56
+ font-weight: bold;
57
+ bottom: -28px;
58
+ left: -18px; }
59
+
60
+ .gem h4 {
61
+ font: bold 15px Verdana;
62
+ line-height: 1.2;
63
+ padding: 10px 0 5px 10px;
64
+ margin: 0; }
65
+ .gem h4 a {
66
+ color: gray; }
67
+
68
+ .github {
69
+ font-size: 30px;
70
+ font-weight: bold;
71
+ position: absolute;
72
+ bottom: -22px;
73
+ right: -23px; }
74
+ .gem-color-1 {
75
+ border: 3px solid #113F8C;
76
+ color: #113F8C; }
77
+ .gem-color-1 a {
78
+ color: #113F8C; }
79
+
80
+ .gem-color-2 {
81
+ border: 3px solid #32742C;
82
+ color: #32742C; }
83
+ .gem-color-2 a {
84
+ color: #32742C; }
85
+
86
+ .gem-color-3 {
87
+ border: 3px solid #F18D05;
88
+ color: #F18D05; }
89
+ .gem-color-3 a {
90
+ color: #F18D05; }
91
+
92
+ .gem-color-4 {
93
+ border: 3px solid #D70060;
94
+ color: #D70060; }
95
+ .gem-color-4 a {
96
+ color: #D70060; }
97
+
98
+ .gem-color-5 {
99
+ border: 3px solid #01A4A4;
100
+ color: #01A4A4; }
101
+ .gem-color-5 a {
102
+ color: #01A4A4; }
103
+
104
+ .gem-color-6 {
105
+ border: 3px solid #61AE24;
106
+ color: #61AE24; }
107
+ .gem-color-6 a {
108
+ color: #61AE24; }
109
+
110
+ .gem-color-7 {
111
+ border: 3px solid #00A1CB;
112
+ color: #00A1CB; }
113
+ .gem-color-7 a {
114
+ color: #00A1CB; }
115
+
116
+ .gem-color-8 {
117
+ border: 3px solid #D0D102;
118
+ color: #D0D102; }
119
+ .gem-color-8 a {
120
+ color: #D0D102; }
121
+
122
+ .gem-color-9 {
123
+ border: 3px solid #E54028;
124
+ color: #E54028; }
125
+ .gem-color-9 a {
126
+ color: #E54028; }
127
+
128
+
@@ -0,0 +1,53 @@
1
+ .gem-color-1 {
2
+ border: 3px solid #E0FDEC;
3
+ color: #E0FDEC; }
4
+ .gem-color-1 a {
5
+ color: #E0FDEC; }
6
+
7
+ .gem-color-2 {
8
+ border: 3px solid #FFF6AB;
9
+ color: #FFF6AB; }
10
+ .gem-color-2 a {
11
+ color: #FFF6AB; }
12
+
13
+ .gem-color-3 {
14
+ border: 3px solid #6CE1D9;
15
+ color: #6CE1D9; }
16
+ .gem-color-3 a {
17
+ color: #6CE1D9; }
18
+
19
+ .gem-color-4 {
20
+ border: 3px solid #F95174;
21
+ color: #F95174; }
22
+ .gem-color-4 a {
23
+ color: #F95174; }
24
+
25
+ .gem-color-5 {
26
+ border: 3px solid #4B6355;
27
+ color: #4B6355; }
28
+ .gem-color-5 a {
29
+ color: #4B6355; }
30
+
31
+ .gem-color-6 {
32
+ border: 3px solid #F1E2CB;
33
+ color: #F1E2CB; }
34
+ .gem-color-6 a {
35
+ color: #F1E2CB; }
36
+
37
+ .gem-color-7 {
38
+ border: 3px solid #FCCCD2;
39
+ color: #FCCCD2; }
40
+ .gem-color-7 a {
41
+ color: #FCCCD2; }
42
+
43
+ .gem-color-8 {
44
+ border: 3px solid #6A8491;
45
+ color: #6A8491; }
46
+ .gem-color-8 a {
47
+ color: #6A8491; }
48
+
49
+ .gem-color-9 {
50
+ border: 3px solid #7DCE84;
51
+ color: #7DCE84; }
52
+ .gem-color-9 a {
53
+ color: #7DCE84; }
@@ -0,0 +1,53 @@
1
+ .gem-color-1 {
2
+ border: 3px solid #FE0101;
3
+ color: #FE0101; }
4
+ .gem-color-1 a {
5
+ color: #FE0101; }
6
+
7
+ .gem-color-2 {
8
+ border: 3px solid #FE6002;
9
+ color: #FE6002; }
10
+ .gem-color-2 a {
11
+ color: #FE6002; }
12
+
13
+ .gem-color-3 {
14
+ border: 3px solid #CC3FF9;
15
+ color: #CC3FF9; }
16
+ .gem-color-3 a {
17
+ color: #CC3FF9; }
18
+
19
+ .gem-color-4 {
20
+ border: 3px solid #E1CA2F;
21
+ color: #E1CA2F; }
22
+ .gem-color-4 a {
23
+ color: #E1CA2F; }
24
+
25
+ .gem-color-5 {
26
+ border: 3px solid #FF8566;
27
+ color: #FF8566; }
28
+ .gem-color-5 a {
29
+ color: #FF8566; }
30
+
31
+ .gem-color-6 {
32
+ border: 3px solid #09E8F8;
33
+ color: #09E8F8; }
34
+ .gem-color-6 a {
35
+ color: #09E8F8; }
36
+
37
+ .gem-color-7 {
38
+ border: 3px solid #F1FD23;
39
+ color: #F1FD23; }
40
+ .gem-color-7 a {
41
+ color: #F1FD23; }
42
+
43
+ .gem-color-8 {
44
+ border: 3px solid #64BE4C;
45
+ color: #64BE4C; }
46
+ .gem-color-8 a {
47
+ color: #64BE4C; }
48
+
49
+ .gem-color-9 {
50
+ border: 3px solid #C38135;
51
+ color: #C38135; }
52
+ .gem-color-9 a {
53
+ color: #C38135; }
@@ -0,0 +1,42 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Fake Gemfile for testing purposes
4
+
5
+ gem 'rails', '3.2.14'
6
+
7
+ gem 'mysql2'
8
+ gem 'thin'
9
+ gem 'resque'
10
+ gem 'httparty'
11
+ gem 'json'
12
+ gem 'sanitize' # Whitelist-based HTML sanitizer.
13
+
14
+ group :production do
15
+ gem 'pg'
16
+ end
17
+
18
+ group :assets do
19
+ gem 'turbo-sprockets-rails3'
20
+ gem 'uglifier', '>= 1.0.3', :require => false
21
+ gem 'sass-rails', '~> 3.2.3'
22
+ gem 'coffee-rails', '~> 3.2.1'
23
+ end
24
+
25
+ group :development do
26
+ gem 'better_errors'
27
+ gem 'binding_of_caller', :require => false
28
+ end
29
+
30
+ group :development, :test do
31
+ # Development Tools
32
+ gem 'jazz_hands'
33
+ gem 'quiet_assets'
34
+ end
35
+
36
+ group :test do
37
+ # RSpec
38
+ gem 'rspec-rails'
39
+ gem 'rspec-mocks'
40
+ gem 'email_spec'
41
+ gem 'webmock'
42
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+ require 'fixtures/gem_list_fixture'
3
+
4
+ describe Gempage::Import::Importer do
5
+
6
+ before :each do
7
+ Gempage::Import::Importer.any_instance.stub(:puts) # Silencing display during tests
8
+ gemfile_path = File.join(Gempage.root, '/spec/fixtures/Gemfile')
9
+ @importer = Gempage::Import::Importer.new(gemfile_path)
10
+ end
11
+
12
+ xit 'should process a bunch of gems'
13
+
14
+ end
@@ -0,0 +1 @@
1
+ require 'gempage'
@@ -0,0 +1,60 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Gem Reference</title>
6
+ <link href="./gempage/assets/0.0.1/application.css" rel="stylesheet">
7
+ <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
8
+ </head>
9
+ <body>
10
+ <div class="content">
11
+ <% class_lookup = []
12
+ result.each do |group, ruby_gems|
13
+ group_array = group.split(',').map(&:strip) %>
14
+ <div class="gem-section">
15
+ <div class="gem-group-heading">
16
+ <h4><%= group.upcase %></h4>
17
+ </div>
18
+ <div class="gem-group">
19
+ <% ruby_gems.each do |rubygem| %>
20
+ <div class="main-gem">
21
+ <% group_array.each_with_index do |group_name, index|
22
+ gem_style = "z-index:#{index};"
23
+ gem_style += " top:#{(index * 5)}px; left:#{(index * 5)}px;"
24
+ class_lookup << group_name unless class_lookup.include? group_name
25
+ gem_color_id = class_lookup.find_index(group_name) + 1 %>
26
+ <div class="gem gem-color-<%= gem_color_id %>" style="<%= gem_style %>" title="<%= rubygem[:info] %>">
27
+ <% if index == 0 %>
28
+ <h4>
29
+ <% if rubygem[:homepage_uri] %>
30
+ <a href="<%= rubygem[:homepage_uri] %>" target="_blank"><%= rubygem[:name] %></a>
31
+ <% else %>
32
+ <%= rubygem[:name] %>
33
+ <% end %>
34
+ </h4>
35
+ <% end
36
+ if rubygem[:documentation_uri] %>
37
+ <div class="documentation">
38
+ <a class="icon-book icon-3x" href="<%= rubygem[:documentation_uri] %>" target="_blank"></a>
39
+ </div>
40
+ <% end
41
+ if rubygem[:source_code_uri] %>
42
+ <div class="github">
43
+ <a class="icon-github icon-3x" href="<%= rubygem[:source_code_uri] %>" target="_blank"></a>
44
+ </div>
45
+ <% end %>
46
+ </div>
47
+ <% end %>
48
+ </div>
49
+ <% end %>
50
+ </div>
51
+ </div>
52
+ <% end %>
53
+ </div>
54
+ <div class="gem-section">
55
+ <div class="gem-group-heading">
56
+ <h4>Generated by <a href="https://github.com/careful-with-that-axe/gempage">gempage</a> v<%= Gempage::VERSION %></h4>
57
+ </div>
58
+ </div>
59
+ </body>
60
+ </html>
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gempage
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jane S. Sebastian
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-23 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
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: sprockets
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: uglifier
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: sass
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
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: A reference page for gems installed within a Rails application.
112
+ email:
113
+ - jane@betatetra.com
114
+ executables:
115
+ - gempage
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .gitignore
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - assets/stylesheets/application.css
125
+ - assets/stylesheets/colors.scss
126
+ - assets/stylesheets/pastels.scss
127
+ - assets/stylesheets/random.scss
128
+ - assets/stylesheets/screen.scss
129
+ - bin/gempage
130
+ - gempage.gemspec
131
+ - lib/gempage.rb
132
+ - lib/gempage/configuration.rb
133
+ - lib/gempage/import.rb
134
+ - lib/gempage/version.rb
135
+ - public/application.css
136
+ - public/colorschemes/pastels.css
137
+ - public/colorschemes/random.css
138
+ - spec/fixtures/Gemfile
139
+ - spec/lib/importer_spec.rb
140
+ - spec/spec_helper.rb
141
+ - views/layout.erb
142
+ homepage: https://github.com/careful-with-that-axe/gempage
143
+ licenses:
144
+ - MIT
145
+ metadata: {}
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 2.1.5
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: Work in progress yo.
166
+ test_files:
167
+ - spec/fixtures/Gemfile
168
+ - spec/lib/importer_spec.rb
169
+ - spec/spec_helper.rb
170
+ has_rdoc: