xat 1.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +176 -0
  3. data/README.md +38 -0
  4. data/app_template/README.md +14 -0
  5. data/app_template/app.css +0 -0
  6. data/app_template/app.js +12 -0
  7. data/app_template/assets/banner.png +0 -0
  8. data/app_template/assets/logo-promotion.png +0 -0
  9. data/app_template/assets/logo-small.png +0 -0
  10. data/app_template/assets/logo.png +0 -0
  11. data/app_template/manifest.json.tt +13 -0
  12. data/app_template/templates/layout.hdbs +10 -0
  13. data/app_template/translations/en.json +16 -0
  14. data/app_template_iframe/README.md +14 -0
  15. data/app_template_iframe/assets/banner.png +0 -0
  16. data/app_template_iframe/assets/iframe.html +13 -0
  17. data/app_template_iframe/assets/logo-promotion.png +0 -0
  18. data/app_template_iframe/assets/logo-small.png +0 -0
  19. data/app_template_iframe/assets/logo.png +0 -0
  20. data/app_template_iframe/manifest.json.tt +15 -0
  21. data/app_template_iframe/translations/en.json +16 -0
  22. data/bin/xat +5 -0
  23. data/features/clean.feature +9 -0
  24. data/features/fixtures/quote_character_translation.json +6 -0
  25. data/features/new.feature +117 -0
  26. data/features/package.feature +22 -0
  27. data/features/step_definitions/app_steps.rb +103 -0
  28. data/features/support/env.rb +5 -0
  29. data/features/validate.feature +15 -0
  30. data/lib/xat.rb +5 -0
  31. data/lib/zendesk_apps_tools/api_connection.rb +33 -0
  32. data/lib/zendesk_apps_tools/array_patch.rb +22 -0
  33. data/lib/zendesk_apps_tools/bump.rb +60 -0
  34. data/lib/zendesk_apps_tools/cache.rb +25 -0
  35. data/lib/zendesk_apps_tools/command.rb +183 -0
  36. data/lib/zendesk_apps_tools/command_helpers.rb +20 -0
  37. data/lib/zendesk_apps_tools/common.rb +40 -0
  38. data/lib/zendesk_apps_tools/deploy.rb +94 -0
  39. data/lib/zendesk_apps_tools/directory.rb +28 -0
  40. data/lib/zendesk_apps_tools/locale_identifier.rb +10 -0
  41. data/lib/zendesk_apps_tools/manifest_handler.rb +72 -0
  42. data/lib/zendesk_apps_tools/package_helper.rb +30 -0
  43. data/lib/zendesk_apps_tools/server.rb +65 -0
  44. data/lib/zendesk_apps_tools/settings.rb +82 -0
  45. data/lib/zendesk_apps_tools/translate.rb +168 -0
  46. data/templates/translation.erb.tt +13 -0
  47. metadata +238 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 899c2fa1a60bb8969f568f82bb1b9826ce0c979d
