luca 0.9.89 → 0.9.91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/CHANGELOG +11 -1
  2. data/Gemfile +5 -2
  3. data/Gemfile.lock +84 -56
  4. data/Rakefile +10 -2
  5. data/app/assets/javascripts/luca/components/application.coffee +82 -89
  6. data/app/assets/javascripts/luca/components/collection_view.coffee +9 -5
  7. data/app/assets/javascripts/luca/components/controller.coffee +72 -11
  8. data/app/assets/javascripts/luca/components/fields/base.coffee +61 -8
  9. data/app/assets/javascripts/luca/components/fields/button_field.coffee +53 -7
  10. data/app/assets/javascripts/luca/components/fields/checkbox_array.coffee +12 -7
  11. data/app/assets/javascripts/luca/components/fields/text_field.coffee +1 -1
  12. data/app/assets/javascripts/luca/components/form_view.coffee +2 -2
  13. data/app/assets/javascripts/luca/components/grid_layout_view.coffee +0 -1
  14. data/app/assets/javascripts/luca/components/page.coffee +1 -0
  15. data/app/assets/javascripts/luca/components/table_view.coffee +2 -2
  16. data/app/assets/javascripts/luca/concerns/dom_helpers.coffee +2 -2
  17. data/app/assets/javascripts/luca/containers/card_view.coffee +84 -54
  18. data/app/assets/javascripts/luca/containers/container.coffee +126 -46
  19. data/app/assets/javascripts/luca/containers/modal_view.coffee +9 -9
  20. data/app/assets/javascripts/luca/containers/page_controller.coffee +25 -0
  21. data/app/assets/javascripts/luca/containers/panel_toolbar.coffee +1 -1
  22. data/app/assets/javascripts/luca/containers/viewport.coffee +2 -5
  23. data/app/assets/javascripts/luca/core/collection.coffee +18 -4
  24. data/app/assets/javascripts/luca/core/model.coffee +1 -1
  25. data/app/assets/javascripts/luca/core/panel.coffee +1 -1
  26. data/app/assets/javascripts/luca/core/view.coffee +26 -7
  27. data/app/assets/javascripts/luca/development/code_sync_manager.coffee +51 -4
  28. data/app/assets/javascripts/luca/development/console.coffee +1 -1
  29. data/app/assets/javascripts/luca/framework.coffee +1 -1
  30. data/app/assets/javascripts/luca/index.coffee +1 -0
  31. data/app/assets/javascripts/luca/util/luca.coffee +2 -1
  32. data/app/assets/stylesheets/luca/components/viewport.scss +0 -4
  33. data/bin/luca +14 -0
  34. data/docs/framework.json +1 -1
  35. data/docs/luca-framework-documentation.js +1 -0
  36. data/lib/luca/cli/generate.rb +37 -0
  37. data/lib/luca/cli/server.rb +20 -0
  38. data/lib/luca/cli/sync.rb +40 -0
  39. data/lib/luca/cli/watch.rb +16 -0
  40. data/lib/luca/cli.rb +68 -0
  41. data/lib/luca/collection/endpoint.rb +1 -0
  42. data/lib/luca/component_definition.rb +23 -5
  43. data/lib/luca/luca_application.rb +18 -7
  44. data/lib/luca/rails/version.rb +1 -1
  45. data/lib/luca/server.rb +7 -0
  46. data/lib/luca/stylesheet.rb +2 -3
  47. data/lib/luca/version.rb +3 -0
  48. data/lib/luca/watcher.rb +72 -0
  49. data/lib/luca.rb +8 -1
  50. data/luca.gemspec +14 -7
  51. data/site/.bundle/config +2 -0
  52. data/site/.gitignore +5 -0
  53. data/site/.rvmrc +1 -0
  54. data/site/CHANGELOG.md +41 -0
  55. data/site/DOCS.md +41 -0
  56. data/site/Gemfile +8 -0
  57. data/site/Gemfile.lock +134 -0
  58. data/site/LICENSE.md +19 -0
  59. data/site/config.rb +84 -0
  60. data/site/helpers/site_helpers.rb +20 -0
  61. data/site/html5bp-docs/README.md +38 -0
  62. data/site/html5bp-docs/contribute.md +104 -0
  63. data/site/html5bp-docs/crossdomain.md +21 -0
  64. data/site/html5bp-docs/css.md +135 -0
  65. data/site/html5bp-docs/extend.md +507 -0
  66. data/site/html5bp-docs/faq.md +77 -0
  67. data/site/html5bp-docs/htaccess.md +323 -0
  68. data/site/html5bp-docs/html.md +170 -0
  69. data/site/html5bp-docs/js.md +31 -0
  70. data/site/html5bp-docs/misc.md +25 -0
  71. data/site/html5bp-docs/usage.md +109 -0
  72. data/site/readme.md +47 -0
  73. data/site/source/.htaccess +540 -0
  74. data/site/source/404.html +157 -0
  75. data/site/source/app/assets/javascripts/dependencies.js.coffee +6 -0
  76. data/site/source/app/assets/javascripts/docs/application.coffee +64 -0
  77. data/site/source/app/assets/javascripts/docs/collections/docs_documentation.coffee +17 -0
  78. data/site/source/app/assets/javascripts/docs/collections/github_repositories.coffee +7 -0
  79. data/site/source/app/assets/javascripts/docs/collections/index.coffee +1 -0
  80. data/site/source/app/assets/javascripts/docs/collections/luca_documentation.coffee +17 -0
  81. data/site/source/app/assets/javascripts/docs/collections/public_gists.coffee +4 -0
  82. data/site/source/app/assets/javascripts/docs/config.coffee +5 -0
  83. data/site/source/app/assets/javascripts/docs/index.coffee +12 -0
  84. data/site/source/app/assets/javascripts/docs/lib/router.coffee +3 -0
  85. data/site/source/app/assets/javascripts/docs/lib/util.coffee +0 -0
  86. data/site/source/app/assets/javascripts/docs/models/component.coffee +99 -0
  87. data/site/source/app/assets/javascripts/docs/models/github_repository.coffee +3 -0
  88. data/site/source/app/assets/javascripts/docs/models/index.coffee +1 -0
  89. data/site/source/app/assets/javascripts/docs/templates/component_documentation.jst.ejs +55 -0
  90. data/site/source/app/assets/javascripts/docs/templates/examples_browser/overview.jst.ejs +4 -0
  91. data/site/source/app/assets/javascripts/docs/templates/examples_browser/selector.jst.ejs +11 -0
  92. data/site/source/app/assets/javascripts/docs/templates/github_repository.jst.ejs +4 -0
  93. data/site/source/app/assets/javascripts/docs/templates/layouts/main.jst.ejs +4 -0
  94. data/site/source/app/assets/javascripts/docs/templates/left_navigation.jst.ejs +5 -0
  95. data/site/source/app/assets/javascripts/docs/templates/pages/getting_started.jst.ejs +78 -0
  96. data/site/source/app/assets/javascripts/docs/templates/pages/home.jst.ejs +57 -0
  97. data/site/source/app/assets/javascripts/docs/views/components/code_editor/index.coffee +0 -0
  98. data/site/source/app/assets/javascripts/docs/views/components/code_editor.coffee +45 -0
  99. data/site/source/app/assets/javascripts/docs/views/components/component_documentation.coffee +72 -0
  100. data/site/source/app/assets/javascripts/docs/views/index.coffee +3 -0
  101. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/details.coffee +37 -0
  102. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/list.coffee +31 -0
  103. data/site/source/app/assets/javascripts/docs/views/pages/browse_source.coffee +46 -0
  104. data/site/source/app/assets/javascripts/docs/views/pages/component_editor.coffee +10 -0
  105. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/docs.coffee +12 -0
  106. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/source.coffee +13 -0
  107. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser.coffee +102 -0
  108. data/site/source/app/assets/javascripts/docs/views/pages/home.coffee +10 -0
  109. data/site/source/app/assets/javascripts/docs/views/views/api_browser/index.coffee +43 -0
  110. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/grid_layout_view_example.coffee +14 -0
  111. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/table_view_example.coffee +39 -0
  112. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/basic_example.coffee +38 -0
  113. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/complex_layout.coffee +110 -0
  114. data/site/source/app/assets/javascripts/docs/views/views/top_navigation.coffee +6 -0
  115. data/site/source/app/assets/javascripts/docs-docs.js +1 -0
  116. data/site/source/app/assets/javascripts/luca-docs.js +1 -0
  117. data/site/source/app/assets/javascripts/luca-framework-documentation.js +1 -0
  118. data/site/source/app/assets/javascripts/site.js.coffee +4 -0
  119. data/site/source/app/assets/javascripts/vendor/codemirror.js +4786 -0
  120. data/site/source/app/assets/javascripts/vendor/coffeescript.js +346 -0
  121. data/site/source/app/assets/javascripts/vendor/css.js +465 -0
  122. data/site/source/app/assets/javascripts/vendor/htmlmixed.js +84 -0
  123. data/site/source/app/assets/javascripts/vendor/javascript.js +422 -0
  124. data/site/source/app/assets/javascripts/vendor/js-beautify.js +1353 -0
  125. data/site/source/app/assets/javascripts/vendor/modernizr-2.6.1.min.js +4 -0
  126. data/site/source/app/assets/javascripts/vendor/vim.js +2511 -0
  127. data/site/source/app/assets/stylesheets/docs/api-browser.css.scss +5 -0
  128. data/site/source/app/assets/stylesheets/docs/application.css.scss +35 -0
  129. data/site/source/app/assets/stylesheets/docs/browse-source.css.scss +5 -0
  130. data/site/source/app/assets/stylesheets/docs/scrollable-table.css.scss +5 -0
  131. data/site/source/app/assets/stylesheets/site.css.scss +2 -0
  132. data/site/source/app/assets/stylesheets/vendor/codemirror.css +240 -0
  133. data/site/source/app/assets/stylesheets/vendor/prettify-tomorrow-night-bright.css +160 -0
  134. data/site/source/app/assets/stylesheets/vendor/twilight.css +26 -0
  135. data/site/source/crossdomain.xml +15 -0
  136. data/site/source/documentation.html.haml +1 -0
  137. data/site/source/favicon_base.png +0 -0
  138. data/site/source/humans.txt +15 -0
  139. data/site/source/images/background.png +0 -0
  140. data/site/source/images/middleman.png +0 -0
  141. data/site/source/index.html.haml +1 -0
  142. data/site/source/layouts/layout.haml +55 -0
  143. data/site/source/readme.md +63 -0
  144. data/site/source/robots.txt +3 -0
  145. data/spec/javascripts/components/collection_view_spec.coffee +1 -1
  146. data/spec/javascripts/containers/card_view_spec.coffee +58 -5
  147. data/spec/javascripts/core/collection_spec.coffee +1 -1
  148. data/spec/javascripts/core/view_spec.coffee +2 -2
  149. data/vendor/assets/javascripts/backbone-min.js +37 -33
  150. data/vendor/assets/javascripts/backbone-query.min.js +1 -1
  151. data/vendor/assets/javascripts/jquery.js +5 -4
  152. data/vendor/assets/javascripts/luca-dependencies.min.js +8 -6
  153. data/vendor/assets/javascripts/luca-development.min.js +1 -1
  154. data/vendor/assets/javascripts/luca.full.min.js +12 -10
  155. data/vendor/assets/javascripts/luca.min.js +5 -5
  156. data/vendor/assets/javascripts/underscore-min.js +1 -5
  157. data/vendor/assets/javascripts/underscore-string.min.js +1 -1
  158. data/vendor/assets/stylesheets/luca-components.css +0 -2
  159. data/vendor/assets/stylesheets/luca-development.css +1 -1
  160. metadata +215 -39
  161. data/app/assets/javascripts/luca/components/page_controller.coffee +0 -3
  162. data/app/assets/javascripts/luca/core/collection_view.coffee +0 -150
  163. data/site/assets/bootstrap.min.js +0 -7
  164. data/site/assets/dependencies.js +0 -94
  165. data/site/assets/glyphicons-halflings-white.png +0 -0
  166. data/site/assets/glyphicons-halflings.png +0 -0
  167. data/site/assets/luca-ui-bootstrap.css +0 -1331
  168. data/site/assets/luca-ui-bootstrap.js +0 -9
  169. data/site/assets/luca-ui-development-tools.css +0 -234
  170. data/site/assets/luca-ui-development-tools.js +0 -18561
  171. data/site/assets/luca-ui-development-tools.min.js +0 -15
  172. data/site/assets/luca-ui-full.min.js +0 -8
  173. data/site/assets/luca-ui.min.js +0 -4
  174. data/site/assets/sandbox.css +0 -62
  175. data/site/assets/sandbox.js +0 -469
  176. data/site/docs/application.html +0 -41
  177. data/site/docs/caching.html +0 -43
  178. data/site/docs/collection.html +0 -75
  179. data/site/docs/collection_manager.html +0 -71
  180. data/site/docs/containers.html +0 -118
  181. data/site/docs/events.html +0 -153
  182. data/site/docs/view.html +0 -128
  183. data/site/img/glyphicons-halflings-white.png +0 -0
  184. data/site/img/glyphicons-halflings.png +0 -0
  185. data/site/index.html +0 -20
  186. data/site/source-map.js +0 -1
