interfacelift 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.rdoc +57 -0
- data/Rakefile +13 -16
- data/VERSION +1 -1
- data/bin/interfacelift +17 -2
- data/docs/todo.txt +6 -0
- data/lib/catalog.rb +68 -0
- data/lib/fetcher.rb +5 -0
- data/lib/installer.rb +4 -14
- data/lib/interfacelift.rb +3 -0
- data/rdoc/classes/InterfaceLift.html +148 -0
- data/rdoc/classes/InterfaceLift/Catalog.html +250 -0
- data/rdoc/classes/InterfaceLift/Fetcher.html +111 -0
- data/rdoc/classes/InterfaceLift/Installer.html +223 -0
- data/rdoc/classes/InterfaceLift/ThemeManager.html +148 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/lib/catalog_rb.html +109 -0
- data/rdoc/files/lib/fetcher_rb.html +101 -0
- data/rdoc/files/lib/installer_rb.html +101 -0
- data/rdoc/files/lib/interfacelift_rb.html +111 -0
- data/rdoc/files/lib/templates/bright_admin/install_rb.html +101 -0
- data/rdoc/files/lib/theme_manager_rb.html +101 -0
- data/rdoc/fr_class_index.html +31 -0
- data/rdoc/fr_file_index.html +32 -0
- data/rdoc/fr_method_index.html +33 -0
- data/rdoc/index.html +26 -0
- data/rdoc/rdoc-style.css +208 -0
- data/spec/assets/README +0 -0
- data/spec/assets/test_theme/README +1 -0
- data/spec/assets/test_theme2/README +1 -0
- data/spec/catalog_spec.rb +110 -0
- data/spec/fetcher_spec.rb +5 -0
- data/spec/installer_spec.rb +14 -17
- data/spec/interfacelift_spec.rb +4 -0
- data/spec/spec_helper.rb +5 -4
- metadata +54 -5
data/.gitignore
CHANGED
data/README.rdoc
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
= WARNING! THIS GEM IS UNDER HEAVY DEVELOPMENT AND SHOULD BE USED WITH CAUTION!!!11
|
2
|
+
|
3
|
+
= InterfaceLift
|
4
|
+
* http://github.com/michel/interfaceLift
|
5
|
+
|
6
|
+
== DESCRIPTION
|
7
|
+
|
8
|
+
Are you a programmer? Do you hate doing GUI related stuff? Or just want your app to look good without much effort?
|
9
|
+
Well interfacelift might be the gem your looking for!
|
10
|
+
|
11
|
+
Interface lift is a handy gem for installing themes in rails apps.
|
12
|
+
You can install themes with just one single command:
|
13
|
+
|
14
|
+
interfacelift install bright_admin --repo git://github.com/michel/bright_admin.git
|
15
|
+
|
16
|
+
== FEATURES
|
17
|
+
|
18
|
+
- Needs MOAR features..
|
19
|
+
|
20
|
+
== SYNOPSIS
|
21
|
+
|
22
|
+
rails my_app
|
23
|
+
cd my_app
|
24
|
+
interfacelift install bright_admin --repo git://github.com/michel/bright_admin.git
|
25
|
+
|
26
|
+
== INSTALL
|
27
|
+
|
28
|
+
sudo gem install interfacelift --source http://gemcutter.org
|
29
|
+
|
30
|
+
== LICENSE:
|
31
|
+
|
32
|
+
(The MIT License)
|
33
|
+
|
34
|
+
Copyright (c) 2009 Michel de Graaf (michel@re-invention.nl), http://re-invention.nl
|
35
|
+
Copyright (c) 2009 Jeroen van Schagen (jeroen.v.schagen@gmail.com)
|
36
|
+
|
37
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
38
|
+
a copy of this software and associated documentation files (the
|
39
|
+
'Software'), to deal in the Software without restriction, including
|
40
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
41
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
42
|
+
permit persons to whom the Software is furnished to do so, subject to
|
43
|
+
the following conditions:
|
44
|
+
|
45
|
+
The above copyright notice and this permission notice shall be
|
46
|
+
included in all copies or substantial portions of the Software.
|
47
|
+
|
48
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
49
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
50
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
51
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
52
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
53
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
54
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
55
|
+
|
56
|
+
|
57
|
+
|
data/Rakefile
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
+
|
3
4
|
|
4
5
|
begin
|
5
6
|
require 'jeweler'
|
6
7
|
Jeweler::Tasks.new do |gem|
|
7
8
|
gem.name = "interfacelift"
|
8
9
|
gem.summary = %Q{Installs templates in rails applications}
|
9
|
-
gem.description = %Q{
|
10
|
+
gem.description = %Q{Installs themes and other layout/interface related resources}
|
10
11
|
gem.email = "michel@re-invention.nl"
|
11
12
|
gem.homepage = "http://github.com/michel/interfacelift"
|
12
|
-
gem.authors = ["Michel de Graaf"]
|
13
|
-
gem.
|
13
|
+
gem.authors = ["Michel de Graaf","Jeroen van Schagen"]
|
14
|
+
gem.add_dependency "commander"
|
15
|
+
gem.add_dependency "git"
|
16
|
+
gem.add_development_dependency "thoughtbot-shoulda"
|
14
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
18
|
end
|
16
19
|
Jeweler::GemcutterTasks.new
|
@@ -25,21 +28,15 @@ Spec::Rake::SpecTask.new('spec') do |t|
|
|
25
28
|
t.spec_opts = ['--options', "\"spec/spec.opts\""]
|
26
29
|
end
|
27
30
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
test.verbose = true
|
35
|
-
end
|
36
|
-
rescue LoadError
|
37
|
-
task :rcov do
|
38
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
39
|
-
end
|
31
|
+
desc "Run all specs with RCov"
|
32
|
+
Spec::Rake::SpecTask.new('specs_with_rcov') do |t|
|
33
|
+
t.spec_files = FileList['spec/*_spec.rb']
|
34
|
+
t.rcov = true
|
35
|
+
t.spec_opts = ['--options', "\"spec/spec.opts\""]
|
36
|
+
t.rcov_opts = ['--exclude', 'spec']
|
40
37
|
end
|
41
38
|
|
42
|
-
|
39
|
+
|
43
40
|
|
44
41
|
task :test => :check_dependencies
|
45
42
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/bin/interfacelift
CHANGED
@@ -12,12 +12,27 @@ program :description, 'Installs layouts in rails apps'
|
|
12
12
|
command :install do |c|
|
13
13
|
c.syntax = 'install theme path'
|
14
14
|
c.description = 'installs theme in rails app'
|
15
|
+
c.option '--repo git://repo.git', String, 'Fetch the theme from a git repo'
|
15
16
|
c.action do |args, options|
|
16
17
|
if args.size < 1
|
17
|
-
puts "You need to give the theme name
|
18
|
+
puts "You need to give the theme name."
|
18
19
|
else
|
19
20
|
begin
|
20
|
-
|
21
|
+
theme = args[0]
|
22
|
+
path = args[1].nil? ? "." : args[1]
|
23
|
+
catalog = InterfaceLift::Catalog.new
|
24
|
+
|
25
|
+
raise "You need to provide the git repo of #{theme}, using the --repo flag" if options.repo.nil?
|
26
|
+
|
27
|
+
if catalog.theme_exists?(theme)
|
28
|
+
puts "Fetching updates for #{theme}..."
|
29
|
+
catalog.update_theme(theme)
|
30
|
+
else
|
31
|
+
puts "Fetching theme #{theme}..."
|
32
|
+
catalog.add_theme(theme,options.repo)
|
33
|
+
end
|
34
|
+
|
35
|
+
installer = InterfaceLift::Installer.new(path,theme)
|
21
36
|
installer.install!
|
22
37
|
rescue Exception => e
|
23
38
|
puts e
|
data/docs/todo.txt
ADDED
data/lib/catalog.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'git'
|
3
|
+
|
4
|
+
module InterfaceLift
|
5
|
+
class Catalog
|
6
|
+
attr_reader :catalog_path
|
7
|
+
|
8
|
+
def initialize(catalog_path = nil)
|
9
|
+
@catalog_path = catalog_path.nil? ? ::InterfaceLift::DEFAULT_CATALOG_PATH : catalog_path
|
10
|
+
create_catalog_path!
|
11
|
+
end
|
12
|
+
|
13
|
+
# Retrieve themes from specified catalog path
|
14
|
+
def themes
|
15
|
+
themes = []
|
16
|
+
Dir.glob("#{@catalog_path}/*").each do |item|
|
17
|
+
themes << item if File.directory? item
|
18
|
+
end
|
19
|
+
themes.map { |path| path.split("/").last }
|
20
|
+
end
|
21
|
+
|
22
|
+
# Does the given theme exist in the working path
|
23
|
+
def theme_exists?(theme)
|
24
|
+
themes.include?(theme) && git_repo?(theme)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Is the argumented theme a git repository?
|
28
|
+
def git_repo?(theme)
|
29
|
+
begin
|
30
|
+
g = Git.open("#{catalog_path}/#{theme}")
|
31
|
+
rescue ArgumentError => e
|
32
|
+
# If the path does not exist it will return an ArgumentError
|
33
|
+
return false
|
34
|
+
end
|
35
|
+
g.index.readable?
|
36
|
+
end
|
37
|
+
|
38
|
+
# Retrieve the latest version of argumented theme from git repository
|
39
|
+
def update_theme(theme)
|
40
|
+
return false unless git_repo?(theme)
|
41
|
+
g = Git.open("#{catalog_path}/#{theme}")
|
42
|
+
!g.pull.match(/^Updating/).nil?
|
43
|
+
end
|
44
|
+
|
45
|
+
# Remove theme from catalog
|
46
|
+
def remove_theme(theme)
|
47
|
+
FileUtils.rm_rf("#{@catalog_path}/#{theme}")
|
48
|
+
end
|
49
|
+
|
50
|
+
# Download a theme from git repository
|
51
|
+
# returns true when sucessfull
|
52
|
+
# raises exception when it fails
|
53
|
+
def add_theme(theme, repo)
|
54
|
+
remove_theme(theme)
|
55
|
+
!Git.clone(repo, "#{@catalog_path}/#{theme}").repo.path.nil?
|
56
|
+
end
|
57
|
+
|
58
|
+
#create catalog path when it does not exist
|
59
|
+
def create_catalog_path!
|
60
|
+
FileUtils.mkdir_p(@catalog_path) unless File.exists?(@catalog_path)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
# test = InterfaceLift::Catalog.new
|
68
|
+
# test.add_theme "bright_admin", "git://github.com/michel/bright_admin.git"
|
data/lib/fetcher.rb
ADDED
data/lib/installer.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
module InterfaceLift
|
2
2
|
class Installer
|
3
3
|
attr_reader :path, :theme, :theme_path
|
4
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
5
|
-
SHARED = "#{APP_ROOT}/lib/templates/shared"
|
6
4
|
|
7
5
|
|
8
|
-
def initialize(path,theme)
|
6
|
+
def initialize(path,theme,catalog_path=InterfaceLift::DEFAULT_CATALOG_PATH)
|
9
7
|
@path = path
|
10
|
-
@theme = theme
|
11
|
-
@theme_path = "#{
|
8
|
+
@theme = theme
|
9
|
+
@theme_path = "#{catalog_path}/#{theme}"
|
12
10
|
|
13
11
|
raise "Given path does not contain a rails app." unless File.directory? "#{@path}/public"
|
14
12
|
raise "Theme #{@theme} is not available." unless File.directory? @theme_path
|
@@ -19,7 +17,6 @@ module InterfaceLift
|
|
19
17
|
install_stylesheets
|
20
18
|
install_layouts
|
21
19
|
install_javascript
|
22
|
-
install_shared
|
23
20
|
theme_install
|
24
21
|
end
|
25
22
|
|
@@ -67,13 +64,6 @@ module InterfaceLift
|
|
67
64
|
end
|
68
65
|
FileUtils.cp_r "#{@theme_path}/public/javascripts","#{path}/public"
|
69
66
|
end
|
70
|
-
|
71
|
-
def install_shared
|
72
|
-
return nil unless File.directory? "#{SHARED}/icons"
|
73
|
-
Dir.glob("#{SHARED}/icons/*").each do |file|
|
74
|
-
puts "Installing icons/#{file.split("/").last}"
|
75
|
-
end
|
76
|
-
FileUtils.cp_r "#{SHARED}/icons","#{path}/public/images/"
|
77
|
-
end
|
67
|
+
|
78
68
|
end
|
79
69
|
end
|
data/lib/interfacelift.rb
CHANGED
@@ -0,0 +1,148 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: InterfaceLift</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">InterfaceLift</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/catalog_rb.html">
|
59
|
+
lib/catalog.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../files/lib/fetcher_rb.html">
|
63
|
+
lib/fetcher.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../files/lib/installer_rb.html">
|
67
|
+
lib/installer.rb
|
68
|
+
</a>
|
69
|
+
<br />
|
70
|
+
<a href="../files/lib/interfacelift_rb.html">
|
71
|
+
lib/interfacelift.rb
|
72
|
+
</a>
|
73
|
+
<br />
|
74
|
+
<a href="../files/lib/theme_manager_rb.html">
|
75
|
+
lib/theme_manager.rb
|
76
|
+
</a>
|
77
|
+
<br />
|
78
|
+
</td>
|
79
|
+
</tr>
|
80
|
+
|
81
|
+
</table>
|
82
|
+
</div>
|
83
|
+
<!-- banner header -->
|
84
|
+
|
85
|
+
<div id="bodyContent">
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<div id="contextContent">
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
<div id="class-list">
|
104
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
105
|
+
|
106
|
+
Class <a href="InterfaceLift/Catalog.html" class="link">InterfaceLift::Catalog</a><br />
|
107
|
+
Class <a href="InterfaceLift/Fetcher.html" class="link">InterfaceLift::Fetcher</a><br />
|
108
|
+
Class <a href="InterfaceLift/Installer.html" class="link">InterfaceLift::Installer</a><br />
|
109
|
+
Class <a href="InterfaceLift/ThemeManager.html" class="link">InterfaceLift::ThemeManager</a><br />
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div id="constants-list">
|
114
|
+
<h3 class="section-bar">Constants</h3>
|
115
|
+
|
116
|
+
<div class="name-list">
|
117
|
+
<table summary="Constants">
|
118
|
+
<tr class="top-aligned-row context-row">
|
119
|
+
<td class="context-item-name">VERSION</td>
|
120
|
+
<td>=</td>
|
121
|
+
<td class="context-item-value">"0.0.1"</td>
|
122
|
+
</tr>
|
123
|
+
<tr class="top-aligned-row context-row">
|
124
|
+
<td class="context-item-name">DEFAULT_CATELOG_PATH</td>
|
125
|
+
<td>=</td>
|
126
|
+
<td class="context-item-value">"~/.interfacelift"</td>
|
127
|
+
</tr>
|
128
|
+
</table>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<!-- if method_list -->
|
138
|
+
|
139
|
+
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
<div id="validator-badges">
|
144
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
</body>
|
148
|
+
</html>
|
@@ -0,0 +1,250 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: InterfaceLift::Catalog</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">InterfaceLift::Catalog</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/catalog_rb.html">
|
59
|
+
lib/catalog.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000004">git_repo?</a>
|
90
|
+
<a href="#M000001">new</a>
|
91
|
+
<a href="#M000003">theme_exists?</a>
|
92
|
+
<a href="#M000002">themes</a>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<div id="attribute-list">
|
108
|
+
<h3 class="section-bar">Attributes</h3>
|
109
|
+
|
110
|
+
<div class="name-list">
|
111
|
+
<table>
|
112
|
+
<tr class="top-aligned-row context-row">
|
113
|
+
<td class="context-item-name">catalog_path</td>
|
114
|
+
<td class="context-item-value"> [R] </td>
|
115
|
+
<td class="context-item-desc"></td>
|
116
|
+
</tr>
|
117
|
+
</table>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<!-- if method_list -->
|
124
|
+
<div id="methods">
|
125
|
+
<h3 class="section-bar">Public Class methods</h3>
|
126
|
+
|
127
|
+
<div id="method-M000001" class="method-detail">
|
128
|
+
<a name="M000001"></a>
|
129
|
+
|
130
|
+
<div class="method-heading">
|
131
|
+
<a href="#M000001" class="method-signature">
|
132
|
+
<span class="method-name">new</span><span class="method-args">(catalog_path = nil)</span>
|
133
|
+
</a>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<div class="method-description">
|
137
|
+
<p><a class="source-toggle" href="#"
|
138
|
+
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
139
|
+
<div class="method-source-code" id="M000001-source">
|
140
|
+
<pre>
|
141
|
+
<span class="ruby-comment cmt"># File lib/catalog.rb, line 8</span>
|
142
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">catalog_path</span> = <span class="ruby-keyword kw">nil</span>)
|
143
|
+
<span class="ruby-ivar">@catalog_path</span> = <span class="ruby-identifier">catalog_path</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-constant">DEFAULT_CATELOG_PATH</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">catalog_path</span>
|
144
|
+
<span class="ruby-keyword kw">end</span>
|
145
|
+
</pre>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
151
|
+
|
152
|
+
<div id="method-M000004" class="method-detail">
|
153
|
+
<a name="M000004"></a>
|
154
|
+
|
155
|
+
<div class="method-heading">
|
156
|
+
<a href="#M000004" class="method-signature">
|
157
|
+
<span class="method-name">git_repo?</span><span class="method-args">(theme)</span>
|
158
|
+
</a>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
<p><a class="source-toggle" href="#"
|
163
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
164
|
+
<div class="method-source-code" id="M000004-source">
|
165
|
+
<pre>
|
166
|
+
<span class="ruby-comment cmt"># File lib/catalog.rb, line 26</span>
|
167
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">git_repo?</span>(<span class="ruby-identifier">theme</span>)
|
168
|
+
<span class="ruby-keyword kw">begin</span>
|
169
|
+
<span class="ruby-identifier">g</span> = <span class="ruby-constant">Git</span>.<span class="ruby-identifier">open</span>(<span class="ruby-node">"#{catalog_path}/#{theme}"</span>)
|
170
|
+
<span class="ruby-comment cmt"># If the path does not exist it will return an ArgumentError</span>
|
171
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
172
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
173
|
+
<span class="ruby-keyword kw">end</span>
|
174
|
+
<span class="ruby-identifier">g</span>.<span class="ruby-identifier">index</span>.<span class="ruby-identifier">readable?</span>
|
175
|
+
<span class="ruby-keyword kw">end</span>
|
176
|
+
</pre>
|
177
|
+
</div>
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div id="method-M000003" class="method-detail">
|
182
|
+
<a name="M000003"></a>
|
183
|
+
|
184
|
+
<div class="method-heading">
|
185
|
+
<a href="#M000003" class="method-signature">
|
186
|
+
<span class="method-name">theme_exists?</span><span class="method-args">(theme)</span>
|
187
|
+
</a>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
<div class="method-description">
|
191
|
+
<p>
|
192
|
+
Does the given theme exist in the working path
|
193
|
+
</p>
|
194
|
+
<p><a class="source-toggle" href="#"
|
195
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
196
|
+
<div class="method-source-code" id="M000003-source">
|
197
|
+
<pre>
|
198
|
+
<span class="ruby-comment cmt"># File lib/catalog.rb, line 22</span>
|
199
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">theme_exists?</span>(<span class="ruby-identifier">theme</span>)
|
200
|
+
<span class="ruby-identifier">themes</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">theme</span>)
|
201
|
+
<span class="ruby-keyword kw">end</span>
|
202
|
+
</pre>
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div id="method-M000002" class="method-detail">
|
208
|
+
<a name="M000002"></a>
|
209
|
+
|
210
|
+
<div class="method-heading">
|
211
|
+
<a href="#M000002" class="method-signature">
|
212
|
+
<span class="method-name">themes</span><span class="method-args">()</span>
|
213
|
+
</a>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<div class="method-description">
|
217
|
+
<p>
|
218
|
+
Retrieve <a href="Catalog.html#M000002">themes</a> from specified catalog
|
219
|
+
path
|
220
|
+
</p>
|
221
|
+
<p><a class="source-toggle" href="#"
|
222
|
+
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
223
|
+
<div class="method-source-code" id="M000002-source">
|
224
|
+
<pre>
|
225
|
+
<span class="ruby-comment cmt"># File lib/catalog.rb, line 13</span>
|
226
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">themes</span>
|
227
|
+
<span class="ruby-identifier">themes</span> = []
|
228
|
+
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-node">"#{@catalog_path}/*"</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
229
|
+
<span class="ruby-identifier">themes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">item</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">item</span>
|
230
|
+
<span class="ruby-keyword kw">end</span>
|
231
|
+
<span class="ruby-identifier">themes</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"/"</span>).<span class="ruby-identifier">last</span> }
|
232
|
+
<span class="ruby-keyword kw">end</span>
|
233
|
+
</pre>
|
234
|
+
</div>
|
235
|
+
</div>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
|
239
|
+
</div>
|
240
|
+
|
241
|
+
|
242
|
+
</div>
|
243
|
+
|
244
|
+
|
245
|
+
<div id="validator-badges">
|
246
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
</body>
|
250
|
+
</html>
|