4
+ data.tar.gz: 0a0b600ae881e98a8f6f9d89931e38edfd10e3ba
5
+ SHA512:
6
+ metadata.gz: 4982753829a0b0189d1329fbcd348eddb27b39ae80b81bafc2bb59ed052da6863ab56dbc7c962602e9ff2e34cb8a9e6348001428e631247109a74faf0245730d
7
+ data.tar.gz: 6343f1fb11c0ba1510f2ac59cb4b8296ecdac2d466b8de2fb418c0fc5d3e377fca62c282cb590b30c935f5d24424a9d2d865ba58480462f528a873f9ea9a69a8
data/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Zendesk Apps Tools
2
+
3
+ ## Description
4
+ Zendesk Apps Tools (ZAT) is the only tool needed for developing Zendesk Apps. It makes it easy to develop [Zendesk Apps](http://developer.zendesk.com/documentation/apps/). We have a [guide](http://developer.zendesk.com/documentation/apps/reference/tools.html) that explains how to use this tool.
5
+
6
+ ## Owners
7
+ This repo is owned and maintained by the Zendesk Apps team. You can reach us on vegemite@zendesk.com. We are located in Melbourne!
8
+
9
+ ## Getting Started To **Use** ZAT
10
+ If you want to **use** this tool, all you need to do is `gem install zendesk_apps_tools` and periodically run `gem update zendesk_apps_tools` because we will keep updating this tool.
11
+
12
+ ## Getting Started To **Develop** ZAT
13
+ When you want to help **develop** this tool, you will need to clone this repo and run `bundle install` to get it going.
14
+
15
+ ZAT uses a gem called [ZAS](https://github.com/zendesk/zendesk_apps_support/). In the case you are developing ZAT, it is likely you want to edit code in ZAS too, which means you will need to clone the ZAS repo and change the `Gemfile` (in the ZAT project) to say `gem 'zendesk_apps_support', path: '../zendesk_apps_support'`. The path should point to your local ZAS directory. This way your clone of ZAT will use a local version of ZAS which is very helpful for development. Run a `bundle install` after changing the Gemfile.
16
+
17
+ ## Testing
18
+ This project uses rspec, which can be run with `bundle exec rake`.
19
+
20
+ ## Contribute
21
+ Improvements are always welcome. To contribute, please:
22
+
23
+ * Put up a PR into the master branch.
24
+ * CC and get two +1 from @zendesk/vegemite.
25
+
26
+ ## Bugs
27
+ Bugs can be reported as an issue here on github, or submitted to support@zendesk.com. By mentioning this project it will assigned to the right team.
28
+
29
+ # Copyright and license
30
+ Copyright 2013 Zendesk
31
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
32
+ You may obtain a copy of the License at
33
+
34
+ [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
35
+
36
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
37
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38
+ See the License for the specific language governing permissions and limitations under the License.
@@ -0,0 +1,14 @@
1
+ # App name
2
+
3
+ [brief description of the app]
4
+
5
+ ### The following information is displayed:
6
+
7
+ * info1
8
+ * info2
9
+ * info3
10
+
11
+ Please submit bug reports to [Insert Link](). Pull requests are welcome.
12
+
13
+ ### Screenshot(s):
14
+ [put your screenshots down here.]
File without changes
@@ -0,0 +1,12 @@
1
+ (function() {
2
+
3
+ return {
4
+ events: {
5
+ 'app.activated':'doSomething'
6
+ },
7
+
8
+ doSomething: function() {
9
+ }
10
+ };
11
+
12
+ }());
Binary file
Binary file
Binary file
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "<%= @app_name %>",
3
+ "author": {
4
+ "name": "<%= @author_name %>",
5
+ "email": "<%= @author_email %>",
6
+ "url": "<%= @author_url %>"
7
+ },
8
+ "defaultLocale": "en",
9
+ "private": true,
10
+ "location": ["ticket_sidebar"],
11
+ "version": "1.0",
12
+ "frameworkVersion": "1.0"
13
+ }
@@ -0,0 +1,10 @@
1
+ <header>
2
+ <span class="logo"></span>
3
+ <h3>{{setting "name"}}</h3>
4
+ </header>
5
+ <section data-main></section>
6
+ <footer>
7
+ <a href="mailto:{{author.email}}">
8
+ {{author.name}}
9
+ </a>
10
+ </footer>
@@ -0,0 +1,16 @@
1
+ {
2
+ "app": {
3
+ "description": "Play the famous zen tunes in your help desk.",
4
+ "name": "Buddha Machine"
5
+ },
6
+ "loading": "Welcome to this Sample App",
7
+ "fetch": {
8
+ "done": "Good",
9
+ "fail": "failed to fetch information from the server"
10
+ },
11
+ "id": "ID",
12
+ "email": "Email",
13
+ "name": "Name",
14
+ "role": "Role",
15
+ "groups": "Groups"
16
+ }
@@ -0,0 +1,14 @@
1
+ # App name
2
+
3
+ [brief description of the app]
4
+
5
+ ### The following information is displayed:
6
+
7
+ * info1
8
+ * info2
9
+ * info3
10
+
11
+ Please submit bug reports to [Insert Link](). Pull requests are welcome.
12
+
13
+ ### Screenshot(s):
14
+ [put your screenshots down here.]
@@ -0,0 +1,13 @@
1
+ <html>
2
+ <body>
3
+ <h2>Zendesk Apps Tools Iframe Scaffold</h2>
4
+ <!-- https://github.com/zendesk/zendesk_app_framework_sdk -->
5
+ <script type="text/javascript" src="http://assets.zendesk.com/apps/sdk/2.0.0-beta1/zaf_sdk.js"></script>
6
+ <script>
7
+ // Initialise the Zendesk JavaScript API client
8
+ // https://developer.zendesk.com/apps/docs/agent/zaf_v2
9
+ var client = ZAFClient.init();
10
+ client.invoke('resize', { width: '100%', height: '400px' });
11
+ </script>
12
+ </body>
13
+ </html>
Binary file
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "<%= @app_name %>",
3
+ "author": {
4
+ "name": "<%= @author_name %>",
5
+ "email": "<%= @author_email %>",
6
+ "url": "<%= @author_url %>"
7
+ },
8
+ "defaultLocale": "en",
9
+ "private": true,
10
+ "location": { "zendesk":
11
+ { "ticket_sidebar": "<%= @iframe_location %>" }
12
+ },
13
+ "version": "1.0",
14
+ "frameworkVersion": "1.0"
15
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "app": {
3
+ "description": "Play the famous zen tunes in your help desk.",
4
+ "name": "Buddha Machine"
5
+ },
6
+ "loading": "Welcome to this Sample App",
7
+ "fetch": {
8
+ "done": "Good",
9
+ "fail": "failed to fetch information from the server"
10
+ },
11
+ "id": "ID",
12
+ "email": "Email",
13
+ "name": "Name",
14
+ "role": "Role",
15
+ "groups": "Groups"
16
+ }
data/bin/xat ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ lib_dir = File.expand_path('../../lib', __FILE__)
3
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
4
+ require 'xat'
5
+ ZendeskAppsTools::Command.start
@@ -0,0 +1,9 @@
1
+ Feature: clean tmp folder inside the zendesk app
2
+
3
+ Background: create a new zendesk app package
4
+ Given an app is created in directory "tmp/aruba"
5
+ And I run the command "xat package --path tmp/aruba" to package the app
6
+
7
+ Scenario: clean tmp folder
8
+ When I run the command "xat clean --path tmp/aruba" to clean the app
9
+ Then the zip file in "tmp/aruba/tmp" folder should not exist
@@ -0,0 +1,6 @@
1
+ {
2
+ "app": {
3
+ "description": "Play the famous zen tunes in your help desk.",
4
+ "name": "Buddha \"Machine\""
5
+ }
6
+ }
@@ -0,0 +1,117 @@
1
+ Feature: create a template for a new zendesk app
2
+
3
+ Scenario: Create a new app in an existing directory
4
+ Given an app directory "tmp/aruba" exists
5
+ And I move to the app directory
6
+ When I run "xat new" command with the following details:
7
+ | author name | John Citizen |
8
+ | author email | john@example.com |
9
+ | author url | http://myapp.com |
10
+ | app name | John Test App |
11
+ | app dir | |
12
+
13
+ Then the app file "manifest.json" is created
14
+ And I reset the working directory
15
+
16
+ Scenario: create a template for a new zendesk app by running 'xat new' command
17
+ Given an app directory "tmp/aruba" exists
18
+ When I run "xat new" command with the following details:
19
+ | author name | John Citizen |
20
+ | author email | john@example.com |
21
+ | author url | http://myapp.com |
22
+ | app name | John Test App |
23
+ | app dir | tmp/aruba |
24
+
25
+ Then the app file "tmp/aruba/manifest.json" is created with:
26
+ """
27
+ {
28
+ "name": "John Test App",
29
+ "author": {
30
+ "name": "John Citizen",
31
+ "email": "john@example.com",
32
+ "url": "http://myapp.com"
33
+ },
34
+ "defaultLocale": "en",
35
+ "private": true,
36
+ "location":["ticket_sidebar"],
37
+ "version": "1.0",
38
+ "frameworkVersion": "1.0"
39
+ }
40
+ """
41
+ And the app file "tmp/aruba/app.js" is created with:
42
+ """
43
+ (function() {
44
+
45
+ return {
46
+ events: {
47
+ 'app.activated':'doSomething'
48
+ },
49
+
50
+ doSomething: function() {
51
+ }
52
+ };
53
+
54
+ }());
55
+ """
56
+ And the app file "tmp/aruba/templates/layout.hdbs" is created with:
57
+ """
58
+ <header>
59
+ <span class="logo"></span>
60
+ <h3>{{setting "name"}}</h3>
61
+ </header>
62
+ <section data-main></section>
63
+ <footer>
64
+ <a href="mailto:{{author.email}}">
65
+ {{author.name}}
66
+ </a>
67
+ </footer>
68
+ """
69
+ And the app file "tmp/aruba/translations/en.json" is created with:
70
+ """
71
+ {
72
+ "app": {
73
+ "description": "Play the famous zen tunes in your help desk.",
74
+ "name": "Buddha Machine"
75
+ },
76
+ "loading": "Welcome to this Sample App",
77
+ "fetch": {
78
+ "done": "Good",
79
+ "fail": "failed to fetch information from the server"
80
+ },
81
+ "id": "ID",
82
+ "email": "Email",
83
+ "name": "Name",
84
+ "role": "Role",
85
+ "groups": "Groups"
86
+ }
87
+ """
88
+
89
+ Scenario: create a template for a new iframe only app by running 'xat new --v2' command
90
+ Given an app directory "tmp/aruba" exists
91
+ And I move to the app directory
92
+ When I run "xat new --v2" command with the following details:
93
+ | author name | John Citizen |
94
+ | author email | john@example.com |
95
+ | author url | http://myapp.com |
96
+ | app name | John Test App |
97
+ | iframe uri | assets/index.html |
98
+ | app dir | tmp/aruba |
99
+
100
+ Then the app file "tmp/aruba/manifest.json" is created with:
101
+ """
102
+ {
103
+ "name": "John Test App",
104
+ "author": {
105
+ "name": "John Citizen",
106
+ "email": "john@example.com",
107
+ "url": "http://myapp.com"
108
+ },
109
+ "defaultLocale": "en",
110
+ "private": true,
111
+ "location": { "zendesk":
112
+ { "ticket_sidebar": "assets/index.html" }
113
+ },
114
+ "version": "1.0",
115
+ "frameworkVersion": "1.0"
116
+ }
117
+ """