@@ -0,0 +1,37 @@
1
+ module Luca
2
+ module Cli
3
+ class Generate < Thor
4
+ namespace :generate
5
+
6
+ desc "generate", "generate GENERATOR [options]"
7
+
8
+ method_options :name => :string
9
+ method_option :assets_root, :default => File.join(Dir.pwd(),"app","assets")
10
+ method_option :root, :default => Dir.pwd()
11
+ method_option :export_location, :default => Dir.pwd()
12
+
13
+ def generate generator
14
+ if generator == "docs"
15
+ documentation(options[:name], options)
16
+ end
17
+
18
+ if generator == "application"
19
+ application(options[:name], options)
20
+ end
21
+ end
22
+
23
+ no_tasks do
24
+ def application application_name, options={}
25
+
26
+ end
27
+
28
+ def documentation application_name, options={}
29
+ app = Luca::LucaApplication.new(application_name, options)
30
+ puts "Exporting application documentation for #{ application_name } to #{ app.export_file_location }..."
31
+ puts "Found #{ app.component_definitions.length } component definitions"
32
+ app.export
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,20 @@
1
+ module Luca
2
+ module Cli
3
+ class Server < Thor
4
+ namespace :server
5
+
6
+ desc "server", "server APPLICATION_NAME [options]"
7
+
8
+ method_options :namespace => :string
9
+ method_option :port, :default => 9292
10
+ method_option :timeout, :default => 25
11
+ method_option :channel, :default => "faye"
12
+
13
+ def server namespace
14
+ process = Luca::Server.new(:mount=>"/#{ options[:channel] }",:timeout=>options[:timeout])
15
+ process.listen(options[:port])
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,40 @@
1
+ module Luca
2
+ module Cli
3
+ class Sync < Thor
4
+ namespace :sync
5
+
6
+ method_options :namespace => :string
7
+ method_option :port, :default => 9292
8
+ method_option :timeout, :default => 25
9
+ method_option :channel, :default => "faye"
10
+ method_option :root, :default => Dir.pwd()
11
+
12
+ desc "sync", "sync APPLICATION_NAME [options]"
13
+ def sync application_name
14
+ fork do
15
+ watch(application_name)
16
+ end
17
+
18
+ fork do
19
+ server(application_name)
20
+ end
21
+
22
+ Process.waitpid
23
+ end
24
+
25
+ no_tasks do
26
+ def watch application_name
27
+ puts "Watching application assets for changes..."
28
+ watcher = Luca::Watcher.new(application_name, options)
29
+ watcher.start
30
+ end
31
+
32
+ def server application_name
33
+ puts "Running code sync faye process on channel #{ options[:channel] } port #{ options[:port] }"
34
+ process = Luca::Server.new(:mount=>"/#{ options[:channel] }",:timeout=>options[:timeout])
35
+ process.listen(options[:port])
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,16 @@
1
+ module Luca
2
+ module Cli
3
+ class Watch < Thor
4
+ namespace :watch
5
+
6
+ desc "watch", "watch APPLICATION_NAME [options]"
7
+ method_options :name => :string
8
+ method_option :root, :default => Dir.pwd()
9
+
10
+ def watch application_name
11
+ watcher = Luca::Watcher.new(application_name, options)
12
+ watcher.start
13
+ end
14
+ end
15
+ end
16
+ end
data/lib/luca/cli.rb ADDED
@@ -0,0 +1,68 @@
1
+ require 'thor'
2
+ require "thor/group"
3
+ require "pry"
4
+
5
+ module Luca
6
+ module Cli
7
+ class Base < Thor
8
+ class << self
9
+ def start(*args)
10
+ # Change flag to a module
11
+ ARGV.unshift("help") if ARGV.delete("--help")
12
+
13
+ # Default command is help
14
+ if ARGV[0] != "help" && (ARGV.length < 1 || ARGV.first.include?("-"))
15
+ ARGV.unshift("server")
16
+ end
17
+
18
+ super
19
+ end
20
+ end
21
+
22
+ desc "version", "Show version"
23
+ def version
24
+ require 'luca/version'
25
+ say "Luca #{Luca::Version}"
26
+ end
27
+
28
+ def help(meth = nil, subcommand = false)
29
+ if meth && !self.respond_to?(meth)
30
+ klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}")
31
+ klass.start(["-h", task].compact, :shell => self.shell)
32
+ else
33
+ list = []
34
+ Thor::Util.thor_classes_in(Luca::Cli).each do |klass|
35
+ list += klass.printable_tasks(false)
36
+ end
37
+ list.sort!{ |a,b| a[0] <=> b[0] }
38
+
39
+ shell.say "Tasks:"
40
+ shell.print_table(list, :ident => 2, :truncate => true)
41
+ shell.say
42
+ end
43
+ end
44
+
45
+ def method_missing(meth, *args)
46
+ meth = meth.to_s
47
+
48
+ if self.class.map.has_key?(meth)
49
+ meth = self.class.map[meth]
50
+ end
51
+
52
+ klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}")
53
+
54
+ if klass.nil?
55
+ super
56
+ else
57
+ args.unshift(task) if task
58
+ klass.start(args, :shell => self.shell)
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ require "luca/cli/generate"
66
+ require "luca/cli/watch"
67
+ require "luca/cli/server"
68
+ require "luca/cli/sync"
@@ -1,3 +1,4 @@
1
+ require 'sinatra/base'
1
2
  module Luca
