pullentity-client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjA0OTg3ZDRmZTJiNmM3ZjlkNzdhYzEzNWYyMzNlMDk5ZjkyY2NmMw==
4
+ ZGYwZTYxZTY1Njg2MmZmZTQzMGUwZTY4ZjA4YzBmODQwODc5NjYwNw==
5
5
  data.tar.gz: !binary |-
6
- Mjg5MWFhYzZmY2JhMzM1NGY1MmRjNjhlMGM5YTA3ZWY0ZjVmMTE0Yw==
6
+ MTliOWQ1M2MxMDgxYTIxMTQxZmM3ZmJkYTg4ZjRhNmMwOGUwNTA0ZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NjQzNmE0MzE4ZGZmMzRkY2I0MjBjYzAxYWM5YjRkNmRlZmUzODA5MDMwM2Y0
10
- YWU2MTE2MjY4MjFlYzBkNzIzZTdkZTk3NjRlN2IzZTI5MTEwZWIzZDUyMjhk
11
- NTgxNzJiYjRkYzE2ZWUyNWY4NjY3NTM4Y2RjNTM1NDRlMjg1OTc=
9
+ MGE4ZTU3ZjhhNTRmZjg3ZjA4NWVjM2E4NTQ3ZGM2NWQ0N2RlZTg5MDk4YmVk
10
+ N2U5Y2MzNWEzYTI0ZDA3NzhjZDk2MjZlZjNhOWU0NjU2OTA1NGQxYTRiOTk2
11
+ YzFhNWRmZDcwMDNhYzdiNWQ2MGY2MjdhN2QzZmM5Y2MyMTZmN2M=
12
12
  data.tar.gz: !binary |-
