themebox 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: be28dd6547e8430c3db7bc708c0e95a71c2a1e9a
4
- data.tar.gz: 97cd3b01bb03e1fa4ee42603a4fdf853716c484b
5
- SHA512:
6
- metadata.gz: 120371ed02cf3c34227d79206c016833da18da4c0ac5f6de73f9fdd0b633fa3b4580b5ce8d635b12010cd16dfa52bfb06f478c63add3b3bf4113e601f5ed5de1
7
- data.tar.gz: 74a0be216b0dfd7383f2901930ed15503151ecf59ce96556a9217f93e3a642c6a4167646558adca832398f37add438694c42b721a8504a329dccf0c2b50cbd6b
1
+ ---
2
+ SHA1:
3
+ data.tar.gz: 951149ef21ac4a01cbd4b71494a1c781e24999e3
4
+ metadata.gz: 4768cc8171f6e5e16d0c6def1776d70f912079eb
5
+ SHA512:
6
+ data.tar.gz: aefa49b4509c8186f7306f78b01b53faa73b2d194e29b78d8e8b019db3b62793deee7f9010d5c5674a337faa43ce3c0977abe1793e69ca1162efda9a523f40a7
7
+ metadata.gz: e0fc47aaf310bdac5be365f22e52454367861246ee54f35c9f5a2c473af02207d5087e4cd4f55f2c0c2f089591fe31233b278b02dd5762663503b94712290196
data/lib/themebox/cli.rb CHANGED
@@ -1,26 +1,36 @@
1
+ require 'rubygems'
1
2
  require 'thor'
2
3
  require 'restclient'
3
4
  require 'listen'
4
- require_relative 'client'
5
+ require 'themebox/client'
5
6
 
6
7
  class Themebox::Cli < Thor
7
8
  desc "watch", "Start watching for changes to themes"
8
9
  def watch
9
10
  token = File.read(File.expand_path("~/.themebox")).strip
10
11
  themebox = ::Themebox::Client.new(token)
11
-
12
12
  basepath = Pathname.new( File.expand_path('.') )
13
+
14
+ relative_path_from = Proc.new do |absolute_path|
15
+ Pathname.new(absolute_path).relative_path_from(basepath).to_s
16
+ end
17
+
13
18
  puts "Listening to #{basepath}"
14
- Listen.to!('.') do |modified, added, removed|
15
- changed = modified + added + removed
16
19
 
17
- changed.each do |absolute_path|
18
- relative_path = Pathname.new(absolute_path).relative_path_from(basepath).to_s
19
- template_path = relative_path[/(.*)\.html\.liquid/, 1]
20
+ listener = Listen.to('.', force_polling: true) do |modified, added, removed|
21
+ changed = modified + added
20
22
 
23
+ changed.each do |absolute_path|
21
24
  file = File.new(absolute_path)
22
- themebox.upload_template(template_path, file)
25
+ themebox.upload_file(relative_path_from.call(absolute_path), file)
26
+ end
27
+
28
+ removed.each do |absolute_path|
29
+ themebox.delete_file(relative_path_from.call(absolute_path))
23
30
  end
24
31
  end
32
+
33
+ listener.start
34
+ sleep
25
35
  end
26
36
  end
@@ -3,12 +3,21 @@ class Themebox::Client
3
3
  @token = token
4
4
  end
5
5
 
6
- def upload_template(template_path, file)
7
- upload_path = "http://tablefillr.dev/themes/#{template_path}"
6
+ def upload_file(path, file)
7
+ upload_path = "http://tablefillr.dev/themes/#{path.sub(/\.liquid$/, '')}"
8
8
 