2
3
  class Collection
3
4
  class Endpoint < Sinatra::Base
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'redcarpet'
3
+ require 'active_support/core_ext'
3
4
 
4
5
  module Luca
5
6
  class ComponentDefinition
@@ -7,6 +8,16 @@ module Luca
7
8
 
8
9
  ARGUMENTS_REGEX = /^\w+\:\s*\((.+)\)/
9
10
 
11
+ class << self
12
+ attr_accessor :markdown
13
+ end
14
+
15
+ begin
16
+ self.markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)
17
+ rescue Exception => e
18
+
19
+ end
20
+
10
21
  def initialize source
11
22
  @source = source
12
23
  read_source()
@@ -31,7 +42,8 @@ module Luca
31
42
  base = {
32
43
  source: source,
33
44
  defined_in_file: source,
34
- type: "javascript"
45
+ type: "javascript",
46
+ starts_on_line: definition_line && definition_line.line_number
35
47
  }
36
48
 
37
49
  unless class_name.nil?
@@ -74,12 +86,18 @@ module Luca
74
86
  memo[property] = {
75
87
  defined_on_line: definition_line.line_number,
76
88
  documentation: documentation_for(property),
77
- default: ''
89
+ default: default_value_for(property)
78
90
  }
79
91
  memo
80
92
  end
