nationsync 0.0.1 → 0.0.2

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
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c13ca136a215a8c64a08eae32b04004d90938d4
4
- data.tar.gz: 1b58076f4c5711f82c127505ad14958195584527
3
+ metadata.gz: 68f87a6405d38aa1ffd8c2d97c8cd4bf3889c1d0
4
+ data.tar.gz: d8e3bc85f3e45d78777fdfd5de117309ed316ee5
5
5
  SHA512:
6
- metadata.gz: 873b683127d8273faa4804929d9f0e31f8abf3fc056229572995e9c032102589da8eb327cd863edcb022240471777ed85a3190d941a6ca90791b1dfb050993ea
7
- data.tar.gz: dbb78f5a8eae45052789309876558927e5aa9c4e91e4998c483057303e48084056cc4839b016e3e3a0a6bdb1edaea9d8bb13473cd3b82a8e814b5da61aead92e
6
+ metadata.gz: efe20747b024cd3af5d80201965feeeecfe259a4c5ef701503d17daf8b81769eca7b94483fa7cfff3fcffcb85020d24478cf2bbdd90cf8895c04eec05692c351
7
+ data.tar.gz: f6f20e84e34fd52cdbf52b33d42e3f401055a0bfa3e2ff387555914d6a071486651565007a70577935d558be5dabac9f1badb11d72f216efb95c463c96d13cea
data/.gitignore CHANGED
@@ -12,6 +12,8 @@ lib/bundler/man
12
12
  pkg
13
13
  rdoc
14
14
  spec/reports
15
+ test
16
+ test*
15
17
  test/tmp
16
18
  test/version_tmp
17
19
  tmp
data/LICENSE.txt CHANGED
@@ -1,22 +1,24 @@
1
1
  Copyright (c) 2013 Dirk Gadsden
2
+ All rights reserved.
2
3
 
3
- MIT License
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ * The names of this software's contributors may not be used to endorse or
12
+ promote products derived from this software without specific prior
13
+ written permission.
4
14
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL Dirk Gadsden BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -1,29 +1,35 @@
1
- # Nationsync
1
+ # NationSync
2
2
 
3
- TODO: Write a gem description
3
+ NationSync is a Ruby client for synchronizing a [NationBuilder](http://nationbuilder.com/) theme with a local directory. It allows you to edit theme files locally and have your changes automatically sent to the server.
4
+
5
+ The core of NationSync is the theme tool API used internally by the [NationBuilder Theme Sync for Mac](http://nationbuilder.com/theme_sync). As such this may break with the whims of the developers at NationBuilder. NationSync also uses the [Listen](https://github.com/guard/listen) gem from Guard to monitor the file system for changes, so it's *hopefully* cross-platform.
4
6
 
5
7
  ## Installation
6
8
 
7
- Add this line to your application's Gemfile:
9
+ It's easy:
10
+
11
+ gem install nationsync
8
12
 
9
- gem 'nationsync'
13
+ ## Usage
10
14
 
11
- And then execute:
15
+ Make sure you are in the directory that you'll be syncing your theme into when running these commands!
12
16
 
13
- $ bundle
17
+ ### 1. Account setup
14
18
 
15
- Or install it yourself as:
19
+ Next run `nationsync init`; this will prompt you for your domain, email, and password. It then authenticates with NationBuilder and saves its access token and session in `.nbconfig1`.
16
20
 
17
- $ gem install nationsync
21
+ ### 2. Theme setup
18
22
 
19
- ## Usage
23
+ Run `nationsync pick_theme`; it will fetch a list of themes and allow you to pick one. Then run `nationsync fetch` to fetch theme files into the current directory. To pull new files or updated files run `nationsync fetch` again. (Running `nationsync clean` will also remove all NationSync theme files from the current directory, however it will leave the config file so you can then fetch again.)
20
24
 
21
- TODO: Write usage instructions here
25
+ ### 3. Watching ###
26
+
27
+ `nationsync watch` will start watching the directory for changes and will upload any changed files to NationBuilder.
22
28
 
23
29
  ## Contributing
24
30
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
31
+ Fork and pull-request!
32
+
33
+ ## License ##
34
+
35
+ Copyright 2013 Dirk Gadsden and released under a modified New BSD License. See LICENSE.txt for details.
data/bin/nationsync CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- $:.unshift File.dirname(__FILE__) + '/../lib'
5
- require 'nationsync/commander'
4
+ if File.expand_path(File.dirname(__FILE__)).include? "nationsync/bin"
5
+ $:.unshift File.dirname(__FILE__) + '/../lib'
6
+ end
7
+ require 'nationsync/cli'
6
8
 
data/lib/nationsync.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module NationSync
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
4
4
 
5
5
  require 'nationsync/api'
@@ -68,7 +68,8 @@ class NationSyncThor < Thor
68
68
  puts "- Skipping #{fn}"
69
69
  end
70
70
  type = MIME::Types.type_for(fn).first
71
- if type.binary?
71
+ is_binary = type && type.binary?
72
+ if is_binary
72
73
  resp = @api.theme_asset_put_attachment(@config["theme_id"], fn, File.read(path))
73
74
  else
74
75
  resp = @api.theme_asset_put(@config["theme_id"], fn, File.read(path))
@@ -76,7 +77,7 @@ class NationSyncThor < Thor
76
77
 
77
78
  if resp.status == 200
78
79
  if resp.body["success"].to_s == "true"
79
- puts "- Updated #{fn}" + (type.binary? ? " (binary)" : "")
80
+ puts "- Updated #{fn}" + (is_binary ? " (binary)" : "")
80
81
  else
81
82
  puts "- #{HL.color("Error", :red) } updating #{fn}:"
82
83
  errors = resp.body["errors"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nationsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dirk Gadsden
@@ -139,7 +139,7 @@ files:
139
139
  - lib/nationsync.rb
140
140
  - lib/nationsync/api.rb
141
141
  - lib/nationsync/auth.rb
142
- - lib/nationsync/commander.rb
142
+ - lib/nationsync/cli.rb
143
143
  - nationsync.gemspec
144
144
  homepage: http://github.com/dirk/nationsync
145
145
  licenses: