coherent 0.6.10 → 0.6.11
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.
- data/VERSION +1 -1
- data/app_generators/coherent/templates/src/js/AppDelegate.js.erb +16 -1
- data/bin/coherent +18 -5
- data/coherent.gemspec +3 -4
- data/generators/class/class_generator.rb +15 -2
- data/generators/class/templates/@name@.js.erb +5 -2
- data/generators/nib/nib_generator.rb +4 -1
- data/generators/nib/templates/@name@.js.erb +7 -8
- data/lib/coherent.rb +20 -0
- metadata +6 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.11
|
@@ -37,6 +37,21 @@
|
|
37
37
|
*/
|
38
38
|
hashDidChange: function(hashValue)
|
39
39
|
{
|
40
|
-
}
|
40
|
+
},
|
41
|
+
|
42
|
+
pageTitleForString: function(string)
|
43
|
+
{
|
44
|
+
return string;
|
45
|
+
},
|
46
|
+
|
47
|
+
historyStateForViewController: function(viewController)
|
48
|
+
{
|
49
|
+
return null;
|
50
|
+
},
|
51
|
+
|
52
|
+
viewControllerForPath: function(path, historyState)
|
53
|
+
{
|
54
|
+
return null;
|
55
|
+
}
|
41
56
|
|
42
57
|
});
|
data/bin/coherent
CHANGED
@@ -5,17 +5,30 @@ require 'rubigen'
|
|
5
5
|
|
6
6
|
require 'rubigen/scripts/generate'
|
7
7
|
|
8
|
+
BUILD_FILE= 'Buildfile'
|
9
|
+
|
8
10
|
def find_project_file(dir=nil)
|
11
|
+
cwd= Dir.pwd
|
9
12
|
dir ||= Dir.pwd
|
10
|
-
|
11
13
|
while dir.length > 1
|
12
|
-
|
13
|
-
if (
|
14
|
-
|
14
|
+
build_file= File.join(dir, BUILD_FILE)
|
15
|
+
return build_file if File.exists?(build_file)
|
16
|
+
|
17
|
+
projects= Dir.glob(File.join(dir, "*.jsproj"))
|
18
|
+
return from_file(projects.first) if 1==projects.size
|
19
|
+
|
20
|
+
unless 0==projects.size
|
21
|
+
puts "More than one candidate for Project:"
|
22
|
+
projects.each { |e|
|
23
|
+
puts " #{e}"
|
24
|
+
}
|
25
|
+
exit 1
|
15
26
|
end
|
16
|
-
|
27
|
+
|
28
|
+
dir= File.dirname(dir)
|
17
29
|
end
|
18
30
|
|
31
|
+
nil
|
19
32
|
end
|
20
33
|
|
21
34
|
|
data/coherent.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{coherent}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeff Watkins"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-05}
|
13
13
|
s.default_executable = %q{coherent}
|
14
14
|
s.description = %q{Tools for building Coherent application or modules.}
|
15
15
|
s.email = %q{jeff@metrocat.org}
|
@@ -94,7 +94,7 @@ Gem::Specification.new do |s|
|
|
94
94
|
s.homepage = %q{http://coherentjs.org}
|
95
95
|
s.rdoc_options = ["--charset=UTF-8"]
|
96
96
|
s.require_paths = ["lib"]
|
97
|
-
s.rubygems_version = %q{1.
|
97
|
+
s.rubygems_version = %q{1.4.2}
|
98
98
|
s.summary = %q{Tools for building Coherent application or modules.}
|
99
99
|
s.test_files = [
|
100
100
|
"test/helper.rb",
|
@@ -110,7 +110,6 @@ Gem::Specification.new do |s|
|
|
110
110
|
]
|
111
111
|
|
112
112
|
if s.respond_to? :specification_version then
|
113
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
114
113
|
s.specification_version = 3
|
115
114
|
|
116
115
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "#{File.dirname(__FILE__)}/../../lib/coherent"
|
2
|
+
require "yaml"
|
2
3
|
|
3
4
|
class ClassGenerator < CoherentBaseGenerator
|
4
5
|
|
@@ -12,9 +13,21 @@ class ClassGenerator < CoherentBaseGenerator
|
|
12
13
|
full_name= args.shift
|
13
14
|
parts= full_name.split(".")
|
14
15
|
|
15
|
-
|
16
|
+
|
16
17
|
@name= parts[-1]
|
17
18
|
@full_name= full_name
|
19
|
+
@namespace= parts[0..-2].join(".")
|
20
|
+
|
21
|
+
if @namespace.empty?
|
22
|
+
@target_folder = "src/js"
|
23
|
+
project = YAML::load_file(PROJECT_FILE)
|
24
|
+
if project["export"].is_a?(String)
|
25
|
+
@namespace = project["export"]
|
26
|
+
@full_name= [@namespace, @name].join(".")
|
27
|
+
end
|
28
|
+
else
|
29
|
+
@target_folder = "src/js/#{namespace.gsub(".", "/")}"
|
30
|
+
end
|
18
31
|
|
19
32
|
extract_options
|
20
33
|
end
|
@@ -22,7 +35,7 @@ class ClassGenerator < CoherentBaseGenerator
|
|
22
35
|
def manifest
|
23
36
|
record do |m|
|
24
37
|
|
25
|
-
copy_template_folder m,
|
38
|
+
copy_template_folder m, @target_folder
|
26
39
|
|
27
40
|
end
|
28
41
|
end
|
@@ -2,9 +2,12 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
/**
|
5
|
-
|
5
|
+
class <%=full_name%>
|
6
|
+
|
7
|
+
This is a good place to document your class.
|
6
8
|
*/
|
7
|
-
<%= namespace.empty? ? "var " : ""%><%=full_name%>= Class.create(coherent.KVO,
|
9
|
+
<%= namespace.empty? ? "var " : ""%><%=full_name%>= Class.create(coherent.KVO,
|
10
|
+
{
|
8
11
|
|
9
12
|
sampleProperty: function()
|
10
13
|
{
|
@@ -10,7 +10,10 @@ class NibGenerator < CoherentBaseGenerator
|
|
10
10
|
super
|
11
11
|
usage if args.empty?
|
12
12
|
@name = args.shift
|
13
|
-
|
13
|
+
if (@name.as_identifier != @name)
|
14
|
+
puts "Create NIB: name must be a valid identifier: #{@name} => #{@name.as_identifier}"
|
15
|
+
@name= @name.as_identifier
|
16
|
+
end
|
14
17
|
extract_options
|
15
18
|
end
|
16
19
|
|
@@ -2,16 +2,15 @@
|
|
2
2
|
|
3
3
|
NIB('<%=name%>', {
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
<%= name %> : VIEW({
|
6
|
+
':root': coherent.View({
|
7
|
+
// Set up necessary bindings and configuration information for your
|
8
|
+
// root view here.
|
9
|
+
})
|
10
|
+
}),
|
11
11
|
|
12
12
|
// Connect your views or controllers to the owning ViewController
|
13
|
-
|
14
|
-
{
|
13
|
+
owner: {
|
15
14
|
// Connect the main view for the ViewController, without this association
|
16
15
|
// the ViewController won't be able to display your view.
|
17
16
|
view: REF('<%=name%>')
|
data/lib/coherent.rb
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
require "active_support"
|
2
2
|
|
3
|
+
class String
|
4
|
+
def as_identifier
|
5
|
+
word= self.to_s.gsub(/(?:^|\W)(.)/) { $1.upcase }
|
6
|
+
# word[0..0].downcase + word[1..-1]
|
7
|
+
end
|
8
|
+
def starts_with?(prefix)
|
9
|
+
prefix = prefix.to_s
|
10
|
+
self[0, prefix.length] == prefix
|
11
|
+
end
|
12
|
+
def remove_indent
|
13
|
+
str= sub(/^\n*/, "")
|
14
|
+
match= str.match(/(^\s+)/)
|
15
|
+
return str unless match
|
16
|
+
str.gsub(/^#{match[1]}/, '').strip
|
17
|
+
end
|
18
|
+
def indent(str)
|
19
|
+
self.gsub(/^/, str)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
3
23
|
class CoherentBaseGenerator < RubiGen::Base
|
4
24
|
|
5
25
|
def copy_template_folder(m, path=nil)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coherent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 11
|
10
|
+
version: 0.6.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeff Watkins
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-05 00:00:00 -08:00
|
19
19
|
default_executable: coherent
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
requirements: []
|
172
172
|
|
173
173
|
rubyforge_project:
|
174
|
-
rubygems_version: 1.
|
174
|
+
rubygems_version: 1.4.2
|
175
175
|
signing_key:
|
176
176
|
specification_version: 3
|
177
177
|
summary: Tools for building Coherent application or modules.
|