81
93
  end
82
94
 
95
+ def default_value_for property
96
+ definition = find_definition_of(property).line.strip
97
+ property, value = definition.split(':')
98
+ value && value.strip
99
+ end
100
+
83
101
  def argument_information_for method
84
102
  information = []
85
103
  definition = find_definition_of(method).line.strip
@@ -204,8 +222,8 @@ module Luca
204
222
  def header_comments compile=true
205
223
  combined = header_comment_lines.join("")
206
224
 
207
- if compile
208
- compiled = Redcarpet.new(combined).to_html rescue combined
225
+ if compile && self.class.markdown && self.class.markdown.respond_to?(:render)
226
+ self.class.markdown.render(combined)
209
227
  else
210
228
  combined
211
229
  end
@@ -304,7 +322,7 @@ module Luca
304
322
  end
305
323
 
306
324
  def defines_property?
307
- !comment? && !defines_method? && indentation_level == 1 && line.match(/\s*\w+\:.*\w/)
325
+ !comment? && !defines_method? && indentation_level == 1 && line.match(/\s*\w+\:.*\w*/)
308
326
  end
309
327
 
310
328
  def body?
@@ -1,10 +1,12 @@
1
+ require 'rubygems'
2
+ require 'redcarpet'
3
+ require 'active_support/core_ext'
4
+
1
5
  module Luca
