├── .dir-locals.el
├── .gitignore
├── .projectile
├── .travis.yml
├── CONTRIBUTING.md
├── Cask
├── ChangeLog.md
├── LICENSE
├── Makefile
├── README.md
├── Vagrantfile
├── images
└── emacs-travis.png
├── test
├── test-helper.el
├── travis-auth-test.el
├── travis-builds-test.el
├── travis-mode-test.el
├── travis-repos-test.el
├── travis-ui-test.el
├── travis-users-test.el
├── travis-utils-test.el
└── travis-version-test.el
├── travis-api.el
├── travis-auth.el
├── travis-builds.el
├── travis-mode.el
├── travis-repos.el
├── travis-ui.el
├── travis-users.el
├── travis-utils.el
├── travis-version.el
├── travis.el
├── vagrant
└── provision.sh
└── wercker.yml
/.dir-locals.el:
--------------------------------------------------------------------------------
1 | ((nil . ((indent-tabs-mode . nil)
2 | (fill-column . 80)
3 | (sentence-end-double-space . t)
4 | (emacs-lisp-docstring-fill-column . 75))))
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | *\#*\#
3 | *.\#*
4 | *.elc
5 | .cask
6 | elpa
7 | .depend
8 | travis-pkg.el
9 | packages/*
10 | TAGS
11 | .DS_STORE
12 | dist
13 | .vagrant/
14 |
--------------------------------------------------------------------------------
/.projectile:
--------------------------------------------------------------------------------
1 | /.cask
2 | /packages
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | ###
2 | ### Notes
3 | ###
4 | ### The travis web interface may choke silently and fail to
5 | ### update when there are issues with the .travis.yml file.
6 | ###
7 | ### The "travis-lint" command-line tool does not catch all
8 | ### errors which may lead to silent failure.
9 | ###
10 | ### Shell-style comments in this file must have "#" as the
11 | ### *first* character of the line.
12 | ###
13 |
14 | ###
15 | ### language
16 | ###
17 |
18 | language: emacs-lisp
19 |
20 | ###
21 | ### defining the build matrix
22 | ###
23 | ### ===> <===
24 | ### ===> each variation in env/matrix will be built and tested <===
25 | ### ===> <===
26 | ###
27 | ### variables under env/global are available to the build process
28 | ### but don't cause the creation of a separate variation
29 | ###
30 |
31 | env:
32 | # - EMACS=emacs-23.4-bin METHOD=evm
33 | # - EMACS=emacs-24.1-bin METHOD=evm
34 | # - EMACS=emacs-24.2-bin METHOD=evm
35 | # - EMACS=emacs-24.3-bin METHOD=evm
36 | - EMACS=emacs-24.4-bin METHOD=evm
37 | # - EMACS=emacs24 METHOD=manual
38 | - EMACS=emacs-snapshot METHOD=manual
39 |
40 | ###
41 | ### allowing build failures
42 | ###
43 |
44 | # matrix:
45 | # fast_finish: true
46 | # allow_failures:
47 | # - env: EMACS=emacs-23.4-bin METHOD=evm
48 |
49 | ###
50 | ### limit build attempts to defined branches
51 | ###
52 | ### notes
53 | ###
54 | ### This controls which branches are built.
55 | ###
56 | ### You can also control which branches affect the web badge, by
57 | ### appending "?branch=master,staging,production" to the end of the
58 | ### image URL (replacing "master,staging,production" with a
59 | ### comma-separated list of branches to be reflected in the badge).
60 | ###
61 | #
62 | # branches:
63 | # only:
64 | # - master
65 | #
66 |
67 | ###
68 | ### runtime initialization
69 | ###
70 | ### notes
71 | ###
72 | ### emacs22 is extracted manually from Ubuntu Maverick.
73 | ###
74 | ### emacs23 is the stock default, but is updated anyway to
75 | ### a GUI-capable version, which will have certain additional
76 | ### functions compiled in.
77 | ###
78 | ### emacs24 (current stable release) is obtained from the
79 | ### cassou PPA: http://launchpad.net/~cassou/+archive/emacs
80 | ###
81 | ### emacs-snapshot (trunk) is obtained from the Ubuntu Emacs Lisp PPA:
82 | ### https://launchpad.net/~ubuntu-elisp/+archive/ppa
83 | ### For the emacs-snapshot build, bleeding-edge versions
84 | ### of all test dependencies are also used.
85 | ###
86 |
87 | # before_install:
88 | # - git submodule --quiet update --init --recursive
89 |
90 | install:
91 | - if [ "$METHOD" = 'evm' ]; then
92 | sudo mkdir /usr/local/evm &&
93 | sudo chown travis:travis /usr/local/evm &&
94 | sudo add-apt-repository -y ppa:cassou/emacs &&
95 | sudo apt-get update -qq &&
96 | sudo apt-get build-dep -qq emacs24 &&
97 | curl -fsSkL https://raw.github.com/rejeep/evm/master/go | bash &&
98 | export PATH="~/.evm/bin:$PATH" &&
99 | chmod +x ~/.evm/bin/evm &&
100 | ~/.evm/bin/evm install $EMACS &&
101 | ~/.evm/bin/evm use $EMACS &&
102 | FULL_EMACS_PATH="/usr/local/evm/$EMACS/bin/emacs" &&
103 | export EMACS="$FULL_EMACS_PATH" &&
104 | EMACS="$FULL_EMACS_PATH";
105 | fi
106 | - if [ "$EMACS" = 'emacs24' ]; then
107 | sudo add-apt-repository -y ppa:cassou/emacs &&
108 | sudo apt-get -qq update &&
109 | sudo apt-get -qq -f install &&
110 | sudo apt-get -qq install emacs24 emacs24-el;
111 | fi
112 | - if [ "$EMACS" = 'emacs-snapshot' ]; then
113 | sudo add-apt-repository -y ppa:ubuntu-elisp/ppa &&
114 | sudo apt-get -qq update &&
115 | sudo apt-get -qq -f install &&
116 | sudo apt-get -qq install emacs-snapshot &&
117 | sudo apt-get -qq install emacs-snapshot-el;
118 | fi
119 | - curl -fsSkL https://raw.github.com/cask/cask/master/go | python
120 | - export PATH="${HOME}/.cask/bin:$PATH"
121 |
122 |
123 | before_script:
124 | # - if [ "$EMACS" = 'emacs-snapshot' ]; then
125 | # make downloads-latest;
126 | # else
127 | # make downloads;
128 | # fi
129 |
130 | ###
131 | ### the actual build/test command
132 | ###
133 | ### Use "make test-batch" to test without byte-compiling.
134 | ### The default command avoids byte-compiling on Emacs 22.
135 | ###
136 |
137 | script:
138 | echo "Method is $METHOD " && $EMACS --version && EMACS="$EMACS" make init test
139 |
140 | ###
141 | ### settings
142 | ###
143 |
144 | # notifications:
145 | # email: false
146 |
147 | #
148 | # Emacs
149 | #
150 | # Local Variables:
151 | # indent-tabs-mode: nil
152 | # coding: utf-8
153 | # End:
154 | #
155 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | If you discover issues, have ideas for improvements or new features, or
4 | want to contribute a new module, please report them to the
5 | [issue tracker][1] of the repository or submit a pull request. Please,
6 | try to follow these guidelines when you do so.
7 |
8 | ## Issue reporting
9 |
10 | * Check that the issue has not already been reported.
11 | * Check that the issue has not already been fixed in the latest code
12 | (a.k.a. `master`).
13 | * Be clear, concise and precise in your description of the problem.
14 | * Open an issue with a descriptive title and a summary in grammatically correct,
15 | complete sentences.
16 | * Include any relevant code to the issue summary.
17 |
18 | ## Pull requests
19 |
20 | * Read [how to properly contribute to open source projects on Github][2].
21 | * Use a topic branch to easily amend a pull request later, if necessary.
22 | * Write [good commit messages][3].
23 | * Use the same coding conventions as the rest of the project.
24 | * Verify your Emacs Lisp code with `checkdoc`.
25 | * Open a [pull request][4] that relates to *only* one subject with a clear title
26 | and description in grammatically correct, complete sentences.
27 |
28 |
29 | [1]: https://github.com/nlamirault/emacs-travis/issues
30 | [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
31 | [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
32 | [4]: https://help.github.com/articles/using-pull-requests
33 |
--------------------------------------------------------------------------------
/Cask:
--------------------------------------------------------------------------------
1 | ;;; Scame Cask file
2 |
3 | (source "melpa" "http://melpa.org/packages/")
4 | (source "gnu" "http://elpa.gnu.org/packages/")
5 |
6 | (package-file "travis.el")
7 | (files "*.el" (:exclude ".dir-locals.el"))
8 |
9 | ;; Development
10 | (development
11 | (depends-on "f")
12 | (depends-on "s")
13 | (depends-on "ansi")
14 | (depends-on "pkg-info")
15 | (depends-on "ert")
16 | (depends-on "ert-runner")
17 | (depends-on "undercover"))
18 |
--------------------------------------------------------------------------------
/ChangeLog.md:
--------------------------------------------------------------------------------
1 | # emacs-travis ChangeLog
2 |
3 | # Version 0.6.0 (25/08/2015)
4 |
5 | - Key binding to open in browser the project's page in Travis website
6 | - Refactoring to display one or more Travis projects status
7 | - ``FIX`` Remove *helm*
8 |
9 | # Version 0.5.0 (02/03/2015)
10 |
11 | - ``FIX`` Display projects fails when no description available
12 | - Update unit tests configuration for [overseer][]
13 | - ``FIX`` unit tests for travis builds
14 |
15 | # Version 0.4.0 (12/22/2014)
16 |
17 | - Update unit tests
18 | - ``FIX`` TravisCI setup
19 |
20 | # Version 0.3.0 (11/21/2014)
21 |
22 | - Add Vagrant configuration for testing in a virtual machine
23 | - ``FIX`` remove ansi library to dependencies
24 | - ``FIX`` if duration input is empty, display 0.
25 | - Test TravisUI faces
26 |
27 | # Version 0.2.0 (11/16/2014)
28 |
29 | - Add [TravisCI][] and [Drone.io][] for continuous integration
30 | - Implements Travis mode to display projects build status
31 | - Enable code coverage
32 |
33 | # Version 0.1.0 (11/14/2014)
34 |
35 | - Retrieve builds
36 | - Retrieve users
37 | - Retrieve projects
38 | - API authentication
39 | - Init project
40 |
41 |
42 | [TravisCI]: https://travis-ci.org/nlamirault/emacs-travis
43 | [Drone.io]: https://drone.io/github.com/nlamirault/emacs-travis
44 | [overseer]: https://github.com/tonini/overseer.el
45 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2014, 2015 Nicolas Lamirault
2 |
3 | # This program is free software: you can redistribute it and/or modify
4 | # it under the terms of the GNU General Public License as published by
5 | # the Free Software Foundation, either version 3 of the License, or
6 | # (at your option) any later version.
7 |
8 | # This program is distributed in the hope that it will be useful,
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | # GNU General Public License for more details.
12 |
13 | # You should have received a copy of the GNU General Public License
14 | # along with this program. If not, see .
15 |
16 | APP = travis
17 |
18 | EMACS ?= emacs
19 | EMACSFLAGS = -L .
20 | CASK = cask
21 | VAGRANT = vagrant
22 |
23 | VERSION=$(shell \
24 | grep Version travis.el \
25 | |awk -F':' '{print $$2}' \
26 | |sed -e "s/[^0-9.]//g")
27 |
28 | PACKAGE_FOLDER=$(APP)-$(VERSION)
29 | ARCHIVE=$(PACKAGE_FOLDER).tar
30 |
31 | ELS = $(wildcard *.el)
32 | OBJECTS = $(ELS:.el=.elc)
33 |
34 | NO_COLOR=\033[0m
35 | OK_COLOR=\033[32;01m
36 | ERROR_COLOR=\033[31;01m
37 | WARN_COLOR=\033[33;01m
38 |
39 | all: help
40 |
41 | help:
42 | @echo -e "$(OK_COLOR)==== $(APP) [$(VERSION)]====$(NO_COLOR)"
43 | @echo -e "$(WARN_COLOR)- init$(NO_COLOR) : initialize development environment"
44 | @echo -e "$(WARN_COLOR)- build$(NO_COLOR) : build project"
45 | @echo -e "$(WARN_COLOR)- test$(NO_COLOR) : launch unit tests"
46 | @echo -e "$(WARN_COLOR)- clean$(NO_COLOR) : cleanup"
47 | @echo -e "$(WARN_COLOR)- package$(NO_COLOR) : packaging"
48 |
49 | check-env:
50 | ifndef TRAVIS_TOKEN
51 | $(error TRAVIS_TOKEN is undefined)
52 | endif
53 |
54 | init:
55 | @echo -e "$(OK_COLOR)[$(APP)] Initialize environment$(NO_COLOR)"
56 | @echo -e "Emacs version : $(EMACS) --version"
57 | @$(CASK) --dev install
58 |
59 | elpa:
60 | @echo -e "$(OK_COLOR)[$(APP)] Build$(NO_COLOR)"
61 | @$(CASK) install
62 | @$(CASK) update
63 | @touch $@
64 |
65 | .PHONY: build
66 | build : elpa $(OBJECTS)
67 |
68 | test: build check-env
69 | @echo -e "$(OK_COLOR)[$(APP)] Unit tests$(NO_COLOR)"
70 | @$(CASK) exec ert-runner
71 |
72 | .PHONY: virtual-test
73 | virtual-test: check-env
74 | @$(VAGRANT) up
75 | @$(VAGRANT) ssh -c "source /tmp/.emacs-travis.rc && make -C /vagrant EMACS=$(EMACS) clean init test"
76 |
77 | .PHONY: virtual-clean
78 | virtual-clean:
79 | @$(VAGRANT) destroy
80 |
81 | .PHONY: clean
82 | clean :
83 | @echo -e "$(OK_COLOR)[$(APP)] Cleanup$(NO_COLOR)"
84 | @rm -fr $(OBJECTS) elpa $(APP)-pkg.el $(APP)-pkg.elc $(ARCHIVE).gz
85 |
86 | reset : clean
87 | @rm -rf .cask
88 |
89 | pkg-file:
90 | $(CASK) pkg-file
91 |
92 | pkg-el: pkg-file
93 | $(CASK) package
94 |
95 | package: clean pkg-el
96 | @echo -e "$(OK_COLOR)[$(APP)] Packaging$(NO_COLOR)"
97 | cp dist/$(ARCHIVE) .
98 | gzip $(ARCHIVE)
99 | rm -fr dist
100 |
101 | %.elc : %.el
102 | @$(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
103 | $(EMACSFLAGS) \
104 | -f batch-byte-compile $<
105 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # emacs-travis
2 |
3 | [![travis][badge-travis]][travis]
4 | [![drone][badge-drone]][drone]
5 | [](http://melpa.milkbox.net/#/travis)
6 | [](http://stable.melpa.org/#/travis)
7 | [](https://coveralls.io/r/nlamirault/emacs-travis)
8 |
9 | `emacs-travis` provides :
10 | * a REST client to the [Travis][] API
11 |
12 | ## Installation
13 |
14 | The recommended way to install ``emacs-travis`` is via [MELPA][]:
15 |
16 | M-x package-install travis
17 |
18 | or [Cask][]:
19 |
20 | (depends-on "travis")
21 |
22 |
23 | ## Usage
24 |
25 | * Setup your Travis configurations using your Github token :
26 |
27 | $ export TRAVIS_TOKEN=xxxxxx
28 |
29 | * Display your Travis build status for some projects:
30 |
31 | M-x travis-show-projects
32 |
33 | See 
34 |
35 |
36 | ## Development
37 |
38 | ### Cask
39 |
40 | ``emacs-travis`` use [Cask][] for dependencies
41 | management. Install it and retrieve dependencies :
42 |
43 | $ curl -fsSkL https://raw.github.com/cask/cask/master/go | python
44 | $ export PATH="$HOME/.cask/bin:$PATH"
45 | $ cask
46 |
47 |
48 | ### Tests
49 |
50 | * Launch unit tests :
51 |
52 | $ export TRAVIS_TOKEN xxxxxx
53 | $ make clean test
54 |
55 |
56 | ## Support / Contribute
57 |
58 | See [here](CONTRIBUTING.md)
59 |
60 |
61 |
62 | ## Changelog
63 |
64 | A changelog is available [here](ChangeLog.md).
65 |
66 |
67 | ## License
68 |
69 | See [LICENSE](LICENSE).
70 |
71 |
72 | ## Contact
73 |
74 | Nicolas Lamirault
75 |
76 | [emacs-travis]: https://github.com/nlamirault/emacs-travis
77 | [badge-license]: https://img.shields.io/badge/license-GPL_2-green.svg?style=flat
78 | [LICENSE]: https://github.com/nlamirault/emacs-travis/blob/master/LICENSE
79 | [travis]: https://travis-ci.org/nlamirault/emacs-travis
80 | [badge-travis]: http://img.shields.io/travis/nlamirault/emacs-travis.svg?style=flat
81 | [badge-drone]: https://drone.io/github.com/nlamirault/emacs-travis/status.png
82 | [drone]: https://drone.io/github.com/nlamirault/emacs-travis/latest
83 | [badge-wercker]: https://app.wercker.com/status/230e39942045191c79677ed663572c69/s
84 | [wercker]: https://app.wercker.com/project/bykey/230e39942045191c79677ed663572c69
85 | [GNU Emacs]: https://www.gnu.org/software/emacs/
86 | [MELPA]: http://melpa.milkbox.net/
87 | [Cask]: http://cask.github.io/
88 | [Issue tracker]: https://github.com/nlamirault/emacs-travis/issues
89 | [Helm]: https://github.com/emacs-helm/helm
90 |
--------------------------------------------------------------------------------
/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | Vagrant::Config.run do |config|
5 | config.vm.box = "Utopic64"
6 | # config.vm.box = "Trusty64"
7 | config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/utopic/current/utopic-server-cloudimg-amd64-vagrant-disk1.box"
8 | # config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
9 | config.vm.provision :shell do |s|
10 | s.path = "vagrant/provision.sh"
11 | s.args = "#{ENV['TRAVIS_TOKEN']}"
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/images/emacs-travis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nlamirault/emacs-travis/754ef07c17fed17ab03664ad11e2b0b2ef5e78ed/images/emacs-travis.png
--------------------------------------------------------------------------------
/test/test-helper.el:
--------------------------------------------------------------------------------
1 | ;; test-helper.el --- Test helpers for travis.el
2 |
3 | ;; Copyright (C) 2014, 2015 Nicolas Lamirault
4 |
5 | ;; Author: Nicolas Lamirault
6 | ;; Homepage: https://github.com/nlamirault/emacs-travis
7 |
8 | ;;; License:
9 |
10 | ;; This file is NOT part of GNU Emacs.
11 |
12 | ;; This program is free software; you can redistribute it and/or modify
13 | ;; it under the terms of the GNU General Public License as published by
14 | ;; the Free Software Foundation, either version 3 of the License, or
15 | ;; (at your option) any later version.
16 |
17 | ;; This program is distributed in the hope that it will be useful,
18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | ;; GNU General Public License for more details.
21 |
22 | ;; You should have received a copy of the GNU General Public License
23 | ;; along with this program. If not, see .
24 |
25 | ;;; Commentary:
26 |
27 | ;;; Code:
28 |
29 | (require 'ansi)
30 | (require 'cl) ;; http://emacs.stackexchange.com/questions/2864/symbols-function-definition-is-void-cl-macroexpand-all-when-trying-to-instal
31 | (require 'ert)
32 | (require 'f)
33 | (require 'undercover)
34 |
35 | (setq debugger-batch-max-lines (+ 50 max-lisp-eval-depth)
36 | debug-on-error t)
37 |
38 | (defvar username (getenv "HOME"))
39 |
40 | (defconst travis-testsuite-dir
41 | (f-parent (f-this-file))
42 | "The testsuite directory.")
43 |
44 | (defconst travis-source-dir
45 | (f-parent travis-testsuite-dir)
46 | "The travis.el source directory.")
47 |
48 | (defconst travis-sandbox-path
49 | (f-expand "sandbox" travis-testsuite-dir)
50 | "The sandbox path for travis.")
51 |
52 | (defun cleanup-load-path ()
53 | "Remove home directory from 'load-path."
54 | (message (ansi-green "[travis] Cleanup path"))
55 | (mapc #'(lambda (path)
56 | (when (string-match (s-concat username "/.emacs.d") path)
57 | (message (ansi-yellow "Suppression path %s" path))
58 | (setq load-path (delete path load-path))))
59 | load-path)
60 | (add-to-list 'load-path default-directory))
61 |
62 | (defun load-unit-tests (path)
63 | "Load all unit test from PATH."
64 | (message (ansi-green "[travis] Execute unit tests %s"
65 | path))
66 | (dolist (test-file (or argv (directory-files path t "-test.el$")))
67 | (load test-file nil t)))
68 |
69 |
70 | (defun load-library (file)
71 | "Load current library from FILE."
72 | (let ((path (s-concat travis-source-dir file)))
73 | (message (ansi-yellow "[travis] Load library from %s" path))
74 | (undercover "*.el" (:exclude "*-test.el"))
75 | (require 'travis path)))
76 |
77 |
78 | (defun setup-travis ()
79 | "Setup Travis token from TRAVIS_TOKEN environment variable."
80 | (setq travis-token-id (getenv "TRAVIS_TOKEN")))
81 |
82 |
83 | (defmacro with-test-sandbox (&rest body)
84 | "Evaluate BODY in an empty sandbox directory."
85 | `(unwind-protect
86 | (condition-case nil ;ex
87 | (let (;;(user-emacs-directory travis-sandbox-path)
88 | (default-directory travis-source-dir))
89 | ;; (unless (f-dir? travis-sandbox-path)
90 | ;; (f-mkdir travis-sandbox-path))
91 | (cleanup-load-path)
92 | (load-library "/travis.el")
93 | (setup-travis)
94 | ,@body)
95 | ;; (f-delete overseer-sandbox-path :force)))
96 | )))
97 | ;; (error
98 | ;; (message (ansi-red "[Scame] Error during unit tests : %s" ex))))))
99 |
100 | ;;; test-helper.el ends here
101 |
--------------------------------------------------------------------------------
/test/travis-auth-test.el:
--------------------------------------------------------------------------------
1 | ;;; travis-auth-test.el --- Tests for Travis tools
2 |
3 | ;; Copyright (C) Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | ;; (require 'travis-utils)
25 |
26 |
27 | (ert-deftest test-travis-headers-after-authentication ()
28 | (with-test-sandbox
29 | (travis--get-auth)
30 | (let ((headers (travis--get-headers)))
31 | ;; (message "Headers: %s" headers)
32 | (should (s-contains? "token"
33 | (assoc-default "Authorization" headers))))))
34 |
35 |
36 | (ert-deftest test-travis-get-hello-world ()
37 | (with-test-sandbox
38 | (travis--get-auth)
39 | (let ((response (travis--perform-http-request "GET" "" nil 200)))
40 | ;;(message "Response: %s" response)
41 | (should (string-equal "hello" (caar response)))
42 | (should (string-equal "world" (cdar response))))))
43 |
44 |
45 | (provide 'travis-auth-test)
46 | ;;; travis-auth-test.el ends here
47 |
--------------------------------------------------------------------------------
/test/travis-builds-test.el:
--------------------------------------------------------------------------------
1 | ;;; travis-builds-test.el --- Tests for Travis builds
2 |
3 | ;; Copyright (C) Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 |
25 | ;;(require 'travis-builds)b
26 |
27 | (ert-deftest test-travis-get-builds-for-repo ()
28 | (with-test-sandbox
29 | (travis--get-auth)
30 | (let ((response (travis--get-builds "nlamirault/scame")))
31 | ;;(message "Builds : %s" response)
32 | (should (vectorp (cdar response)))
33 | (mapc (lambda (b)
34 | ;; (message "Build : %s" b)
35 | (should (not (s-blank? (cdr (assoc 'message b)))))
36 | (should (not (s-blank? (cdr (assoc 'author_email b)))))
37 | (should (not (s-blank? (cdr (assoc 'author_name b)))))
38 | (should (numberp (cdr (assoc 'id b)))))
39 | (cdar response)))))
40 |
41 | (provide 'travis-builds-test)
42 | ;;; travis-builds-test.el ends here
43 |
--------------------------------------------------------------------------------
/test/travis-mode-test.el:
--------------------------------------------------------------------------------
1 | ;;; travis-mode-test.el --- Tests for Travis mode
2 |
3 | ;; Copyright (C) Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | ;; (require 'travis-mode)
25 |
26 |
27 | (ert-deftest test-travis-mode-projects-keybindings ()
28 | (with-test-sandbox
29 | (travis-projects-mode)
30 | (should (eql 'travis-goto-project
31 | (key-binding (kbd "w"))))))
32 |
33 | (ert-deftest test-travis-mode-show-projects ()
34 | (with-test-sandbox
35 | (travis-show-projects "nlamirault")
36 | (with-current-buffer "*Travis projects*"
37 | (let ((content (buffer-string)))
38 | (should (s-contains? "nlamirault/emacs-gitlab"
39 | content))
40 | (should (s-contains? "nlamirault/emacs-travis"
41 | content))))))
42 |
43 | ;; (ert-deftest test-travis-mode-builds-keybindings ()
44 | ;; (with-test-sandbox
45 | ;; (travis-project-builds-mode)
46 | ;; (should (eql 'travis-goto-project
47 | ;; (key-binding (kbd "w"))))))
48 |
49 | (ert-deftest test-travis-mode-show-project-builds ()
50 | (with-test-sandbox
51 | (travis-show-project-builds "nlamirault/emacs-travis")
52 | (with-current-buffer "*Travis builds*"
53 | (let ((content (buffer-string)))
54 | (should (s-contains? "Committer"
55 | content))))))
56 |
57 |
58 | (provide 'travis-mode-test)
59 | ;;; travis-mode-test.el ends here
60 |
--------------------------------------------------------------------------------
/test/travis-repos-test.el:
--------------------------------------------------------------------------------
1 | ;;; travis-repos-test.el --- Tests for Travis repositories
2 |
3 | ;; Copyright (C) Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | ;; (require 'travis-repos)
25 |
26 |
27 | (ert-deftest test-travis-get-repositories ()
28 | (with-test-sandbox
29 | (travis--get-auth)
30 | (let ((response (travis--get-repositories)))
31 | ;;(message "Response: %s" response)
32 | (should (vectorp (cdar response)))
33 | (mapc (lambda (r)
34 | ;;(message "repo: %s" r)
35 | (should (not (s-blank? (cdr (assoc 'slug r)))))
36 | (should (numberp (cdr (assoc 'id r)))))
37 | (cdar response)))))
38 |
39 | (ert-deftest test-travis-get-my-repositories ()
40 | (with-test-sandbox
41 | (travis--get-auth)
42 | (let ((response (travis--get-repository "nlamirault")))
43 | (mapc (lambda (r)
44 | ;; (message "repo: %s" r)
45 | (should (s-contains? "nlamirault/"
46 | (cdr (assoc 'slug r)))))
47 | (cdar response)))))
48 |
49 | (ert-deftest test-travis-get-single-repository ()
50 | (with-test-sandbox
51 | (travis--get-auth)
52 | (let ((response (travis--get-repository "nlamirault/scame")))
53 | ;; (message "Repo : %s" response)
54 | (should (not (vectorp (cdar response))))
55 | (should (string-equal "Emacs Lisp"
56 | (cdr (assoc 'github_language (cdar response)))))
57 | (should (numberp (cdr (assoc 'last_build_id (cdar response)))))
58 | (should (s-numeric? (cdr (assoc 'last_build_number (cdar response)))))
59 | (should (string-equal "nlamirault/scame"
60 | (cdr (assoc 'slug (cdar response))))))))
61 |
62 | (provide 'travis-repos-test)
63 | ;;; travis-repos-test.el ends here
64 |
--------------------------------------------------------------------------------
/test/travis-ui-test.el:
--------------------------------------------------------------------------------
1 | ;;; travis-ui-test.el --- Tests for UI Travis settings
2 |
3 | ;; Copyright (C) Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | ;; (require 'cl-lib)
25 |
26 |
27 | (defun extract-color-face (string)
28 | (cadr (text-properties-at 0 string)))
29 |
30 |
31 | (defun test-travis-face (state face faces)
32 | (let ((f (extract-color-face (colorize-build-state state))))
33 | (should (eq face f))
34 | (should (cl-find f faces))))
35 |
36 | (ert-deftest test-travis-ui-colors-states ()
37 | (with-test-sandbox
38 | (let ((faces (face-list)))
39 | (test-travis-face "canceled" 'travis--gray-face faces)
40 | (test-travis-face "created" 'travis--cyan-face faces)
41 | (test-travis-face "passed" 'travis--green-face faces)
42 | (test-travis-face "errored" 'travis--orange-face faces)
43 | (test-travis-face "failed" 'travis--red-face faces))))
44 |
45 |
46 | (provide 'travis-ui-test)
47 | ;;; travis-ui-test.el ends here
48 |
--------------------------------------------------------------------------------
/test/travis-users-test.el:
--------------------------------------------------------------------------------
1 | ;;; travis-users-test.el --- Tests for Travis tools
2 |
3 | ;; Copyright (C) Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | ;; (require 'travis-users)
25 |
26 | (ert-deftest test-travis-get-users ()
27 | (with-test-sandbox
28 | (travis--get-auth)
29 | (let ((response (travis--get-users)))
30 | ;; (message "Users Response: %s" response)
31 | (should (not (s-blank? (cdr (assoc 'locale (cdar response))))))
32 | (should (not (s-blank? (cdr (assoc 'email (cdar response))))))
33 | (should (not (s-blank? (cdr (assoc 'name (cdar response))))))
34 | (should (numberp (cdr (assoc 'id (cdar response)))))
35 | )))
36 |
37 | (provide 'travis-users-test)
38 | ;;; travis-users-test.el ends here
39 |
--------------------------------------------------------------------------------
/test/travis-utils-test.el:
--------------------------------------------------------------------------------
1 | ;;; travis-utils-test.el --- Tests for Travis tools
2 |
3 | ;; Copyright (C) Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | (require 's)
25 |
26 | ;; (require 'travis-utils)
27 |
28 | (ert-deftest test-travis-api-headers-without-authentication ()
29 | (with-test-sandbox
30 | (let ((headers (travis--get-headers))
31 | (version (travis--library-version))
32 | (token (getenv "TRAVIS_TOKEN")))
33 | (should (string-equal (s-concat "emacs-travis/" version)
34 | (assoc-default "User-Agent" headers)))
35 | (should (string-equal "application/vnd.travis-ci.2+json"
36 | (assoc-default "Accept" headers)))
37 | (should (eql nil (assoc-default "Authorization" headers))))))
38 |
39 |
40 | (provide 'travis-utils-test)
41 | ;;; travis-utils-test.el ends here
42 |
--------------------------------------------------------------------------------
/test/travis-version-test.el:
--------------------------------------------------------------------------------
1 | ;;; travis-version-test.el --- Tests for version information
2 |
3 | ;; Copyright (C) Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | (require 'pkg-info)
25 |
26 | (setq current-version "0.6.0")
27 |
28 | (ert-deftest travis-library-version ()
29 | (with-test-sandbox
30 | (should (string= current-version (travis--library-version)))))
31 |
32 | (ert-deftest emacs-travis-version ()
33 | (with-test-sandbox
34 | (should (string= current-version (emacs-travis-version)))))
35 |
36 |
37 | (provide 'travis-version-test)
38 | ;;; travis-version-test.el ends here
39 |
--------------------------------------------------------------------------------
/travis-api.el:
--------------------------------------------------------------------------------
1 | ;;; travis-api.el --- Travis API settings.
2 |
3 | ;; Copyright (C) 2014 Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | (defvar travis--host "https://api.travis-ci.org"
25 | "The Travis API endpoint.")
26 |
27 | (defvar travis--token-id nil
28 | "The Travis tokenID to perform HTTP requests.")
29 |
30 | (defconst travis--user-agent "emacs-travis"
31 | "The user agent for TravisAPI.")
32 |
33 |
34 | (provide 'travis-api)
35 | ;;; travis-api.el ends here
36 |
--------------------------------------------------------------------------------
/travis-auth.el:
--------------------------------------------------------------------------------
1 | ;;; travis-auth.el --- Travis AUTH settings.
2 |
3 | ;; Copyright (C) 2014 Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | (require 'travis-utils)
25 |
26 | (defun travis--get-auth ()
27 | "Retrieve auth."
28 | (let ((response
29 | (travis--perform-http-request "POST"
30 | "auth/github"
31 | (list (cons "github_token"
32 | (travis--get-github-token)))
33 | 200)))
34 | ;;(message "Auth response: %s" response)
35 | (let ((id (assoc-default 'access_token response)))
36 | ;; (message "Id : %s" id)
37 | (setq travis--token-id id))))
38 |
39 |
40 | (provide 'travis-auth)
41 | ;;; travis-auth.el ends here
42 |
--------------------------------------------------------------------------------
/travis-builds.el:
--------------------------------------------------------------------------------
1 | ;;; travis-builds.el --- Travis BUILDS settings.
2 |
3 | ;; Copyright (C) 2014 Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | (require 'travis-utils)
25 |
26 | (defun travis--get-builds (repo-id)
27 | "Retrieve builds for a repository using his REPO-ID."
28 | (travis--perform-http-request "GET"
29 | (s-concat "repos/" repo-id "/builds")
30 | nil
31 | 200))
32 |
33 |
34 | (provide 'travis-builds)
35 | ;;; travis-builds.el ends here
36 |
--------------------------------------------------------------------------------
/travis-mode.el:
--------------------------------------------------------------------------------
1 | ;; travis-mode.el --- Mode for Travis
2 |
3 | ;; Copyright (C) 2014 Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;; A major mode for Travis
23 |
24 | ;;; Code:
25 |
26 | ;;; Code:
27 |
28 | (require 'browse-url)
29 | (require 'cl-lib)
30 | (require 'tabulated-list)
31 |
32 | ;; Travis library
33 |
34 | (require 'travis-builds)
35 | (require 'travis-repos)
36 | (require 'travis-ui)
37 |
38 | (defconst travis-website "https://travis-ci.org/")
39 |
40 | ;; Actions
41 |
42 | (defun travis--open-travis-project (id)
43 | "Go to the Travis web page."
44 | (let ((project (travis--get-repository id)))
45 | (if project
46 | ;;(browse-url
47 | (message
48 | (concat travis-website
49 | (assoc-default 'slug (cdar project))))
50 | (message "Project not found: %s %s" id project))))
51 |
52 | (defun travis-goto-project ()
53 | (interactive)
54 | (travis--open-travis-project (tabulated-list-get-id)))
55 |
56 |
57 | ;; Projects
58 | ;; ----------
59 |
60 |
61 | (defvar travis--projects-mode-history nil)
62 |
63 | (defun travis-show-projects (slug)
64 | "Show Travis projects using user request SLUG."
65 | (interactive
66 | (list (read-from-minibuffer "Projects: "
67 | (car travis--projects-mode-history)
68 | nil
69 | nil
70 | 'travis--projects-mode-history)))
71 | (pop-to-buffer "*Travis projects*" nil)
72 | (travis-projects-mode)
73 | (setq tabulated-list-entries
74 | (travis--create-projects-entries (travis--get-repository slug)))
75 | (tabulated-list-print t))
76 |
77 |
78 | (defun travis--create-project-entry (p)
79 | (list (format "%s" (cdr (assoc 'id p)))
80 | (vector ;id
81 | ;;(cdr (assoc 'last_build_state p))
82 | (colorize-build-state (cdr (assoc 'last_build_state p)))
83 | (cdr (assoc 'slug p))
84 | (let ((desc (cdr (assoc 'description p))))
85 | (if desc
86 | desc
87 | "")))))
88 |
89 |
90 | (defun travis--create-projects-entries (projects)
91 | "Create entries for 'tabulated-list-entries from PROJECTS."
92 | (let ((data (cdar projects)))
93 | (if (eql 'vector (type-of data))
94 | (mapcar (lambda (p)
95 | (travis--create-project-entry p))
96 | data)
97 | (list (travis--create-project-entry data)))))
98 |
99 | ;; Travis projects mode
100 |
101 | (defvar travis-projects-mode-hook nil)
102 |
103 | (defvar travis-projects-mode-map
104 | (let ((map (make-keymap)))
105 | (define-key map (kbd "w") 'travis-goto-project)
106 | map)
107 | "Keymap for `travis-projects-mode' major mode.")
108 |
109 | (define-derived-mode travis-projects-mode tabulated-list-mode
110 | "Travis projects"
111 | "Major mode for browsing Travis projects."
112 | :group 'travis
113 | (setq tabulated-list-format [;("ID" 5 t)
114 | ("Status" 10 t)
115 | ("Name" 25 t)
116 | ("Description" 0 nil)
117 | ])
118 | (setq tabulated-list-padding 2)
119 | (setq tabulated-list-sort-key (cons "Name" nil))
120 | (tabulated-list-init-header))
121 |
122 |
123 | ;; Project builds
124 | ;; ---------------
125 |
126 | ;; Builds
127 |
128 | (defun travis--create-builds-entries (builds)
129 | "Create entries for 'tabulated-list-entries from BUILDS."
130 | (mapcar (lambda (b)
131 | ;(let ((id (number-to-string (cdr (assoc 'id b)))))
132 | (let ((id (format "%s" (cdr (assoc 'id b))))
133 | (duration (cdr (assoc 'duration b)))
134 | (finished (cdr (assoc 'finished_at b))))
135 | (list id
136 | (vector id
137 | (cdr (assoc 'number b))
138 | (colorize-build-state (cdr (assoc 'state b)))
139 | "Message"
140 | "Commit"
141 | "Committer"
142 | (if (numberp duration)
143 | (format-seconds "%m min %s sec" duration)
144 | "")
145 | (if (s-present? finished)
146 | finished
147 | "")))))
148 | (cl-cdadr builds)))
149 |
150 | (defvar travis--project-builds-mode-history nil)
151 |
152 | (defun travis-show-project-builds (slug)
153 | "Show Travis project builds using user request SLUG."
154 | (interactive
155 | (list (read-from-minibuffer "Project: "
156 | (car travis--projects-mode-history)
157 | nil
158 | nil
159 | 'travis--projects-mode-history)))
160 | (pop-to-buffer "*Travis builds*" nil)
161 | (travis-project-builds-mode)
162 | (setq tabulated-list-entries
163 | (travis--create-builds-entries (travis--get-builds slug)))
164 | (tabulated-list-print t))
165 |
166 |
167 | ;; Travis project builds mode
168 |
169 | (defvar travis-project-builds-mode-hook nil)
170 |
171 | (defvar travis-project-builds-mode-map
172 | (let ((map (make-keymap)))
173 | (define-key map (kbd "w") 'travis-goto-project)
174 | map)
175 | "Keymap for `travis-project-builds-mode' major mode.")
176 |
177 | (define-derived-mode travis-project-builds-mode tabulated-list-mode
178 | "Travis project buids"
179 | "Major mode for browsing Travis project builds."
180 | :group 'travis
181 | (setq tabulated-list-format [;("ID" 5 t)
182 | ("Build" 10 t)
183 | ("Number" 7 t)
184 | ("State" 10 t)
185 | ("Message" 25 t)
186 | ("Commit" 15 t)
187 | ("Committer" 10 nil)
188 | ("Duration" 15 nil)
189 | ("Finished" 15 nil)])
190 | (setq tabulated-list-padding 2)
191 | (setq tabulated-list-sort-key (cons "Build" nil))
192 | (tabulated-list-init-header))
193 |
194 |
195 | (provide 'travis-mode)
196 | ;;; travis-mode.el ends here
197 |
--------------------------------------------------------------------------------
/travis-repos.el:
--------------------------------------------------------------------------------
1 | ;;; travis-repos.el --- Travis REPOS settings.
2 |
3 | ;; Copyright (C) 2014 Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | (require 'travis-utils)
25 |
26 | (defun travis--get-repositories ()
27 | "Retrieve repository from his REPO-ID."
28 | (travis--perform-http-request "GET"
29 | "repos"
30 | nil
31 | 200))
32 |
33 |
34 | (defun travis--get-repository (repo-id)
35 | "Retrieve repository from his REPO-ID."
36 | (travis--perform-http-request "GET"
37 | (s-concat "repos/" repo-id)
38 | nil
39 | 200))
40 |
41 |
42 | (provide 'travis-repos)
43 | ;;; travis-repos.el ends here
44 |
--------------------------------------------------------------------------------
/travis-ui.el:
--------------------------------------------------------------------------------
1 | ;;; travis-ui.el --- Travis UI tools
2 |
3 | ;; Copyright (C) 2014 Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | ;;(require 'ansi)
25 | (require 'tabulated-list)
26 |
27 |
28 | ;;
29 | ;; to display faces in IELM :
30 | ;; ELISP (list-faces-display "travis")
31 | ;;
32 |
33 | ;; Faces
34 |
35 | (defface travis--title
36 | '((((class color) (background light)) :foreground "red" :weight semi-bold)
37 | (((class color) (background dark)) :foreground "green" :weight semi-bold))
38 | "face of Travis information"
39 | :group 'travis)
40 |
41 | (defface travis--gray-face
42 | '((((class color)) :foreground "#b1b6b6"))
43 | "Gray color.."
44 | :group 'travis)
45 |
46 | (defface travis--cyan-face
47 | '((((class color)) :foreground "#00ffff"))
48 | "Cyan color.."
49 | :group 'travis)
50 |
51 | (defface travis--yellow-face
52 | '((((class color)) :foreground "#e5e500"))
53 | "Yellow color."
54 | :group 'travis)
55 |
56 | (defface travis--orange-face
57 | '((((class color)) :foreground "#ff5500"))
58 | "Orange color.."
59 | :group 'travis)
60 |
61 | (defface travis--red-face
62 | '((((class color)) :foreground "#cd4d40"))
63 | "Red color.."
64 | :group 'travis)
65 |
66 | (defface travis--green-face
67 | '((((class color)) :foreground "#61b361"))
68 | "Green color."
69 | :group 'travis)
70 |
71 |
72 |
73 | (defun colorize-build-state (state)
74 | "Colorize face using STATE."
75 | (cond
76 | ((string= state "canceled")
77 | (propertize state 'face 'travis--gray-face))
78 | ((string= state "failed")
79 | (propertize state 'face 'travis--red-face))
80 | ((string= state "errored")
81 | (propertize state 'face 'travis--orange-face))
82 | ((string= state "passed")
83 | (propertize state 'face 'travis--green-face))
84 | ((string= state "created")
85 | (propertize state 'face 'travis--cyan-face))
86 | (t (propertize state 'face 'travis--gray-face))))
87 |
88 |
89 | ;; (defun colorize-dot (color)
90 | ;; (cond
91 | ;; ((string= color "red")
92 | ;; (propertize "●" 'face 'travis--red-face))
93 | ;; ((string= color "yellow")
94 | ;; (propertize "●" 'face 'travis--yellow-face))
95 | ;; ((string= color "green")
96 | ;; (propertize "●" 'face 'travis--green-face))
97 | ;; (t (concat "Unknown: " "'" color "' "))))
98 |
99 | (provide 'travis-ui)
100 | ;;; travis-ui.el ends here
101 |
--------------------------------------------------------------------------------
/travis-users.el:
--------------------------------------------------------------------------------
1 | ;;; travis-users.el --- Travis USERS settings.
2 |
3 | ;; Copyright (C) 2014 Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | (require 'travis-utils)
25 |
26 |
27 | (defun travis--get-users ()
28 | "Retrieve users."
29 | (travis--perform-http-request "GET" "users" nil 200))
30 |
31 |
32 | (provide 'travis-users)
33 | ;;; travis-users.el ends here
34 |
--------------------------------------------------------------------------------
/travis-utils.el:
--------------------------------------------------------------------------------
1 | ;;; travis-utils.el --- some tools
2 |
3 | ;; Copyright (C) 2014 Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | (require 'json)
25 | (require 'request)
26 | (require 's)
27 |
28 |
29 | (require 'travis-api)
30 | (require 'travis-version)
31 |
32 |
33 | ;; Errors
34 |
35 | (eval-and-compile
36 | (unless (fboundp 'define-error)
37 | ;; Shamelessly copied from Emacs trunk :)
38 | (defun define-error (name message &optional parent)
39 | "Define NAME as a new error signal.
40 | MESSAGE is a string that will be output to the echo area if such an error
41 | is signaled without being caught by a `condition-case'.
42 | PARENT is either a signal or a list of signals from which it inherits.
43 | Defaults to `error'."
44 | (unless parent (setq parent 'error))
45 | (let ((conditions
46 | (if (consp parent)
47 | (apply #'nconc
48 | (mapcar (lambda (parent)
49 | (cons parent
50 | (or (get parent 'error-conditions)
51 | (error "Unknown signal `%s'" parent))))
52 | parent))
53 | (cons parent (get parent 'error-conditions)))))
54 | (put name 'error-conditions
55 | (delete-dups (copy-sequence (cons name conditions))))
56 | (when message (put name 'error-message message))))))
57 |
58 | (define-error 'travis-error "Travis error")
59 |
60 | (define-error 'travis-http-error "HTTP Error" 'travis-error)
61 |
62 |
63 | ;; HTTP tools
64 |
65 | (defun travis--get-rest-uri (uri)
66 | "Retrieve the Travis API complete url using the API version.
67 | `URI` is the api path."
68 | (if travis--host
69 | (s-concat travis--host "/" uri)
70 | (error (signal 'travis-error '("Travis host unknown.")))))
71 |
72 |
73 | (defun travis--get-github-token ()
74 | "Retrieve the Travis token ID."
75 | (getenv "TRAVIS_TOKEN"))
76 |
77 |
78 | (defun travis--get-headers ()
79 | "Generate HTTP headers for Travis API."
80 | (let ((headers (list (cons "User-Agent"
81 | (s-concat travis--user-agent
82 | "/"
83 | (travis--library-version)))
84 | (cons "Accept"
85 | "application/vnd.travis-ci.2+json"))))
86 | (if travis--token-id
87 | (-snoc headers
88 | (cons "Authorization"
89 | (s-concat "token " travis--token-id)))
90 | headers)))
91 |
92 |
93 | (defun travis--perform-http-request (method uri params status-code)
94 | "Do a HTTP METHOD request using URI and PARAMS.
95 | If HTTP return code is STATUS-CODE, send the response content otherwise
96 | raise an error."
97 | (let ((response (request (travis--get-rest-uri uri)
98 | :type method
99 | :headers (travis--get-headers)
100 | :sync t
101 | :data params
102 | :parser 'json-read)))
103 | (if (= status-code (request-response-status-code response))
104 | (request-response-data response)
105 | (error
106 | (signal 'travis-http-error
107 | (list (request-response-status-code response)
108 | (request-response-data response)))))))
109 |
110 |
111 | (provide 'travis-utils)
112 | ;;; travis-utils.el ends here
113 |
--------------------------------------------------------------------------------
/travis-version.el:
--------------------------------------------------------------------------------
1 | ;;; travis-version.el --- Travis Emacs client version
2 |
3 | ;; Copyright (C) 2014, 2015 Nicolas Lamirault
4 |
5 | ;; This program is free software; you can redistribute it and/or
6 | ;; modify it under the terms of the GNU General Public License
7 | ;; as published by the Free Software Foundation; either version 2
8 | ;; of the License, or (at your option) any later version.
9 |
10 | ;; This program is distributed in the hope that it will be useful,
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | ;; GNU General Public License for more details.
14 |
15 | ;; You should have received a copy of the GNU General Public License
16 | ;; along with this program; if not, write to the Free Software
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | ;; 02110-1301, USA.
19 |
20 | ;;; Commentary:
21 |
22 | ;;; Code:
23 |
24 | (require 'dash)
25 | (require 'pkg-info)
26 |
27 |
28 | (defun travis--library-version ()
29 | "Get the version in the emacs-travis client header."
30 | (-when-let (version (pkg-info-library-version 'travis))
31 | (pkg-info-format-version version)))
32 |
33 |
34 | (provide 'travis-version)
35 | ;;; travis-version.el ends here
36 |
--------------------------------------------------------------------------------
/travis.el:
--------------------------------------------------------------------------------
1 | ;;; travis.el --- Emacs client for Travis
2 |
3 | ;; Author: Nicolas Lamirault
4 | ;; URL: https://github.com/nlamirault/emacs-travis
5 | ;; Version: 0.6.0
6 | ;; Keywords: travis
7 |
8 | ;; Package-Requires: ((s "1.9.0") (dash "2.9.0") (pkg-info "0.5.0") (request "0.1.0"))
9 |
10 | ;; Copyright (C) 2014 Nicolas Lamirault
11 |
12 | ;; This program is free software; you can redistribute it and/or
13 | ;; modify it under the terms of the GNU General Public License
14 | ;; as published by the Free Software Foundation; either version 2
15 | ;; of the License, or (at your option) any later version.
16 |
17 | ;; This program is distributed in the hope that it will be useful,
18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | ;; GNU General Public License for more details.
21 |
22 | ;; You should have received a copy of the GNU General Public License
23 | ;; along with this program; if not, write to the Free Software
24 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 | ;; 02110-1301, USA.
26 |
27 | ;;; Commentary:
28 |
29 | ;; Provides a Travis client for Emacs.
30 |
31 | ;;; Installation:
32 |
33 | ;; Available as a package in melpa.milkbox.net.
34 |
35 | ;; (add-to-list 'package-archives
36 | ;; '("melpa" . "http://melpa.milkbox.net/packages/") t)
37 | ;;
38 | ;; M-x package-install travis
39 |
40 | ;;; Usage:
41 |
42 | ;;; Code:
43 |
44 | (require 's)
45 |
46 | ;; Customization
47 |
48 | (defgroup emacs-travis nil
49 | "Travis client for Emacs."
50 | :group 'applications
51 | :link '(url-link :tag "Github" "https://github.com/nlamirault/emacs-travis")
52 | :link '(emacs-commentary-link :tag "Commentary" "emacs-travis"))
53 |
54 | ;; Travis library
55 |
56 | (require 'travis-version)
57 | (require 'travis-utils)
58 | (require 'travis-ui)
59 | (require 'travis-auth)
60 | (require 'travis-users)
61 | (require 'travis-repos)
62 | (require 'travis-builds)
63 | (require 'travis-mode)
64 |
65 |
66 | ;;;###autoload
67 | (defun emacs-travis-version (&optional show-version)
68 | "Get the emacs-travis version as string.
69 | If called interactively or if SHOW-VERSION is non-nil, show the
70 | version in the echo area and the messages buffer.
71 | The returned string includes both, the version from package.el
72 | and the library version, if both a present and different.
73 | If the version number could not be determined, signal an error,
74 | if called interactively, or if SHOW-VERSION is non-nil, otherwise
75 | just return nil."
76 | (interactive (list (not (or executing-kbd-macro noninteractive))))
77 | (let* ((version (travis--library-version)))
78 | (unless version
79 | (error "Could not find out emacs-travis version"))
80 | (message "emacs-travis %s" version)
81 | version))
82 |
83 |
84 | (provide 'travis)
85 | ;;; travis.el ends here
86 |
--------------------------------------------------------------------------------
/vagrant/provision.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Title : Vagrant provision
4 | # Description : Install Emacs for emacs-travis tests
5 | # ------------------------------------------------------
6 |
7 | TOKEN=$1
8 | # echo "Token : $TOKEN"
9 |
10 | CASK_VERSION='0.6.0'
11 |
12 | ppa () {
13 | sudo apt-add-repository -y "$1"
14 | }
15 |
16 | apt_update () {
17 | sudo apt-get update -qq
18 | }
19 |
20 | apt () {
21 | sudo apt-get install -yy "$@"
22 | }
23 |
24 | # Silence debconf
25 | export DEBIAN_FRONTEND='noninteractive'
26 |
27 | # Bring in the necessary PPAs
28 | ppa ppa:ubuntu-elisp/ppa
29 | apt_update
30 |
31 | # Install Emacs 24.x and Emacs snapshot
32 | apt emacs24 emacs24-el emacs24-common-non-dfsg \
33 | emacs-snapshot emacs-snapshot-el
34 |
35 | # Install Cask for Emacs dependency management
36 | CASK_DIR=/opt/cask-$CASK_VERSION
37 | if ! [ -d "$CASK_DIR" -a -x "/$CASK_DIR/bin/cask" ]; then
38 | sudo rm -rf "$CASK_DIR"
39 | wget -O - https://github.com/cask/cask/archive/v$CASK_VERSION.tar.gz | sudo tar xz -C /opt
40 | sudo ln -fs "$CASK_DIR/bin/cask" /usr/local/bin
41 | fi
42 |
43 | echo "#!/bin/bash" > /tmp/.emacs-travis.rc
44 | echo "" >> /tmp/.emacs-travis.rc
45 | echo "export TRAVIS_TOKEN=\"$TOKEN\"" >> /tmp/.emacs-travis.rc
46 |
--------------------------------------------------------------------------------
/wercker.yml:
--------------------------------------------------------------------------------
1 | box: wercker-labs/docker
2 | build:
3 | steps:
4 | - script:
5 | name: dependencies
6 | code: |
7 | sudo add-apt-repository -y ppa:cassou/emacs
8 | sudo add-apt-repository -y ppa:ubuntu-elisp/ppa
9 | sudo apt-get update -qq
10 | sudo apt-get install -qq -yy emacs24-nox
11 | curl -fsSkL https://raw.github.com/cask/cask/master/go | python
12 | export PATH="${HOME}/.cask/bin:$PATH"
13 | - script:
14 | name: initialize
15 | code: |
16 | make init elpa
17 | - script:
18 | name: tests
19 | code: |
20 | make ci
21 |
--------------------------------------------------------------------------------