coherent 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +7 -1
- data/VERSION +1 -1
- data/app_generators/coherent/templates/distil.yml.erb +1 -1
- data/app_generators/coherent/templates/src/css/@name@.css.erb +26 -26
- data/bin/coherent +4 -0
- data/coherent.gemspec +20 -16
- data/demo_generators/gallery/templates/distil.yml.erb +1 -1
- data/demo_generators/gallery/templates/src/css/@name@.css.erb +26 -26
- data/lib/distilery.rb +1 -1
- data/lib/distilery/bundle-task.rb +37 -0
- data/lib/distilery/coherent-asset-filter.rb +2 -2
- data/lib/distilery/nib-file.rb +1 -1
- data/lib/plugin.rb +83 -0
- data/lib/plugin/commands.rb +12 -0
- data/lib/plugin/commands/discover.rb +78 -0
- data/lib/plugin/commands/info.rb +29 -0
- data/lib/plugin/commands/install.rb +76 -0
- data/lib/plugin/commands/list.rb +55 -0
- data/lib/plugin/commands/plugin.rb +105 -0
- data/lib/plugin/commands/remove.rb +29 -0
- data/lib/plugin/commands/source.rb +34 -0
- data/lib/plugin/commands/sources.rb +33 -0
- data/lib/plugin/commands/unsource.rb +36 -0
- data/lib/plugin/commands/update.rb +42 -0
- data/lib/plugin/environment.rb +97 -0
- data/lib/plugin/plugin.rb +160 -0
- data/lib/plugin/recursive-http-fetcher.rb +71 -0
- data/lib/plugin/repositories.rb +92 -0
- data/lib/plugin/repository.rb +36 -0
- metadata +20 -16
- data/generators/gallery_sample/USAGE +0 -5
- data/generators/gallery_sample/gallery_sample_generator.rb +0 -48
- data/generators/gallery_sample/templates/src/nibs/@name@/@name@.css +0 -116
- data/generators/gallery_sample/templates/src/nibs/@name@/@name@.html +0 -6
- data/generators/gallery_sample/templates/src/nibs/@name@/@name@.jsnib.erb +0 -40
- data/generators/gallery_sample/templates/src/nibs/@name@/@name@.json +0 -25
- data/generators/gallery_sample/templates/src/nibs/@name@/images/next.gif +0 -0
- data/generators/gallery_sample/templates/src/nibs/@name@/images/prev.gif +0 -0
- data/generators/gallery_sample/templates/src/nibs/@name@/photos/molly-1.jpg +0 -0
- data/generators/gallery_sample/templates/src/nibs/@name@/photos/molly-2.jpg +0 -0
- data/generators/gallery_sample/templates/src/nibs/@name@/photos/molly-3.jpg +0 -0
- data/generators/gallery_sample/templates/src/nibs/@name@/photos/molly-4.jpg +0 -0
- data/generators/gallery_sample/templates/src/nibs/@name@/photos/molly-5.jpg +0 -0
- data/lib/distilery/nib-task.rb +0 -83
@@ -0,0 +1,92 @@
|
|
1
|
+
module Coherent
|
2
|
+
|
3
|
+
class Repositories
|
4
|
+
include Enumerable
|
5
|
+
|
6
|
+
def initialize(cache_file = File.join(find_home, ".coherent-plugin-sources"))
|
7
|
+
@cache_file = File.expand_path(cache_file)
|
8
|
+
load!
|
9
|
+
end
|
10
|
+
|
11
|
+
def each(&block)
|
12
|
+
@repositories.each(&block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def add(uri)
|
16
|
+
unless find{|repo| repo.uri == uri }
|
17
|
+
@repositories.push(Repository.new(uri)).last
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def remove(uri)
|
22
|
+
@repositories.reject!{|repo| repo.uri == uri}
|
23
|
+
end
|
24
|
+
|
25
|
+
def exist?(uri)
|
26
|
+
@repositories.detect{|repo| repo.uri == uri }
|
27
|
+
end
|
28
|
+
|
29
|
+
def all
|
30
|
+
@repositories
|
31
|
+
end
|
32
|
+
|
33
|
+
def find_plugin(name)
|
34
|
+
@repositories.each do |repo|
|
35
|
+
repo.each do |plugin|
|
36
|
+
return plugin if plugin.name == name
|
37
|
+
end
|
38
|
+
end
|
39
|
+
return nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def load!
|
43
|
+
contents = File.exist?(@cache_file) ? File.read(@cache_file) : defaults
|
44
|
+
contents = defaults if contents.empty?
|
45
|
+
@repositories = contents.split(/\n/).reject do |line|
|
46
|
+
line =~ /^\s*#/ or line =~ /^\s*$/
|
47
|
+
end.map { |source| Repository.new(source.strip) }
|
48
|
+
end
|
49
|
+
|
50
|
+
def save
|
51
|
+
File.open(@cache_file, 'w') do |f|
|
52
|
+
each do |repo|
|
53
|
+
f.write(repo.uri)
|
54
|
+
f.write("\n")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def defaults
|
60
|
+
<<-DEFAULTS
|
61
|
+
http://coherent.googlecode.com/svn/plugins/
|
62
|
+
DEFAULTS
|
63
|
+
end
|
64
|
+
|
65
|
+
def find_home
|
66
|
+
['HOME', 'USERPROFILE'].each do |homekey|
|
67
|
+
return ENV[homekey] if ENV[homekey]
|
68
|
+
end
|
69
|
+
if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
|
70
|
+
return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
|
71
|
+
end
|
72
|
+
begin
|
73
|
+
File.expand_path("~")
|
74
|
+
rescue StandardError => ex
|
75
|
+
if File::ALT_SEPARATOR
|
76
|
+
"C:/"
|
77
|
+
else
|
78
|
+
"/"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.instance
|
84
|
+
@instance ||= Repositories.new
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.each(&block)
|
88
|
+
self.instance.each(&block)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Coherent
|
2
|
+
|
3
|
+
class Repository
|
4
|
+
include Enumerable
|
5
|
+
attr_reader :uri, :plugins
|
6
|
+
|
7
|
+
def initialize(uri)
|
8
|
+
@uri = uri.chomp('/') << "/"
|
9
|
+
@plugins = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def plugins
|
13
|
+
unless @plugins
|
14
|
+
if $verbose
|
15
|
+
puts "Discovering plugins in #{@uri}"
|
16
|
+
puts index
|
17
|
+
end
|
18
|
+
|
19
|
+
@plugins = index.reject{ |line| line !~ /\/$/ }
|
20
|
+
@plugins.map! { |name| Plugin.new(File.join(@uri, name), name) }
|
21
|
+
end
|
22
|
+
|
23
|
+
@plugins
|
24
|
+
end
|
25
|
+
|
26
|
+
def each(&block)
|
27
|
+
plugins.each(&block)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def index
|
32
|
+
@index ||= RecursiveHTTPFetcher.new(@uri).ls
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coherent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Watkins
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-26 00:00:00 -07:00
|
13
13
|
default_executable: coherent
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -78,19 +78,6 @@ files:
|
|
78
78
|
- generators/class/USAGE
|
79
79
|
- generators/class/class_generator.rb
|
80
80
|
- generators/class/templates/@name@.js.erb
|
81
|
-
- generators/gallery_sample/USAGE
|
82
|
-
- generators/gallery_sample/gallery_sample_generator.rb
|
83
|
-
- generators/gallery_sample/templates/src/nibs/@name@/@name@.css
|
84
|
-
- generators/gallery_sample/templates/src/nibs/@name@/@name@.html
|
85
|
-
- generators/gallery_sample/templates/src/nibs/@name@/@name@.jsnib.erb
|
86
|
-
- generators/gallery_sample/templates/src/nibs/@name@/@name@.json
|
87
|
-
- generators/gallery_sample/templates/src/nibs/@name@/images/next.gif
|
88
|
-
- generators/gallery_sample/templates/src/nibs/@name@/images/prev.gif
|
89
|
-
- generators/gallery_sample/templates/src/nibs/@name@/photos/molly-1.jpg
|
90
|
-
- generators/gallery_sample/templates/src/nibs/@name@/photos/molly-2.jpg
|
91
|
-
- generators/gallery_sample/templates/src/nibs/@name@/photos/molly-3.jpg
|
92
|
-
- generators/gallery_sample/templates/src/nibs/@name@/photos/molly-4.jpg
|
93
|
-
- generators/gallery_sample/templates/src/nibs/@name@/photos/molly-5.jpg
|
94
81
|
- generators/nib/USAGE
|
95
82
|
- generators/nib/nib_generator.rb
|
96
83
|
- generators/nib/templates/@name@.css.erb
|
@@ -98,9 +85,26 @@ files:
|
|
98
85
|
- generators/nib/templates/@name@.jsnib.erb
|
99
86
|
- lib/coherent.rb
|
100
87
|
- lib/distilery.rb
|
88
|
+
- lib/distilery/bundle-task.rb
|
101
89
|
- lib/distilery/coherent-asset-filter.rb
|
102
90
|
- lib/distilery/nib-file.rb
|
103
|
-
- lib/
|
91
|
+
- lib/plugin.rb
|
92
|
+
- lib/plugin/commands.rb
|
93
|
+
- lib/plugin/commands/discover.rb
|
94
|
+
- lib/plugin/commands/info.rb
|
95
|
+
- lib/plugin/commands/install.rb
|
96
|
+
- lib/plugin/commands/list.rb
|
97
|
+
- lib/plugin/commands/plugin.rb
|
98
|
+
- lib/plugin/commands/remove.rb
|
99
|
+
- lib/plugin/commands/source.rb
|
100
|
+
- lib/plugin/commands/sources.rb
|
101
|
+
- lib/plugin/commands/unsource.rb
|
102
|
+
- lib/plugin/commands/update.rb
|
103
|
+
- lib/plugin/environment.rb
|
104
|
+
- lib/plugin/plugin.rb
|
105
|
+
- lib/plugin/recursive-http-fetcher.rb
|
106
|
+
- lib/plugin/repositories.rb
|
107
|
+
- lib/plugin/repository.rb
|
104
108
|
has_rdoc: true
|
105
109
|
homepage: http://coherentjs.org
|
106
110
|
licenses: []
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/../../lib/coherent"
|
2
|
-
|
3
|
-
class GallerySampleGenerator < CoherentBaseGenerator
|
4
|
-
|
5
|
-
default_options :author => nil
|
6
|
-
|
7
|
-
attr_reader :name
|
8
|
-
|
9
|
-
def initialize(runtime_args, runtime_options = {})
|
10
|
-
super
|
11
|
-
usage if args.empty?
|
12
|
-
@name = args.shift
|
13
|
-
extract_options
|
14
|
-
end
|
15
|
-
|
16
|
-
def manifest
|
17
|
-
record do |m|
|
18
|
-
copy_template_folder m
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
def banner
|
24
|
-
<<-EOS
|
25
|
-
Creates a ...
|
26
|
-
|
27
|
-
USAGE: #{$0} #{spec.name} name
|
28
|
-
EOS
|
29
|
-
end
|
30
|
-
|
31
|
-
def add_options!(opts)
|
32
|
-
# opts.separator ''
|
33
|
-
# opts.separator 'Options:'
|
34
|
-
# For each option below, place the default
|
35
|
-
# at the top of the file next to "default_options"
|
36
|
-
# opts.on("-a", "--author=\"Your Name\"", String,
|
37
|
-
# "Some comment about this option",
|
38
|
-
# "Default: none") { |o| options[:author] = o }
|
39
|
-
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
40
|
-
end
|
41
|
-
|
42
|
-
def extract_options
|
43
|
-
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
44
|
-
# Templates can access these value via the attr_reader-generated methods, but not the
|
45
|
-
# raw instance variable value.
|
46
|
-
# @author = options[:author]
|
47
|
-
end
|
48
|
-
end
|
@@ -1,116 +0,0 @@
|
|
1
|
-
.gallery
|
2
|
-
{
|
3
|
-
border: 1px solid #888;
|
4
|
-
-webkit-border-radius: 5px;
|
5
|
-
background-color: #f8f8f8;
|
6
|
-
padding: 10px 10px 35px 10px;
|
7
|
-
width: 254px;
|
8
|
-
height: 200px;
|
9
|
-
-webkit-box-shadow: 0px 2px 5px rgba(0,0,0,0.5);
|
10
|
-
|
11
|
-
overflow: hidden;
|
12
|
-
position: fixed;
|
13
|
-
left: 50%;
|
14
|
-
top: 50%;
|
15
|
-
margin: -125px 0 0 -127px;
|
16
|
-
}
|
17
|
-
|
18
|
-
.gallery.invisible
|
19
|
-
{
|
20
|
-
opacity: 0.5;
|
21
|
-
width: 50px;
|
22
|
-
height: 50px;
|
23
|
-
margin: -25px 0 0 -25px;
|
24
|
-
}
|
25
|
-
|
26
|
-
.gallery.invisible *
|
27
|
-
{
|
28
|
-
display: none !important;
|
29
|
-
}
|
30
|
-
|
31
|
-
.gallery p
|
32
|
-
{
|
33
|
-
font-family: helvetica, arial, sans serif;
|
34
|
-
font-size: 13px;
|
35
|
-
color: #555;
|
36
|
-
background-color: inherit;
|
37
|
-
}
|
38
|
-
|
39
|
-
.gallery p.updating
|
40
|
-
{
|
41
|
-
background-color: yellow;
|
42
|
-
}
|
43
|
-
|
44
|
-
.gallery img
|
45
|
-
{
|
46
|
-
border: 1px solid #666;
|
47
|
-
padding: 1px;
|
48
|
-
background-color: white;
|
49
|
-
}
|
50
|
-
|
51
|
-
.gallery a.next
|
52
|
-
{
|
53
|
-
position: absolute;
|
54
|
-
display: block;
|
55
|
-
text-indent: -9999px;
|
56
|
-
outline: none;
|
57
|
-
background-image: url(images/next.gif);
|
58
|
-
right: 10px;
|
59
|
-
bottom: 10px;
|
60
|
-
height: 22px;
|
61
|
-
width: 22px;
|
62
|
-
background-position: 0px -22px;
|
63
|
-
}
|
64
|
-
|
65
|
-
.gallery a.prev
|
66
|
-
{
|
67
|
-
position: absolute;
|
68
|
-
display: block;
|
69
|
-
outline: none;
|
70
|
-
text-indent: -9999px;
|
71
|
-
background-image: url(images/prev.gif);
|
72
|
-
left: 10px;
|
73
|
-
bottom: 10px;
|
74
|
-
height: 22px;
|
75
|
-
width: 22px;
|
76
|
-
background-position: 0px -22px;
|
77
|
-
}
|
78
|
-
|
79
|
-
.gallery a.next:active,
|
80
|
-
.gallery a.prev:active
|
81
|
-
{
|
82
|
-
background-position: 0px 0px;
|
83
|
-
}
|
84
|
-
|
85
|
-
.gallery a.disabled,
|
86
|
-
.gallery a.disabled:active
|
87
|
-
{
|
88
|
-
background-position: 0px -44px;
|
89
|
-
cursor: default;
|
90
|
-
}
|
91
|
-
|
92
|
-
.modal-overlay-guard
|
93
|
-
{
|
94
|
-
position: fixed;
|
95
|
-
left: 0;
|
96
|
-
top: 0;
|
97
|
-
width: 100%;
|
98
|
-
height: 100%;
|
99
|
-
}
|
100
|
-
|
101
|
-
.modal-overlay-backdrop
|
102
|
-
{
|
103
|
-
background-color: black;
|
104
|
-
opacity: 0.65;
|
105
|
-
position: fixed;
|
106
|
-
left: 0;
|
107
|
-
top: 0;
|
108
|
-
width: 100%;
|
109
|
-
height: 100%;
|
110
|
-
}
|
111
|
-
|
112
|
-
.modal-overlay-backdrop.invisible
|
113
|
-
{
|
114
|
-
opacity: 0;
|
115
|
-
}
|
116
|
-
|
@@ -1,40 +0,0 @@
|
|
1
|
-
/*jsl:import coherent-uncompressed.js*/
|
2
|
-
|
3
|
-
NIB.asset('<%=name%>.css');
|
4
|
-
|
5
|
-
NIB({
|
6
|
-
|
7
|
-
'<%=name%>': VIEW(NIB.asset('<%=name%>.html'), {
|
8
|
-
':root': coherent.View({
|
9
|
-
visibleBinding: 'controller.arrangedObjects.@count'
|
10
|
-
}),
|
11
|
-
'img': coherent.Image({
|
12
|
-
srcBinding: 'controller.selection.href'
|
13
|
-
}),
|
14
|
-
'p': coherent.View({
|
15
|
-
textBinding: 'controller.selection.caption'
|
16
|
-
}),
|
17
|
-
'a.next': coherent.Anchor({
|
18
|
-
enabledBinding: 'controller.canSelectNext',
|
19
|
-
target: 'controller',
|
20
|
-
action: 'selectNext'
|
21
|
-
}),
|
22
|
-
'a.prev': coherent.Anchor({
|
23
|
-
enabledBinding: 'controller.canSelectPrevious',
|
24
|
-
target: 'controller',
|
25
|
-
action: 'selectPrevious'
|
26
|
-
})
|
27
|
-
}),
|
28
|
-
|
29
|
-
'data': NIB.asset('<%=name%>.json'),
|
30
|
-
|
31
|
-
'controller': coherent.ArrayController({
|
32
|
-
contentBinding: 'data.photos'
|
33
|
-
}),
|
34
|
-
|
35
|
-
'owner': {
|
36
|
-
view: '<%=name%>'
|
37
|
-
}
|
38
|
-
|
39
|
-
});
|
40
|
-
|
@@ -1,25 +0,0 @@
|
|
1
|
-
{
|
2
|
-
photos: [
|
3
|
-
{
|
4
|
-
caption: "Molly on the slide.",
|
5
|
-
href: NIB.asset("photos/molly-1.jpg")
|
6
|
-
},
|
7
|
-
{
|
8
|
-
caption: "Monkey in training",
|
9
|
-
href: NIB.asset("photos/molly-2.jpg")
|
10
|
-
},
|
11
|
-
{
|
12
|
-
caption: "Spaz attack!",
|
13
|
-
href: NIB.asset("photos/molly-3.jpg")
|
14
|
-
},
|
15
|
-
{
|
16
|
-
caption: "Ride `Em, Molly!",
|
17
|
-
href: NIB.asset("photos/molly-4.jpg")
|
18
|
-
},
|
19
|
-
{
|
20
|
-
caption: "Don't mess with my zebra.",
|
21
|
-
href: NIB.asset("photos/molly-5.jpg")
|
22
|
-
}
|
23
|
-
]
|
24
|
-
|
25
|
-
}
|
Binary file
|