pullentity-client 0.0.7 → 0.0.8

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
- MDRmZGU0YmM2ZTIzMjU5NDFkODE5Y2E4ZjQ1YmU0MjBjYTIxNDg5OA==
4
+ MTZlZjFlMWFiMzUxM2VkYjVkNWU3MmZiNGJmMDk3NmRjNDVmNjM0ZA==
5
5
  data.tar.gz: !binary |-
6
- ODExMGQ3YmFjYTIzNWMzYjBjZDFkY2Q1NTEyNTc1NDc1NzQzMDczNw==
6
+ YmVhN2NjYzBlZDRjZDU4OGE5MDFmY2E2OGQwMTI0NzZlZTJjMDg0Yg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTllZjBmMjliZTA3ZTM0MGJiZTBhOGRmYzNmNjM1MGVmNjQ4ODA5MDgzZmUw
10
- NDI1ZDQ1NDBmMzE1NzRhMGNlZDczNzE2YzRlMDgwODI4YzY1NjljNDMzM2Ez
11
- MjQ0NDExOWU5NzU2YTNkZDQ5NWMyMWM5Mzg1NjI5Mzc0OTEwZWU=
9
+ ZDVhMWY2OTBmMWY5OTJjNDhmZmFhMjZjYjJkY2E1MzM5NjgyOGI1MGQ5YTQ4
10
+ MzYzNDMzN2FmZjI1ZmI0YTQ2NzNkNmZjMWVkYWM4MTA1ODIzMTg0ZmMyMWVh
11
+ NDA4NzFhMWY5M2JjODMxOGNjNjgxZDQzNTkzYjEyNTNiOGU5YzM=
12
12
  data.tar.gz: !binary |-
13
- OTJmMzRlNTEzM2NjOWJmNWNiMzUwOTI5NTBmYzRlMjk4ZmY0NjBkOTE5NGVi
14
- ZjQ3ODFjMDA5NmFhZDRjOWU1NzljODk4MzE1OWE2N2QxOWUxMGNlMDIwNjFj
15
- MDk4ZjIyOTZjNGRkOTFmODA0N2ZiOGZlNDExYmNhZTdmOGJkYTQ=
13
+ YWE5ZGEyMjM2MGFkMmRlNWNkZmY2MzE1ZDRhMWE2N2EwZjBhNzc3MDJjYWQx
14
+ NzFiOGRjN2NlMjA5YzUxN2YyYjA0YTJlOWMxNWM1MzQ5MGY4MzVkMDU1NDQ5
15
+ ODUwYTM4ZTYxOGI4NmI4YzQxYWIzOGMyMWIyNzc4ODM1MDhiMGM=
data/README.md CHANGED
@@ -28,10 +28,14 @@ Run project
28
28
 
29
29
  pullentity s # or pullentity server
30
30
 
31
- since its a middleman app you can
31
+ since it's a middleman app you can
32
32
 
33
33
  middleman s or middleman server
34
34
 
35
+ Setup (login, site selection & import data)
36
+
37
+ pullentity setup
38
+
35
39
  Setup your credentials
36
40
 
37
41
  pullentity login your@email.com
@@ -5,7 +5,7 @@ module Pullentity::Client
5
5
  include ::Pullentity::Client::Utils
6
6
 
7
7
  def build
8
- system "middleman build --verbose"
8
+ system "export MIDDLEMAN_BUILD_TARGET=remote_theme; middleman build --verbose"
9
9
  end
10
10
 
11
11
  end
@@ -94,8 +94,40 @@ module Pullentity
94
94
  response = conn.put("/api/v1/import_theme?auth_token=#{@token}&subdomain=#{@site}&theme_name=#{@theme_name}", payload )
95
95
  @json_body = JSON.parse(response.body)
96
96
  say "#{@json_body[:status]} #{@json_body[:message]}", :green
97
+ asw = ask "upload assets too ?", :yellow
98
+ if asw == "yes"
99
+ upload_assets()
100
+ else
101
+ say "skipping assets upload", :green
102
+ end
97
103
  end
98
104
 
105
+ def upload_assets()
106
+ conn = Faraday.new(:url => domain) do |f|
107
+ f.request :multipart
108
+ f.request :url_encoded # form-encode POST params
109
+ #f.response :logger # log requests to STDOUT
110
+ f.adapter Faraday.default_adapter # make requests with Net::HTTP
111
+ end
112
+
113
+ say "upload application.js...", :green
114
+ payload = { :file => Faraday::UploadIO.new("#{location}/build/assets/javascripts/application.js", 'text/json') }
115
+ response = conn.put("/api/v1/upload_assets?auth_token=#{@token}&subdomain=#{@site}&theme_name=#{@theme_name}", payload )
116
+
117
+ say JSON.parse(response.body)
118
+
119
+ say "upload application.css...", :green
120
+ payload = { :file => Faraday::UploadIO.new("#{location}/build/assets/stylesheets/application.css", 'text/json') }
121
+ response = conn.put("/api/v1/upload_assets?auth_token=#{@token}&subdomain=#{@site}&theme_name=#{@theme_name}", payload )
122
+
123
+ say JSON.parse(response.body)
124
+ end
125
+
126
+ def images
127
+ Dir.glob("#{location}/build/assets/images/**/*")
128
+ end
129
+
130
+
99
131
  def get_site_activated_theme_data