2
6
  class LucaApplication
3
7
  attr_accessor :application_name,
4
8
  :options
5
9
 
6
-
7
-
8
10
  # Public: creates an instance of a luca application repository.
9
11
  # generally this will be a single folder inside of your asset pipeline
10
12
  #
@@ -18,18 +20,21 @@ module Luca
18
20
  def export
19
21
  contents = export_all_component_definitions.to_json
20
22
  File.open(export_file_location, 'w+') do |fh|
23
+ contents = "window.#{ namespace } = window.#{ namespace } || {}; window.#{ namespace }.documentation = #{ contents };"
21
24
  fh.puts( contents )
22
25
  end
23
26
  contents
24
27
  end
25
28
 
26
29
  def export_file_location
27
- File.join(Luca.base_path,"docs","framework.json")
30
+ loc = options[:export_location] || File.join(Luca.base_path,"site","source", "javascripts")
31
+
32
+ File.join(loc, "#{ application_name.downcase }-docs.js")
28
33
  end
29
34
 
30
35
  def export_all_component_definitions
31
36
  list = component_definitions.map do |cdef|
32
- cdef.as_json rescue nil
37
+ cdef.as_json(include_contents:true) rescue nil
33
38
  end
34
39
  list.compact
35
40
  end
@@ -78,7 +83,7 @@ module Luca
78
83
  end