9
- puts "putting #{upload_path}"
10
- RestClient.put upload_path, :body => file,
11
- :token => @token,
12
- :content_type => "application/x-www-form-urlencoded"
9
+ puts "Uploading #{path}"
10
+ RestClient.put resource_path(path), :content => file,
11
+ :token => @token,
12
+ :content_type => "application/x-www-form-urlencoded"
13
+ end
14
+
15
+ def delete_file(path)
16
+ puts "Deleting #{path}"
17
+ RestClient.delete resource_path(path)
18
+ end
19
+
20
+ def resource_path(path)
21
+ "http://tablefillr.dev/themes/#{path.sub(/\.liquid$/, '')}"
13
22
  end
14
23
  end
@@ -1,3 +1,3 @@
1
1
  module Themebox
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/themebox.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_runtime_dependency "listen", '1.3'
23
+ spec.add_runtime_dependency "listen"
24
24
  spec.add_runtime_dependency "thor"
25
25
  spec.add_runtime_dependency "rest-client"
26
26
  end
metadata CHANGED
@@ -1,93 +1,71 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: themebox
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - opsb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-14 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
11
+
12
+ date: 2013-10-19 00:00:00 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '1.3'
20
- type: :development
21
16
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
17
+ requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirements:
24
19
  - - ~>
25
- - !ruby/object:Gem::Version
26
- version: '1.3'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
20
+ - !ruby/object:Gem::Version
21
+ version: "1.3"
34
22
  type: :development
23
+ version_requirements: *id001
24
+ - !ruby/object:Gem::Dependency
25
+ name: rake
35
26
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
27
+ requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - &id003
30
+ - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id002
35
+ - !ruby/object:Gem::Dependency
42
36
  name: listen
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: '1.3'
48
- type: :runtime
49
37
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: '1.3'
55
- - !ruby/object:Gem::Dependency
56
- name: thor
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
38
+ requirement: &id004 !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - *id003
62
41
  type: :runtime
42
+ version_requirements: *id004
43
+ - !ruby/object:Gem::Dependency
44
+ name: thor
63
45
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rest-client
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
46
+ requirement: &id005 !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - *id003
76
49
  type: :runtime
50
+ version_requirements: *id005
51
+ - !ruby/object:Gem::Dependency
52
+ name: rest-client
77
53
  prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
54
+ requirement: &id006 !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - *id003
57
+ type: :runtime
58
+ version_requirements: *id006
83
59
  description: Command line tool for developing tablefillr themes
84
- email:
60
+ email:
85
61
  - oliver@opsb.co.uk
86
- executables:
62
+ executables:
87
63
  - themebox
88
64
  extensions: []
65
+
89
66
  extra_rdoc_files: []
90
- files:
67
+
68
+ files:
91
69
  - .gitignore
92
70
  - Gemfile
93
71
  - LICENSE.txt
@@ -99,29 +77,28 @@ files:
99
77
  - lib/themebox/client.rb
100
78
  - lib/themebox/version.rb
101
79
  - themebox.gemspec
102
- homepage: ''
103
- licenses:
80
+ homepage: ""
81
+ licenses:
104
82
  - MIT
105
83
  metadata: {}
84
+
106
85
  post_install_message:
107
86
  rdoc_options: []
108
- require_paths:
87
+
88
+ require_paths:
109
89
  - lib
110
- required_ruby_version: !ruby/object:Gem::Requirement
111
- requirements:
112
- - - '>='
113
- - !ruby/object:Gem::Version
114
- version: '0'
115
- required_rubygems_version: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - '>='
118
- - !ruby/object:Gem::Version
119
- version: '0'
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - *id003
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - *id003
120
96
  requirements: []
97
+
121
98
  rubyforge_project:
122
- rubygems_version: 2.0.6
99
+ rubygems_version: 2.1.5
123
100
  signing_key:
124
101
  specification_version: 4
125
- summary: Command line tool for developing tablefillr themes. Provides auto-syncing
126
- with tablefillr servers.
102
+ summary: Command line tool for developing tablefillr themes. Provides auto-syncing with tablefillr servers.
127
103
  test_files: []
104
+