100
132
  check_for_yaml
101
133
  site_api_call("/api/v1/sites/#{@site}.json")
@@ -1,146 +1,52 @@
1
1
  require "middleman"
2
+ require 'middleman-target'
2
3
 
3
4
  module Pullentity::Client::Helpers
4
5
 
5
- #TODO separate elements in specific classes:
6
- # views, asides, articles, header, tabbar, toolbar etc...
7
-
8
- def footer(opts={}, &block)
9
- content_tag :footer , opts do
10
- capture(&block)
11
- end
12
- end
13
-
14
- def article(opts={}, &block)
15
- content_tag :article , opts do
16
- capture(&block)
17
- end
18
- end
19
-
20
- def section(opts={}, &block)
21
- content_tag :section , opts do
22
- capture(&block)
23
- end
24
- end
25
-
26
- def header(opts={}, &block)
27
- content_tag :header , opts do
28
- capture(&block)
29
- end
30
- end
31
-
32
- def hgroup(opts={}, &block)
33
- if block_given?
34
- content_tag :hgroup, options do
35
- capture(&block)
36
- end
37
- else
38
- content_tag :hgroup do
39
- content_tag( :h1 , opts[:title]).concat(
40
- content_tag( :h2 , opts[:subtitle])
41
- )
42
- end
43
- end
44
- end
45
-
46
- def list_view(opts={}, &block)
47
- options = {:class=>opts[:class]}.merge({"data-type" => "listview"})
48
- content_tag :ul, options do
49
- capture(&block)
50
- end
51
- end
52
-
53
- def list_item(opts={}, &block)
54
- options = {:class=>opts[:class]}
55
- options = options.merge({ :class=> "#{options[:class]} list-divider"}) if opts[:divider] == true
56
- arrow = content_tag :div , :class=>"aside" do
57
- content_tag( :i, "",{:class=>"icon-chevron-#{opts[:arrow]}"})
58
- end if opts[:arrow].present?
59
-
60
- if block_given?
61
- content_tag :li, options do
62
- capture(&block) << (arrow || "")
63
- end
6
+ def javascript_include_tag(file)
7
+ if target?(:pullentity)
8
+ path = "/uploads/theme_asset/#{site_name}/theme/#{theme_name}/assets/#{file}"
9
+ "<script src='#{path}.js' type='text/javascript'></script>"
64
10
  else
65
- content_tag :li, options do
66
- content_tag :h1 do
67
- opts[:content]
68
- end
69
- end
11
+ super
70
12
  end
71
13
  end
72
14
 
73
- def divider(opts={}, &block)
74
- if block_given?
75
- list_item({:divider=>true}.merge(opts)) do
76
- capture(&block)
77
- end
15
+ def stylesheet_link_tag(file)
16
+ if target?(:pullentity)
17
+ path = "/uploads/theme_asset/#{site_name}/theme/#{theme_name}/assets/#{file}"
18
+ "<link href='#{path}.css' media='screen' rel='stylesheet' type='text/css' />"
78
19
  else
79
- list_item({:divider=>true}.merge(opts))
20
+ super
80
21
  end
81
22
  end
82
23
 
83
- def nav(opts={}, &block)
84
- if block_given?
85
- content_tag(:nav, opts) do
86
- capture(&block)
87
- end
88
- else
24
+ def test_data_include_tag
25
+ unless target?(:pullentity)
26
+ javascript_include_tag "test-data"
89
27
  end
28
+ end
29
+ def site_name
30
+ hsh = YAML.load_file(location + "pullentity.yml")
31
+ hsh["site"]
90
32
  end
91
33
 
92
- def tabbar(opts={}, &block)
93
- opts = opts.merge({"data-type" => "tabbar"})
94
- nav(opts, &block)
34
+ def theme_name
35
+ hsh = YAML.load_file(location + "pullentity.yml")
36
+ hsh["theme_name"]
95
37
  end
96
38
 
97
- def toolbar(opts={}, &block)
98
- opts = opts.merge({"data-type" => "toolbar"})
99
- if opts[:control]
100
- auto = opts[:auto] ? "autoWidth" : ""
101
- nav(opts.reject!{ |k| k == :control || k == :auto }) do
102
- content_tag(:div, :class=>"control-group #{auto}") do
103
- capture(&block)
104
- end
105
- end
106
- else
107
- nav(opts, &block)
108
- end
39
+ def location
40
+ @location ||= Pathname.new(Dir.pwd)
109
41
  end
110
42
 
111
- def icon(type, opts={}, &block)
112
- if block_given?
113
- capture(&block) <<
114
- content_tag( :i, "",{:class=>"icon-#{type}"})
43
+ def asset_pathxxxx(file)
44
+ if target?(:pullentity)
45
+ 'yea'
115
46
  else