79
84
 
80
85
  def namespace
81
- return options[:application_name] if options[:appliction_name]
86
+ return options[:application_name].capitalize if options[:application_name]
82
87
 
83
88
  line = initializer_file_contents.lines.to_a.detect do |l|
84
89
  l.match(/Luca.initialize/)
@@ -137,6 +142,10 @@ module Luca
137
142
  end
138
143
  end
139
144
 
145
+ def assets_root
146
+ options[:assets_root] || File.join(project_root,"app","assets")
147
+ end
148
+
140
149
  protected
141
150
  def template_extensions
142
151
  options[:template_extensions] || ['jst.ejs.haml','mustache']
@@ -232,13 +241,15 @@ module Luca
232
241
  end
233
242
 
234
243
  def stylesheets_root
235
- options[:stylesheets_root] || File.join(project_root, "app", "assets", "stylesheets")
244
+ options[:stylesheets_root] || File.join(assets_root,"stylesheets")
236
245
  end
237
246
 
238
247
  def javascripts_root
239
- options[:javascripts_root] || File.join(project_root, "app", "assets", "javascripts")
248
+ options[:javascripts_root] || File.join(assets_root,"javascripts")
240
249
  end
241
250
 
251
+
252
+
242
253
  def project_root
243
254
  options[:root] || (::Rails.root rescue Dir.pwd())
244
255
  end
@@ -1,5 +1,5 @@
1
1
  module Luca
2
2
  module Rails
3
- VERSION = '0.9.89'
3
+ VERSION = Luca::Version
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'faye'
3
+
4
+ module Luca
5
+ class Server < Faye::RackAdapter
6
+ end
7
+ end
@@ -27,9 +27,8 @@ module Luca
27
27
  compiled: compiled,
28
28
  source_file_contents: IO.read(source),
29
29
  name: File.basename(source),
30
- # temp
31
- path: source.gsub(::Rails.root.to_s, '.'),
32
- id: source.gsub(::Rails.root.to_s, '.').gsub('/','__')
30
+ path: source,
31
+ id: source.gsub('/','__')
33
32
  }
34
33
  end
35
34
  end