13
- YzY2OTJjMGE5NmNkOGI3ZWVlNjU1NjZlZGFkMjAwMjZjNTU0MDZkYTBiMjdm
14
- YmFkYmE2NDAzOGU5NDc2ODlhZjJmMjczMmEzNTM0MDBjOWE1YjE3NjllYTFm
15
- OWZlZTIxMWZmNzAwZDhkZGQ4N2NiODllNjMzMTIyMjU1OWUyNDE=
13
+ NzRmNjBmYjIzNmYyZjAzZDlkMzhkYmJhZjBkZTRkNGUwNmQ1NDJkYmYwYTUx
14
+ YTk4YWMzZjUyODViZTQ3Zjc4MmUwYTY4MzdmYmM2ZDk1ZWY3NTBiMTlhYmE4
15
+ YmNiNDNkYjE4YjU1YTJkMTM5NmQyMjI1NjEyYmYzZTNmZjhkY2U=
@@ -10,7 +10,7 @@ module Pullentity
10
10
  no_tasks {
11
11
 
12
12
  def domain
13
- "http://pullentity.com"
13
+ #"http://pullentity.com"
14
14
  #"http://pullentity.dev:3000"
15
15
  end
16
16
 
@@ -177,7 +177,11 @@ module Pullentity
177
177
  File.open("#{location}/source/assets/javascripts/pullentity_data.json","w") do |f|
178
178
  f.write(@json_body.to_json)
179
179
  end
180
- say "data file imported at source/assets/javascripts/pullentity_data.json", :green if File.exists?("#{location}/data.json")
180
+ if @json_body["error"]
181
+ say @json_body, :red
182
+ else
183
+ say "data file imported at source/assets/javascripts/pullentity_data.json", :green if File.exists?("#{location}/source/assets/javascripts/pullentity_data.json")
184
+ end
181
185
  end
182
186
 
183
187
  def selector(arr)
@@ -45,7 +45,6 @@ module Pullentity
45
45
 
46
46
  FileUtils.cp_r(templates("app/."), location.join("source/") )
47
47
 
48
- create_with_template('source/assets/javascripts/test-data.js.coffee', 'defaults/test-data.js', full_app_hash)
49
48
  create_with_template('source/layout.haml', 'defaults/layout.haml', full_app_hash)
50
49
 
51
50
  end
@@ -25,7 +25,7 @@ module Pullentity::Client::Helpers
25
25
 
26
26
  def test_data_include_tag
27
27
  unless target?(:pullentity)
28
- javascript_include_tag "test-data"
28
+ javascript_include_tag "pullentity/development"
29
29
  end
30
30
  end
31
31
 
@@ -1,5 +1,5 @@
1
1
  module Pullentity
2
2
  module Client
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -35,8 +35,8 @@ module Pullentity
35
35
  module Client
36
36
  ROOT_PATH = Pathname(__FILE__).dirname.expand_path
37
37
 
38
- autoload :VERSION, 'pullentity-client/version.rb'
39
- autoload :CLI, 'pullentity-client/cli.rb'
38
+ autoload :VERSION, "pullentity-client/version.rb"
39
+ autoload :CLI, "pullentity-client/cli.rb"
40
40
  autoload :Logger, "pullentity-client/logger.rb"
41
41
  autoload :Utils, "pullentity-client/utils.rb"
42
42
 
@@ -45,12 +45,11 @@ module Pullentity
45
45
  autoload :Model, "pullentity-client/generate/model.rb"
46
46
  autoload :Exporter, "pullentity-client/generate/exporter.rb"
47
47
  autoload :Auth, "pullentity-client/generate/auth.rb"
48
- autoload :Theme, "pullentity-client/generate/theme.rb"
49
-
48
+ autoload :Theme, "pullentity-client/generate/theme.rb"
50
49
  end
51
50
 
52
51
  module Builder
53
- autoload :Middleman, 'pullentity-client/builder/middleman.rb'
52
+ autoload :Middleman, "pullentity-client/builder/middleman.rb"
54
53
  end
55
54
 
56
55
  def self.root
@@ -0,0 +1,217 @@
1
+ # Don't edit this file unless you know you are doing
2
+ # this file is for local testing only and will not be uploaded within theme to pullentity.com
3
+ #= require "underscore-min"
4
+ #= require "mustache"
5
+
6
+ $(document).ready ->
7
+ template = undefined
8
+ html = undefined
9
+ window.base_image_path = ""
10
+ window.theme = ""
11
+ window.list_theme = ""
12
+ window.mustache_themes = ""
13
+ window.data = {}
14
+ window.data =
15
+ site_link: "/"
16
+ public_url: "http://pullentity.com"
17
+ project: {}
18
+ photos: []
19
+ current_section: ""
20
+ url: ->
21
+ (text, render) ->
22
+ text = render(text)
23
+ url = text.trim().toLowerCase().split("tuts+")[0] + ".tutsplus.com"
24
+ "<a href=\"" + url + "\">" + text + "</a>"
25
+
26
+ $.getJSON( "/assets/javascripts/pullentity_data.json", (json_data) ->
27
+ ).success((json_data)->
28
+ items = []
29
+ #debugger
30
+ window.data["site"] =
31
+ name: json_data.name
32
+ subdomain: json_data.subdomain
33
+
34
+ window.data["sections"] = []
35
+
36
+ $.each json_data.sections, (key, val) ->
37
+ window.data["sections"].push val
38
+
39
+ window.data["projects"] = []
40
+ $.each json_data.projects, (key, val) ->
41
+ window.data["projects"].push val
42
+
43
+ window.init_themes()
44
+ )
45
+ .error(->
46
+ html = "<div style='margin:20px'><h1>data file not found<h1>"
47
+ html += "<pre>please run 'pullentity setup' in console to setup autentication and import data</pre>"
48
+ html += "<pre>or 'pullentity theme import_data' in console, if you already have authenticated your theme</pre></div>"
49
+ $("body").html(html)
50
+ )
51
+
52
+ # layout initialization
53
+ window.init_themes = ()->
54
+
55
+ window.theme = ""
56
+
57
+ window.data["project"] = {}
58
+
59
+ template = $("#layout").html()
60
+
61
+ window.mustache_themes = $(".pullentity-themes")
62
+
63
+ window.list_theme = $(".pullentity-themes#list")
64
+
65
+ layout = Mustache.to_html(template, data)
66
+
67
+ $("body").html layout
68
+
69
+ simple_router(window.location.hash)
70
+
71
+ $(window).on "hashchange", (e) ->
72
+ simple_router(window.location.hash)
73
+
74
+ window.simple_router = (url)->
75
+ # find section by window.location, then find project and theme
76
+ url = window.location.hash
77
+ #console.log "changed to #{url}"
78
+ m = switch
79
+ when url == "" then render_home_project()
80
+ when /(\w)\/\d/.test(url) then find_project_by_id()
81
+ when /(\w)/.test(url) then find_in_section()
82
+ else
83
+ console.warn("not matching url")
84
+
85
+ window.render_theme = (theme_html, data_hsh = window.data)->
86
+ if theme_html?
87
+ view = Mustache.to_html(theme_html, data_hsh)
88
+ $("#content").html view
89
+ else
90
+ html = "<div style='margin:20px'><h1>Theme \"#{window.data.project.theme_template.name}\" not found!<h1>"
91
+ html += "<pre>Please create it in /source/views/themes/#{window.data.project.theme_template.name}.haml</pre></div>"
92
+ $("body").html(html)
93
+
94
+ window.render_list_theme = (theme_html, data_hsh = window.data)->
95
+ if theme_html?
96
+ view = Mustache.to_html(theme_html, data_hsh)
97
+ $("#content").html view
98
+ else
99
+ html = "<div style='margin:20px'><h1>Theme \"#{window.data.current_section.theme_template.name}\" not found!<h1>"
100
+ html += "<pre>Please create it in /source/views/themes/#{window.data.current_section.theme_template.name}.haml</pre></div>"
101
+ $("body").html(html)
102
+
103
+
104
+ # get home project and render it
105
+ window.render_home_project = ()->
106
+
107
+ window.data["project"] = _.find(window.data.projects, (p) ->
108
+ p.home
109
+ )
110
+
111
+ fill_projects(window.data["project"].photos)
112
+
113
+ find_theme_for_project()
114
+
115
+ render_theme($(window.theme[0]).html())
116
+
117
+ # points path for remote image resources
118
+ window.remote_path = (path)->
119
+ "#{path}"
120
+
121
+
122
+ # builds the project photos hsh
123
+ window.fill_projects = (collection)->
124
+ window.data["photos"] = []
125
+ $.each collection, (key, val) ->
126
+ window.data["photos"].push
127
+ img_medium: remote_path( val.image.image.medium.url)
128
+ img_large: remote_path(val.image.image.xlarge.url)
129
+ img_thumb: remote_path(val.image.image.thumb.url)
130
+ title: val.title
131
+ caption: val.caption
132
+
133
+
134
+ # display project or list
135
+ window.display_project_or_list = (_tis)->
136
+
137
+ if _tis.list_or_project == "project"
138
+
139
+ #console.log("trying theme #{window.data["project"].theme_template.name}")
140
+
141
+ find_theme_for_project()
142
+
143
+ fill_projects(window.data["project"].photos)
144
+
145
+ render_theme($(window.theme[0]).html())
146
+
147
+ else
148
+ #console.log "should be list!!"
149
+ data_projects = data_projects_for_list()
150
+
151
+ if data_projects.section.theme_template?
152
+ #debugger
153
+ #theme = data_projects.section.theme_template.name
154
+ find_theme_for_list()
155
+ render_list_theme($(window.theme[0]).html(), data_projects)
156
+ else
157
+ render_theme($(window.list_theme).html(), data_projects)
158
+
159
+ false
160
+
161
+
162
+ # finds the theme for project
163
+ window.find_theme_for_project = ()->
164
+ window.theme = $($(_.find($(window.mustache_themes), (num) ->
165
+ $(num).attr("id") == window.data["project"].theme_template.name
166
+ )).html())
167
+
168
+ # finds the theme for list
169
+ window.find_theme_for_list = ()->
170
+ window.theme = $($(_.find($(window.mustache_themes), (num) ->
171
+ $(num).attr("id") == window.data["current_section"].theme_template.name
172
+ )).html())
173
+
174
+ # find data for project list
175
+ window.data_projects_for_list = ()->
176
+ section = _.find( window.data["sections"] , (num) ->
177
+ num.public_url == window.location.hash
178
+ )
179
+ window.data.current_section = section
180
+
181
+ a = _.filter(window.data["projects"], (num) ->
182
+ true if num.section.public_url is section.public_url
183
+ )
184
+
185
+ project_collection = _.map a, (p)->
186
+ p["project_photo"] = remote_path(p.photos[0].image.image.medium.url) unless p.photos.length == 0
187
+ p
188
+
189
+ {section: section, projects: project_collection }
190
+
191
+ # maps project for section
192
+ window.find_in_section = ()->
193
+
194
+ $.each window.data.sections, ()->
195
+
196
+ if this.public_url == window.location.hash
197
+ _tis = this
198
+ _tis.finds = false
199
+
200
+ window.data["project"] = _.find( window.data.projects , (p)->
201
+ p.section.public_url == _tis.public_url
202
+ )
203
+
204
+ if window.data["project"]?
205
+ display_project_or_list(_tis)
206
+ else
207
+ $("#content").html("<pre>Couldn´t find projects in #{_tis.public_url} yet</pre>")
208
+ console.warn "Couldn´t find projects in #{_tis.public_url} yet"
209
+
210
+ # find by id
211
+ window.find_project_by_id = ()->
212
+
213
+ window.data["project"] = _.where(window.data.projects, { project_path: window.location.hash })[0]
214
+
215
+ find_theme_for_project()
216
+ fill_projects(window.data["project"].photos)
217
+ render_theme($(window.theme[0]).html())
@@ -0,0 +1,3 @@
1
+
2
+
3
+ console.log("pullentity lib loaded");
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pullentity-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - miguel michelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-02 00:00:00.000000000 Z
11
+ date: 2013-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-script
@@ -273,8 +273,6 @@ files:
273
273
  - lib/pullentity-client/templates/app/assets/images/favicon.ico
274
274
  - lib/pullentity-client/templates/app/assets/images/ps_neutral.png
275
275
  - lib/pullentity-client/templates/app/assets/javascripts/application.js.erb
276
- - lib/pullentity-client/templates/app/assets/javascripts/mustache.js
277
- - lib/pullentity-client/templates/app/assets/javascripts/underscore-min.js
278
276
  - lib/pullentity-client/templates/app/assets/stylesheets/application.css.scss
279
277
  - lib/pullentity-client/templates/app/assets/stylesheets/customtheme.css.scss
280
278
  - lib/pullentity-client/templates/app/index.html.haml
@@ -317,8 +315,11 @@ files:
317
315
  - vendor/assets/fonts/fontawesome-webfont.woff
318
316
  - vendor/assets/images/.DS_Store
319
317
  - vendor/assets/images/pullentity/.DS_Store
320
- - vendor/assets/javascripts/pullentity.js
318
+ - vendor/assets/javascripts/mustache.js
319
+ - vendor/assets/javascripts/pullentity.js.erb
321
320
  - vendor/assets/javascripts/pullentity/.DS_Store
321
+ - vendor/assets/javascripts/pullentity/development.js.coffee
322
+ - vendor/assets/javascripts/underscore-min.js
322
323
  - vendor/assets/stylesheets/.DS_Store
323
324
  - vendor/assets/stylesheets/pullentity.css.scss.erb
324
325
  - vendor/assets/stylesheets/pullentity/themes/default.css.scss
File without changes