pullentity-client 0.0.6 → 0.0.7
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.
- checksums.yaml +8 -8
- data/CHANGELOG.md +4 -0
- data/README.md +4 -4
- data/lib/pullentity-client/cli.rb +6 -18
- data/lib/pullentity-client/generate/auth.rb +54 -8
- data/lib/pullentity-client/generate/project.rb +1 -1
- data/lib/pullentity-client/generate/theme.rb +55 -0
- data/lib/pullentity-client/templates/app/assets/javascripts/underscore-min.js +1 -0
- data/lib/pullentity-client/templates/app/index.html.haml +5 -8
- data/lib/pullentity-client/templates/app/views/shared/body.haml +3 -9
- data/lib/pullentity-client/templates/app/views/themes/home.haml +3 -3
- data/lib/pullentity-client/templates/defaults/layout.haml.erb +3 -0
- data/lib/pullentity-client/templates/defaults/test-data.js.erb +192 -87
- data/lib/pullentity-client/version.rb +1 -1
- data/lib/pullentity-client.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDRmZGU0YmM2ZTIzMjU5NDFkODE5Y2E4ZjQ1YmU0MjBjYTIxNDg5OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODExMGQ3YmFjYTIzNWMzYjBjZDFkY2Q1NTEyNTc1NDc1NzQzMDczNw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTllZjBmMjliZTA3ZTM0MGJiZTBhOGRmYzNmNjM1MGVmNjQ4ODA5MDgzZmUw
|
10
|
+
NDI1ZDQ1NDBmMzE1NzRhMGNlZDczNzE2YzRlMDgwODI4YzY1NjljNDMzM2Ez
|
11
|
+
MjQ0NDExOWU5NzU2YTNkZDQ5NWMyMWM5Mzg1NjI5Mzc0OTEwZWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTJmMzRlNTEzM2NjOWJmNWNiMzUwOTI5NTBmYzRlMjk4ZmY0NjBkOTE5NGVi
|
14
|
+
ZjQ3ODFjMDA5NmFhZDRjOWU1NzljODk4MzE1OWE2N2QxOWUxMGNlMDIwNjFj
|
15
|
+
MDk4ZjIyOTZjNGRkOTFmODA0N2ZiOGZlNDExYmNhZTdmOGJkYTQ=
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -54,11 +54,11 @@ Export and install the theme for your site.
|
|
54
54
|
4. Push to the branch (`git push origin my-new-feature`)
|
55
55
|
5. Create new Pull Request
|
56
56
|
|
57
|
-
# TODO
|
57
|
+
# TODO , path for 0.1.0
|
58
58
|
|
59
59
|
1. upload assets.
|
60
60
|
2. import data
|
61
|
-
3. setup task (login + select site)
|
62
|
-
4. make default task
|
63
|
-
5. load remote data
|
61
|
+
3. OK setup task (login + select site)
|
62
|
+
4. OK make default task
|
63
|
+
5. OK load remote data
|
64
64
|
6. use mustache server side
|
@@ -56,29 +56,17 @@ module Pullentity
|
|
56
56
|
::Pullentity::Client::Generate::Auth.start(['set_login', email])
|
57
57
|
end
|
58
58
|
|
59
|
-
map %(n) => '
|
60
|
-
desc "
|
61
|
-
long_desc "list sites, needs auth token , run pullentity login help"
|
62
|
-
def sites
|
63
|
-
::Pullentity::Client::Generate::Auth.start(['list_sites'])
|
64
|
-
end
|
65
|
-
|
66
|
-
map %(ex) => 'export'
|
67
|
-
desc "export", "exports a new Pullentity Client project."
|
68
|
-
long_desc "builds & exports site to theme"
|
69
|
-
def export
|
70
|
-
::Pullentity::Client::Generate::Exporter.start(['export'])
|
71
|
-
end
|
72
|
-
|
73
|
-
map %(n) => 'select'
|
74
|
-
desc "select site", "needs auth_token."
|
59
|
+
#map %(n) => 'select'
|
60
|
+
desc "setup <email>", "setup login and set site and import data."
|
75
61
|
long_desc "select site, needs auth token , run pullentity login help"
|
76
|
-
def
|
62
|
+
def setup(email)
|
63
|
+
::Pullentity::Client::Generate::Auth.start(['set_login', email])
|
77
64
|
::Pullentity::Client::Generate::Auth.start(['select_site'])
|
65
|
+
::Pullentity::Client::Generate::Theme.start(['import_data'])
|
78
66
|
end
|
79
67
|
|
80
68
|
register Pullentity::Client::Generate::Project, :project, "project", "project generator"
|
81
|
-
|
69
|
+
register Pullentity::Client::Generate::Theme, :theme, "theme", "Theme Manager"
|
82
70
|
|
83
71
|
end
|
84
72
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'session'
|
2
|
-
|
2
|
+
|
3
3
|
module Pullentity
|
4
4
|
module Client
|
5
5
|
module Generate
|
@@ -71,13 +71,13 @@ module Pullentity
|
|
71
71
|
File.open("#{location}/pullentity.yml", "w"){|f| YAML.dump(hsh, f)}
|
72
72
|
end
|
73
73
|
|
74
|
-
def site_api_call()
|
75
|
-
|
76
|
-
uri = URI.parse("#{domain}
|
74
|
+
def site_api_call(path)
|
75
|
+
#puts "#{domain}#{path}?auth_token=#{@token}"
|
76
|
+
uri = URI.parse("#{domain}#{path}?auth_token=#{@token}")
|
77
77
|
http = Net::HTTP.new(uri.host, uri.port)
|
78
78
|
request = Net::HTTP::Get.new(uri.request_uri)
|
79
|
-
response = http.request(request)
|
80
|
-
@json_body = JSON.parse(response.body)
|
79
|
+
@response = http.request(request)
|
80
|
+
@json_body = JSON.parse(@response.body)
|
81
81
|
end
|
82
82
|
|
83
83
|
def export_api_call()
|
@@ -96,8 +96,31 @@ module Pullentity
|
|
96
96
|
say "#{@json_body[:status]} #{@json_body[:message]}", :green
|
97
97
|
end
|
98
98
|
|
99
|
+
def get_site_activated_theme_data
|
100
|
+
check_for_yaml
|
101
|
+
site_api_call("/api/v1/sites/#{@site}.json")
|
102
|
+
end
|
103
|
+
|
104
|
+
def get_site_theme_data
|
105
|
+
check_for_yaml
|
106
|
+
site_api_call("/api/v1/sites/#{@site}/themes/#{@theme_name}.json")
|
107
|
+
end
|
108
|
+
|
109
|
+
def current_theme
|
110
|
+
check_for_yaml
|
111
|
+
site_api_call("/api/v1/sites/#{@site}")
|
112
|
+
say @json_body, :green
|
113
|
+
end
|
114
|
+
|
115
|
+
def make_default_for_site
|
116
|
+
check_for_yaml
|
117
|
+
site_api_call("/api/v1/sites/#{@site}/themes/#{@theme_name}/make_default.json")
|
118
|
+
say @json_body, :green
|
119
|
+
end
|
120
|
+
|
99
121
|
def prompt_for_site_select
|
100
|
-
|
122
|
+
check_for_yaml
|
123
|
+
site_api_call("/api/v1/sites.json")
|
101
124
|
count = 0
|
102
125
|
arr = {}
|
103
126
|
@json_body.each do |site|
|
@@ -108,6 +131,15 @@ module Pullentity
|
|
108
131
|
selector(arr)
|
109
132
|
end
|
110
133
|
|
134
|
+
def get_data
|
135
|
+
check_for_yaml
|
136
|
+
site_api_call("/api/v1/sites/#{@site}/data")
|
137
|
+
File.open("#{location}/source/assets/javascripts/pullentity_data.json","w") do |f|
|
138
|
+
f.write(@json_body.to_json)
|
139
|
+
end
|
140
|
+
say "data file imported at source/assets/javascripts/pullentity_data.json", :green if File.exists?("#{location}/data.json")
|
141
|
+
end
|
142
|
+
|
111
143
|
def selector(arr)
|
112
144
|
answer = ask "select the site", :yellow
|
113
145
|
if arr[answer.to_i]
|
@@ -121,7 +153,7 @@ module Pullentity
|
|
121
153
|
end
|
122
154
|
|
123
155
|
def get_sites
|
124
|
-
site_api_call
|
156
|
+
site_api_call("/api/v1/sites.json")
|
125
157
|
@json_body.each do |site|
|
126
158
|
say "Site ID: ##{site["id"]}", :white
|
127
159
|
say " Name: " + site["name"].to_s, :green
|
@@ -165,7 +197,21 @@ module Pullentity
|
|
165
197
|
export_api_call
|
166
198
|
end
|
167
199
|
|
200
|
+
desc "make default theme", ""
|
201
|
+
def make_default
|
202
|
+
say "set theme to default", :green
|
203
|
+
make_default_for_site
|
204
|
+
end
|
205
|
+
|
206
|
+
desc "show theme", ""
|
207
|
+
def show_theme
|
208
|
+
current_theme
|
209
|
+
end
|
168
210
|
|
211
|
+
desc "download theme", ""
|
212
|
+
def download_json_data
|
213
|
+
get_data
|
214
|
+
end
|
169
215
|
|
170
216
|
end
|
171
217
|
end
|
@@ -45,7 +45,7 @@ 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', 'defaults/test-data.js', full_app_hash)
|
48
|
+
create_with_template('source/assets/javascripts/test-data.js.coffee', 'defaults/test-data.js', full_app_hash)
|
49
49
|
create_with_template('source/layout.haml', 'defaults/layout.haml', full_app_hash)
|
50
50
|
|
51
51
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'session'
|
2
|
+
|
3
|
+
module Pullentity
|
4
|
+
module Client
|
5
|
+
module Generate
|
6
|
+
class Theme < Thor
|
7
|
+
|
8
|
+
include ::Pullentity::Client::Utils
|
9
|
+
|
10
|
+
#map %(n) => 'sites'
|
11
|
+
desc "sites", "list sites, needs auth_token."
|
12
|
+
long_desc "sites, needs auth token, run pullentity login help."
|
13
|
+
def sites
|
14
|
+
::Pullentity::Client::Generate::Auth.start(['list_sites'])
|
15
|
+
end
|
16
|
+
|
17
|
+
#map %(x) => 'export'
|
18
|
+
desc "export", "exports a new Pullentity Client project."
|
19
|
+
long_desc "builds & exports site to theme."
|
20
|
+
def export
|
21
|
+
::Pullentity::Client::Generate::Exporter.start(['export'])
|
22
|
+
end
|
23
|
+
|
24
|
+
#map %(n) => 'select'
|
25
|
+
desc "select_site", "needs auth_token."
|
26
|
+
long_desc "select_site, needs auth token , run pullentity login help."
|
27
|
+
def select_site
|
28
|
+
::Pullentity::Client::Generate::Auth.start(['select_site'])
|
29
|
+
end
|
30
|
+
|
31
|
+
#map %(n) => 'select'
|
32
|
+
desc "make_defalt", "needs auth_token."
|
33
|
+
long_desc "make default site"
|
34
|
+
def make_default
|
35
|
+
::Pullentity::Client::Generate::Exporter.start(['export'])
|
36
|
+
::Pullentity::Client::Generate::Auth.start(['make_default'])
|
37
|
+
end
|
38
|
+
|
39
|
+
#map %(n) => 'select'
|
40
|
+
desc "make_defalt", "needs auth_token."
|
41
|
+
long_desc "make default site"
|
42
|
+
def current
|
43
|
+
::Pullentity::Client::Generate::Auth.start(['show_theme'])
|
44
|
+
end
|
45
|
+
|
46
|
+
#map %(n) => 'select'
|
47
|
+
desc "import_data", "download site data"
|
48
|
+
def import_data
|
49
|
+
::Pullentity::Client::Generate::Auth.start(['download_json_data'])
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,d=e.filter,g=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.4";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e[e.length]=t.call(r,n,u,i)}),e)};var O="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},w.find=w.detect=function(n,t,r){var e;return E(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&(e[e.length]=n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:g&&n.every===g?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var E=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:E(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2),e=w.isFunction(t);return w.map(n,function(n){return(e?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t,r){return w.isEmpty(t)?r?null:[]:w[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.findWhere=function(n,t){return w.where(n,t,!0)},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var k=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=k(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index<t.index?-1:1}),"value")};var F=function(n,t,r,e){var u={},i=k(t||w.identity);return A(n,function(t,a){var o=i.call(r,t,a,n);e(u,o,t)}),u};w.groupBy=function(n,t,r){return F(n,t,r,function(n,t,r){(w.has(n,t)?n[t]:n[t]=[]).push(r)})},w.countBy=function(n,t,r){return F(n,t,r,function(n,t){w.has(n,t)||(n[t]=0),n[t]++})},w.sortedIndex=function(n,t,r,e){r=null==r?w.identity:k(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var R=function(n,t,r){return A(n,function(n){w.isArray(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return R(n,t,[])},w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(c.apply(e,arguments))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){for(var n=o.call(arguments),t=w.max(w.pluck(n,"length")),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i},w.bind=function(n,t){if(n.bind===j&&j)return j.apply(n,o.call(arguments,1));var r=o.call(arguments,2);return function(){return n.apply(t,r.concat(o.call(arguments)))}},w.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},w.bindAll=function(n){var t=o.call(arguments,1);return 0===t.length&&(t=w.functions(n)),A(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t){var r,e,u,i,a=0,o=function(){a=new Date,u=null,i=n.apply(r,e)};return function(){var c=new Date,l=t-(c-a);return r=this,e=arguments,0>=l?(clearTimeout(u),u=null,a=c,i=n.apply(r,e)):u||(u=setTimeout(o,l)),i}},w.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&(t[t.length]=r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)null==n[r]&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var I=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=I(n[a],t[a],r,e)););}else{var c=n.constructor,f=t.constructor;if(c!==f&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(f)&&f instanceof f))return!1;for(var s in n)if(w.has(n,s)&&(a++,!(o=w.has(t,s)&&I(n[s],t[s],r,e))))break;if(o){for(s in t)if(w.has(t,s)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return I(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=x||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),"function"!=typeof/./&&(w.isFunction=function(n){return"function"==typeof n}),w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return n===void 0},w.has=function(n,t){return f.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(n),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var M={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};M.unescape=w.invert(M.escape);var S={escape:RegExp("["+w.keys(M.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(M.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(S[n],function(t){return M[n][t]})}}),w.result=function(n,t){if(null==n)return null;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){A(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),D.call(this,r.apply(w,n))}})};var N=0;w.uniqueId=function(n){var t=++N+"";return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var T=/(.)^/,q={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){var e;r=w.defaults({},r,w.templateSettings);var u=RegExp([(r.escape||T).source,(r.interpolate||T).source,(r.evaluate||T).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(B,function(n){return"\\"+q[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,w);var c=function(n){return e.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},w.chain=function(n){return w(n).chain()};var D=function(n){return this._chain?w(n).chain():n};w.mixin(w),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],D.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);
|
@@ -1,15 +1,12 @@
|
|
1
1
|
|
2
|
-
|
3
2
|
= content_for :principal do
|
4
3
|
|
5
4
|
- theme_list = Dir.foreach(Dir.pwd + ("/source/views/themes") ).grep(/.haml/)
|
6
5
|
|
7
6
|
- theme_list.each do |o|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
%div{ id: "list", style: "display:none"}
|
13
|
-
= partial "views/list"
|
14
|
-
|
7
|
+
%script{ type: "template/text", id: "#{o.gsub(".haml", "")}", class: "pullentity-themes"}
|
8
|
+
%div{ id: "#{o.gsub(".haml", "")}", style: "display:none"}
|
9
|
+
= partial "views/themes/#{o.gsub(".haml", "")}"
|
15
10
|
|
11
|
+
%script{ type: "template/text", id: "list", class: "pullentity-themes"}
|
12
|
+
= partial "views/list"
|
@@ -3,7 +3,7 @@
|
|
3
3
|
.container-fluid
|
4
4
|
.page-header
|
5
5
|
%h1
|
6
|
-
%a.pjax{:href => "{{site_link}}"}
|
6
|
+
%a.pjax{:href => "{{site_link}}"} Welcome to {{site.name}} site
|
7
7
|
.row-fluid
|
8
8
|
%ul#menu
|
9
9
|
{{#sections}}
|
@@ -12,15 +12,9 @@
|
|
12
12
|
%a.pjax{:href => "{{public_url}}"} {{title}}
|
13
13
|
{{/show_in_menu}}
|
14
14
|
{{/sections}}
|
15
|
-
.row-fluid{"data-pjax-container" => ""}
|
15
|
+
#content.row-fluid{"data-pjax-container" => ""}
|
16
16
|
/ Don't remove this line
|
17
|
-
|
18
|
-
%pre Content should...
|
19
|
-
#yield-scripts
|
20
|
-
= yield_content(:principal)
|
21
|
-
{{{content}}}
|
22
|
-
|
23
|
-
|
17
|
+
{{{content}}}
|
24
18
|
|
25
19
|
{{{loader}}}
|
26
20
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
%h2 {{project.title}}
|
3
3
|
{{{project.body}}}
|
4
4
|
.span8
|
5
|
-
|
5
|
+
.myCarousel.carousel.slide{:style => "float:left"}
|
6
6
|
.carousel-inner
|
7
7
|
{{#photos}}
|
8
8
|
|
@@ -14,8 +14,8 @@
|
|
14
14
|
|
15
15
|
{{/photos}}
|
16
16
|
|
17
|
-
%a.left.carousel-control{"data-slide" => "prev", :href => "
|
17
|
+
%a.left.carousel-control{"data-slide" => "prev", :href => ".myCarousel"} ‹
|
18
18
|
|
19
|
-
%a.right.carousel-control{"data-slide" => "next", :href => "
|
19
|
+
%a.right.carousel-control{"data-slide" => "next", :href => ".myCarousel"} ›
|
20
20
|
|
21
21
|
{{{fb_comments}}}
|
@@ -1,87 +1,192 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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 = "http://pullentity.com"
|
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
|
+
url: ->
|
20
|
+
(text, render) ->
|
21
|
+
text = render(text)
|
22
|
+
url = text.trim().toLowerCase().split("tuts+")[0] + ".tutsplus.com"
|
23
|
+
"<a href=\"" + url + "\">" + text + "</a>"
|
24
|
+
|
25
|
+
$.getJSON( "/assets/javascripts/pullentity_data.json", (json_data) ->
|
26
|
+
).success((json_data)->
|
27
|
+
items = []
|
28
|
+
#debugger
|
29
|
+
window.data["site"] =
|
30
|
+
name: json_data.name
|
31
|
+
subdomain: json_data.subdomain
|
32
|
+
|
33
|
+
window.data["sections"] = []
|
34
|
+
|
35
|
+
$.each json_data.sections, (key, val) ->
|
36
|
+
window.data["sections"].push val
|
37
|
+
|
38
|
+
window.data["projects"] = []
|
39
|
+
$.each json_data.projects, (key, val) ->
|
40
|
+
window.data["projects"].push val
|
41
|
+
|
42
|
+
window.init_themes()
|
43
|
+
)
|
44
|
+
.error(->
|
45
|
+
html = "<div style='margin:20px'><h1>data file not found<h1>"
|
46
|
+
html += "<pre>please run 'pullentity setup' in console to setup autentication and import data</pre>"
|
47
|
+
html += "<pre>or 'pullentity theme import_data' in console, if you already have authenticated your theme</pre></div>"
|
48
|
+
$("body").html(html)
|
49
|
+
)
|
50
|
+
|
51
|
+
# layout initialization
|
52
|
+
window.init_themes = ()->
|
53
|
+
|
54
|
+
window.theme = ""
|
55
|
+
|
56
|
+
window.data["project"] = {}
|
57
|
+
|
58
|
+
template = $("#layout").html()
|
59
|
+
|
60
|
+
window.mustache_themes = $(".pullentity-themes")
|
61
|
+
|
62
|
+
window.list_theme = $(".pullentity-themes#list")
|
63
|
+
|
64
|
+
layout = Mustache.to_html(template, data)
|
65
|
+
|
66
|
+
$("body").html layout
|
67
|
+
|
68
|
+
simple_router(window.location.hash)
|
69
|
+
|
70
|
+
$(window).on "hashchange", (e) ->
|
71
|
+
simple_router(window.location.hash)
|
72
|
+
|
73
|
+
window.simple_router = (url)->
|
74
|
+
# find section by window.location, then find project and theme
|
75
|
+
url = window.location.hash
|
76
|
+
#console.log "changed to #{url}"
|
77
|
+
m = switch
|
78
|
+
when url == "" then render_home_project()
|
79
|
+
when /(\w)\/\d/.test(url) then find_project_by_id()
|
80
|
+
when /(\w)/.test(url) then find_in_section()
|
81
|
+
else
|
82
|
+
console.warn("not matching url")
|
83
|
+
|
84
|
+
window.render_theme = (theme_html)->
|
85
|
+
if theme_html?
|
86
|
+
view = Mustache.to_html(theme_html, window.data)
|
87
|
+
$("#content").html view
|
88
|
+
else
|
89
|
+
html = "<div style='margin:20px'><h1>Theme \"#{window.data.project.theme_template.name}\" not found!<h1>"
|
90
|
+
html += "<pre>Please create it in /source/views/themes/#{window.data.project.theme_template.name}.haml</pre></div>"
|
91
|
+
$("body").html(html)
|
92
|
+
|
93
|
+
|
94
|
+
# get home project and render it
|
95
|
+
window.render_home_project = ()->
|
96
|
+
|
97
|
+
window.data["project"] = _.find(window.data.projects, (p) ->
|
98
|
+
p.home
|
99
|
+
)
|
100
|
+
|
101
|
+
fill_projects(window.data["project"].photos)
|
102
|
+
|
103
|
+
find_theme_for_project()
|
104
|
+
|
105
|
+
render_theme($(window.theme[0]).html())
|
106
|
+
|
107
|
+
# points path for remote image resources
|
108
|
+
window.remote_path = (path)->
|
109
|
+
"#{window.base_image_path}/#{path}"
|
110
|
+
|
111
|
+
|
112
|
+
# builds the project photos hsh
|
113
|
+
window.fill_projects = (collection)->
|
114
|
+
window.data["photos"] = []
|
115
|
+
$.each collection, (key, val) ->
|
116
|
+
window.data["photos"].push
|
117
|
+
img_medium: remote_path( val.image.image.medium.url)
|
118
|
+
img_large: remote_path(val.image.image.large.url)
|
119
|
+
img_thumb: remote_path(val.image.image.thumb.url)
|
120
|
+
title: val.title
|
121
|
+
caption: val.caption
|
122
|
+
|
123
|
+
|
124
|
+
# display project or list
|
125
|
+
window.display_project_or_list = (_tis)->
|
126
|
+
|
127
|
+
if _tis.list_or_project == "project"
|
128
|
+
|
129
|
+
#console.log("trying theme #{window.data["project"].theme_template.name}")
|
130
|
+
|
131
|
+
find_theme_for_project()
|
132
|
+
|
133
|
+
fill_projects(window.data["project"].photos)
|
134
|
+
|
135
|
+
render_theme($(window.theme[0]).html())
|
136
|
+
|
137
|
+
else
|
138
|
+
#console.log "should be list!!"
|
139
|
+
data_projects = data_projects_for_list()
|
140
|
+
render_theme($(window.list_theme).html())
|
141
|
+
|
142
|
+
false
|
143
|
+
|
144
|
+
|
145
|
+
# finds the theme for project
|
146
|
+
window.find_theme_for_project = ()->
|
147
|
+
window.theme = $($(_.find($(window.mustache_themes), (num) ->
|
148
|
+
$(num).attr("id") == window.data["project"].theme_template.name
|
149
|
+
)).html())
|
150
|
+
|
151
|
+
# find data for project list
|
152
|
+
window.data_projects_for_list = ()->
|
153
|
+
section = _.find( window.data["sections"] , (num) ->
|
154
|
+
num.public_url == window.location.hash
|
155
|
+
)
|
156
|
+
|
157
|
+
a = _.filter(window.data["projects"], (num) ->
|
158
|
+
true if num.section.public_url is section.public_url
|
159
|
+
)
|
160
|
+
project_collection = _.map a, (p)->
|
161
|
+
p["project_photo"] = remote_path(p.photos[0].image.image.medium.url) unless p.photos.length == 0
|
162
|
+
p
|
163
|
+
|
164
|
+
{section: section, projects: project_collection }
|
165
|
+
|
166
|
+
# maps project for section
|
167
|
+
window.find_in_section = ()->
|
168
|
+
|
169
|
+
$.each window.data.sections, ()->
|
170
|
+
|
171
|
+
if this.public_url == window.location.hash
|
172
|
+
_tis = this
|
173
|
+
_tis.finds = false
|
174
|
+
|
175
|
+
window.data["project"] = _.find( window.data.projects , (p)->
|
176
|
+
p.section.public_url == _tis.public_url
|
177
|
+
)
|
178
|
+
|
179
|
+
if window.data["project"]?
|
180
|
+
display_project_or_list(_tis)
|
181
|
+
else
|
182
|
+
$("#content").html("<pre>Couldn´t find projects in #{_tis.public_url} yet</pre>")
|
183
|
+
console.warn "Couldn´t find projects in #{_tis.public_url} yet"
|
184
|
+
|
185
|
+
# find by id
|
186
|
+
window.find_project_by_id = ()->
|
187
|
+
|
188
|
+
window.data["project"] = _.where(window.data.projects, { project_path: window.location.hash })[0]
|
189
|
+
|
190
|
+
find_theme_for_project()
|
191
|
+
fill_projects(window.data["project"].photos)
|
192
|
+
render_theme($(window.theme[0]).html())
|
data/lib/pullentity-client.rb
CHANGED
@@ -45,6 +45,7 @@ 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"
|
48
49
|
|
49
50
|
end
|
50
51
|
|
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.0.
|
4
|
+
version: 0.0.7
|
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-03-
|
11
|
+
date: 2013-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-script
|
@@ -244,6 +244,7 @@ files:
|
|
244
244
|
- lib/pullentity-client/generate/auth.rb
|
245
245
|
- lib/pullentity-client/generate/exporter.rb
|
246
246
|
- lib/pullentity-client/generate/project.rb
|
247
|
+
- lib/pullentity-client/generate/theme.rb
|
247
248
|
- lib/pullentity-client/generate/view.rb
|
248
249
|
- lib/pullentity-client/helpers.rb
|
249
250
|
- lib/pullentity-client/logger.rb
|
@@ -258,6 +259,7 @@ files:
|
|
258
259
|
- lib/pullentity-client/templates/app/assets/images/favicon.ico
|
259
260
|
- lib/pullentity-client/templates/app/assets/javascripts/application.js.erb
|
260
261
|
- lib/pullentity-client/templates/app/assets/javascripts/mustache.js
|
262
|
+
- lib/pullentity-client/templates/app/assets/javascripts/underscore-min.js
|
261
263
|
- lib/pullentity-client/templates/app/assets/stylesheets/application.css.scss
|
262
264
|
- lib/pullentity-client/templates/app/assets/stylesheets/customtheme.css.scss
|
263
265
|
- lib/pullentity-client/templates/app/index.html.haml
|