@@ -0,0 +1,3 @@
1
+ module Luca
2
+ Version = '0.9.91'
3
+ end
@@ -0,0 +1,72 @@
1
+ module Luca
2
+ class Watcher
3
+ attr_reader :app,
4
+ :listener,
5
+ :notifier
6
+
7
+ def initialize(name, options={})
8
+ @app = Luca::LucaApplication.new(name, options)
9
+ @notifier = FayeNotifier.new(options[:url] || "//localhost:9292/faye")
10
+ @listener = Listen.to(app.assets_root)
11
+ .filter(options[:filter] || /(\.coffee|\.css|\.jst|\.mustache)/)
12
+ .latency(options[:latency] || 1)
13
+ .change do |modified, added, removed|
14
+ notify(modified, added, removed)
15
+ end
16
+ end
17
+
18
+ def notify modified, added, removed
19
+ puts "Detected changes in #{ (modified + added).inspect }"
20
+ begin
21
+ payload = change_payload_for(modified + added)
22
+ notifier.publish("/luca-code-sync", payload)
23
+ rescue e
24
+ puts "Error publishing payload: #{ $! }"
25
+ end
26
+ end
27
+
28
+ def change_payload_for paths
29
+ paths.inject({}) do |memo, path|
30
+ file = path.gsub( app.assets_root, '')
31
+ if file && asset = app.find_asset_wrapper_for(file)
32
+ memo[path] = asset.to_change_notification
33
+ end
34
+
35
+ memo
36
+ end
37
+ end
38
+
39
+ def start
40
+ puts "Looking for changes in #{ app.application_name }: #{ app.assets_root }"
41
+ @listener.start
42
+ end
43
+ end
44
+
45
+
46
+ class Watcher::FayeNotifier
47
+ attr_reader :client, :url
48
+
49
+ def initialize url
50
+ @url = url
51
+ end
52
+
53
+ def client
54
+ @client ||= ::Faye::Client.new(url)
55
+ end
56
+
57
+ def shutdown
58
+ EM.stop
59
+ end
60
+
61
+ def publish channel, message
62
+ EM.run do
63
+ client = ::Faye::Client.new(url)
64
+ pub = client.publish( channel, message )
65
+ pub.callback { EM.stop }
66
+ pub.errback { EM.stop }
67
+ end
68
+ end
69
+
70
+ end
71
+
72
+ end
data/lib/luca.rb CHANGED
@@ -5,13 +5,20 @@ module Luca
5
5
  end
6
6
  end
7
7
 
8
- require 'luca/rails'
8
+ require 'luca/version'
9
+
10
+ if defined?(::Rails)
11
+ require 'luca/rails'
12
+ end
13
+
9
14
  require 'luca/collection'
10
15
  require 'luca/asset_compiler'
11
16
  require 'luca/compiled_asset'
12
17
  require 'luca/component_definition'
13
18
  require 'luca/luca_application'
14
19
  require 'luca/project'
20
+ require 'luca/watcher'
21
+ require 'luca/server'
15
22
  require 'luca/project_harness'
16
23
  require 'luca/stylesheet'
17
24
  require 'luca/template_asset'