116
- name = opts[:text].present? ? content_tag( :span, opts[:text]) : ""
117
- name <<
118
- content_tag( :i, "",{:class=>"icon-#{type}"})
47
+ super
119
48
  end
120
49
  end
121
50
 
122
- def dialog(opts, &block)
123
- options = {:role => "dialog", :data=>{:type=>opts[:type] || "modal", :transition=>opts[:transition] || "slideup"}}
124
- opts = opts.merge(options)
125
- if block_given?
126
- content_tag(:div, opts) do
127
- capture(&block)
128
- end
129
- else
130
- end
131
- end
132
-
133
- def render_tabbar(tabbar)
134
- partial("views/tabbars/#{tabbar}")
135
- end
136
-
137
- def render_dialog(dialog)
138
- partial("views/dialogs/#{dialog}")
139
- end
140
-
141
- def render_toolbar(tabbar)
142
- partial("views/toolbars/#{tabbar}")
143
- end
144
-
145
51
 
146
52
  end
@@ -12,8 +12,9 @@
12
12
  %script{:src => "https://raw.github.com/brandonaaron/livequery/master/jquery.livequery.js"}
13
13
 
14
14
  = javascript_include_tag "application"
15
+ = stylesheet_link_tag "application"
15
16
 
16
- = javascript_include_tag "test-data"
17
+ = test_data_include_tag
17
18
 
18
19
  = yield_content(:application_js)
19
20
 
@@ -24,7 +24,7 @@
24
24
  });
25
25
  });
26
26
 
27
- $('#myCarousel')
27
+ $('.myCarousel')
28
28
  .livequery(function(){
29
29
  $(this).find(".item").first().addClass('active');
30
30
  $(this).carousel();
@@ -21,3 +21,12 @@ configure :build do
21
21
  activate :minify_javascript
22
22
  activate :relative_assets
23
23
  end
24
+
25
+ activate :target do |target|
26
+
27
+ target.build_targets = {
28
+ "pullentity" => {
29
+ :includes => %w[remote_theme]
30
+ }
31
+ }
32
+ end
@@ -81,9 +81,9 @@ $(document).ready ->
81
81
  else
82
82
  console.warn("not matching url")
83
83
 
84
- window.render_theme = (theme_html)->
84
+ window.render_theme = (theme_html, data_hsh = window.data)->
85
85
  if theme_html?
86
- view = Mustache.to_html(theme_html, window.data)
86
+ view = Mustache.to_html(theme_html, data_hsh)
87
87
  $("#content").html view
88
88
  else
89
89
  html = "<div style='margin:20px'><h1>Theme \"#{window.data.project.theme_template.name}\" not found!<h1>"
@@ -115,7 +115,7 @@ $(document).ready ->
115
115
  $.each collection, (key, val) ->
116
116
  window.data["photos"].push
117
117
  img_medium: remote_path( val.image.image.medium.url)
118
- img_large: remote_path(val.image.image.large.url)
118
+ img_large: remote_path(val.image.image.xlarge.url)
119
119
  img_thumb: remote_path(val.image.image.thumb.url)
120
120
  title: val.title
121
121
  caption: val.caption
@@ -137,7 +137,7 @@ $(document).ready ->
137
137
  else
138
138
  #console.log "should be list!!"
139
139
  data_projects = data_projects_for_list()
140
- render_theme($(window.list_theme).html())
140
+ render_theme($(window.list_theme).html(), data_projects)
141
141
 
142
142
  false
143
143
 
@@ -157,6 +157,7 @@ $(document).ready ->
157
157
  a = _.filter(window.data["projects"], (num) ->
158
158
  true if num.section.public_url is section.public_url
159
159
  )
160
+
160
161
  project_collection = _.map a, (p)->
161
162
  p["project_photo"] = remote_path(p.photos[0].image.image.medium.url) unless p.photos.length == 0
162
163
  p
@@ -1,5 +1,5 @@
1
1
  module Pullentity
2
2
  module Client
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
@@ -29,6 +29,7 @@ Gem::Specification.new do |gem|
29
29
  gem.add_runtime_dependency(%q<compass>, ["~> 0.12.2"])
30
30
  gem.add_runtime_dependency(%q<session>, ["~> 3.1"])
31
31
  gem.add_runtime_dependency(%q<middleman>, ["3.0.12"])
32
+ gem.add_runtime_dependency("middleman-target")
32
33
  gem.add_runtime_dependency(%q<faraday>)
33
34
  gem.add_runtime_dependency("json")
34
35
 
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.7
4
+ version: 0.0.8
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-29 00:00:00.000000000 Z
11
+ date: 2013-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-script
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - '='
151
151
  - !ruby/object:Gem::Version
152
152
  version: 3.0.12
153
+ - !ruby/object:Gem::Dependency
154
+ name: middleman-target
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: faraday
155
169
  requirement: !ruby/object:Gem::Requirement