data/luca.gemspec CHANGED
@@ -1,28 +1,35 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/luca/rails/version', __FILE__)
2
+ require File.expand_path('../lib/luca/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "luca"
6
- s.version = Luca::Rails::VERSION
6
+ s.version = Luca::Version
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Jonathan Soeder"]
9
9
  s.email = ["jonathan.soeder@gmail.com"]
10
10
  s.homepage = "http://datapimp.github.com/luca"
11
- s.summary = "A Backbone.JS Component Framework"
12
- s.description = "This gem allows you to use the luca-ui backbone.js component framework easily with the assets pipeline"
11
+ s.summary = "Component framework based on backbone.js and twitter boostrap"
12
+ s.description = "This gem allows you to use the luca framework easily with the assets pipeline in rails"
13
13
 
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
 
16
- s.add_dependency "railties", "~> 3.1"
16
+ s.add_dependency "railties", ">= 3.1"
17
17
  s.add_dependency "thor", "~> 0.14"
18
18
  s.add_dependency "sinatra", ">= 0.9.2"
19
19
  s.add_dependency "ejs"
20
20
  s.add_dependency "hogan_assets"
21
+ s.add_dependency "redcarpet", "~> 2.2.2"
22
+ s.add_dependency "activesupport", ">= 3.2.12"
23
+ s.add_dependency "sprockets", ">= 2.4.5"
24
+ s.add_dependency "listen", ">= 0.7.3"
25
+ s.add_dependency "faye", ">= 0.8.8"
26
+ s.add_dependency "thin"
27
+
21
28
  s.add_development_dependency "bundler", "~> 1.0.0"
22
- s.add_development_dependency "rails", "~> 3.1"
29
+ s.add_development_dependency "rails", ">= 3.2"
23
30
 
24
31
  s.files = `git ls-files`.split("\n")
25
- s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
32
+ s.executable = "luca"
26
33
  s.require_paths = ['lib']
27
34
  end
28
35
 
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_WITHOUT: development:test
data/site/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.DS_Store
2
+ *.scssc
3
+ sass-cache/
4
+
5
+ build/
data/site/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3-p194
data/site/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ ## 3.0.9 (September 24, 2012)
4
+
5
+ * Update to Middleman 3.0.5 (fixes 3.0.4 Livereload bug)
6
+
7
+ ## 3.0.8 (September 22, 2012)
8
+
9
+ * Update to Middleman 3.0.4
10
+ * Default .rvmrc updated to Ruby 1.9.3-p194
11
+
12
+ ## 3.0.7 (September 11, 2012)
13
+
14
+ * Update to Middleman 3.0.2
15
+
16
+ ## 3.0.6 (September 2, 2012)
17
+
18
+ * Content is parsed with Markdown (using Redcarpet) by default
19
+
20
+ ## 3.0.5 (September 2, 2012)
21
+
22
+ * Smart site and page titles/descriptions through /helpers/site_helpers.rb
23
+ * Better documentation
24
+
25
+ ## 3.0.4 (September 2, 2012)
26
+
27
+ * [SMACSS](http://smacss.com/) stylesheet organization
28
+
29
+ ## 3.0.3 (September 2, 2012)
30
+
31
+ * Added .htaccess for Apache builds
32
+
33
+ ## 3.0.2 (September 2, 2012)
34
+
35
+ * Updated to HTML5 Boilerplate 4.0
36
+ * Updated to Susy 1.0
37
+ * Activate middleman-favicon-maker by default
38
+
39
+ ## 3.0.1 and below
40
+
41
+ See commit log
data/site/DOCS.md ADDED
@@ -0,0 +1,41 @@
1
+ # Middleman / HTML5 Boilerplate Notes
2
+
3
+ Please note that this port of the HTML5 Boilerplate has been converted to use HAML and Sprockets, while using a Middleman 3.x workflow.
4
+
5
+ [The original HTML5 Boilerplate documentation](https://github.com/dannyprose/Middleman-HTML5BP-HAML/tree/master/html5bp-docs) is included at /html5bp-docs/ for your reference, but certain things (e.g. ways of including, specific javascript and CSS paths) may be different in our implementation.
6
+
7
+ ## Recommendations
8
+
9
+ * Update `.rvmrc` to the [gemset](https://rvm.io/gemsets/basics/) of your choosing (or remove it if you do not use [RVM](https://rvm.io/))
10
+ * Double check `.gitignore` and make sure it is what you want.
11
+ * eg: `build/` is ignored by default.
12
+ * If you don't use `middleman init` to load the template, make sure to [use and run Bundler](http://gembundler.com/).
13
+
14
+ ## Site and Individual Page Titles and Descriptions
15
+
16
+ One change we have made from the Boilerplate is some smarter ways of handling site/page titles and descriptions.
17
+
18
+ Titles and descriptions are handled 2 ways:
19
+
20
+ For the site at large, the title & description is handled through `/helpers/site_helpers.rb`. You can set them there, and the default layout file will include them on every page.
21
+
22
+ For individual pages, just add some YAML data to the top of any given page (see our default index for an example):
23
+
24
+ ```yaml
25
+ ---
26
+ title:
27
+ description:
28
+ ---
29
+ ```
30
+
31
+ ### Changing the Site Title and Description
32
+
33
+ To the change site's title and description, edit the values in `/helpers/site_helpers.rb`. You can also edit the formatting for individual page title and descriptions here.
34
+
35
+ To change, individual page's titles and descriptions, see the YAML method above.
36
+
37
+ ### But I Don't Want This
38
+
39
+ No problem - we only included it because we just thought this was a good, DRY use case for Middelman, and it is what the Middleman Docs site uses.
40
+
41
+ If you want to develop a method of your own, just remove the `page_title` and `page_description` methods in `/helpers/site_helpers.rb`, remove their references in `/layouts/layout.haml` (all within `<head>`), and restart Middleman. Then do whatever you want to include titles and headers.
data/site/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "middleman", "~>3.0.5"
4
+ gem "middleman-favicon-maker"
5
+ gem "middleman-livereload"
6
+ gem "susy", "~>1.0.5"
7
+ gem "redcarpet"
8
+ gem 'ejs'