temporary_directory 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7ce91f96da436d8901e07f982d8736a1c87bc94d
4
+ data.tar.gz: 6375921dda9418de7fb7b5bb59c25b217b41f590
5
+ SHA512:
6
+ metadata.gz: 411feed805f0fa06db42da47cc0d16d1401379525a63e2bf9a5473cd4f7216ff2777d3e61ba35fd2388e9fff7920fba0bb69c14c5efeb8f7cfa7eba95398d163
7
+ data.tar.gz: 4cfd8919efa569537a801e1c1cb06629ba6222192fac43bb8d2603db3614e9ec287e0421349654784c87943114342530b6f45e0e88fdf158c95f8179dc81eee4
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,12 @@
1
+ # Project metadata
2
+ /nbproject
3
+ /.idea
4
+
5
+ /Gemfile.lock
6
+
7
+ /doc/api
8
+ /coverage
9
+ /pkg
10
+ /.yardoc
11
+ .rbx
12
+ *.rbc
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --order random
4
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.2.0
5
+ - 2.3.0
6
+ - rbx-2
7
+ - jruby-19mode
@@ -0,0 +1,9 @@
1
+ --output-dir=doc/api
2
+ --embed-mixins
3
+ --protected
4
+ --no-private
5
+ --markup-provider=kramdown
6
+ --markup=markdown
7
+ -
8
+ HISTORY.md
9
+ LICENSE.md
data/Gemfile ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
4
+
5
+ This file is part of TemporaryDirectory.
6
+
7
+ Permission to use, copy, modify, and/or distribute this software for any
8
+ purpose with or without fee is hereby granted, provided that the above
9
+ copyright notice and this permission notice appear in all copies.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
13
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ =end
19
+
20
+ source 'https://rubygems.org'
21
+
22
+ # Gem dependencies are specified in the .gemspec file
23
+ gemspec
24
+
25
+ gem 'coveralls', require: false
@@ -0,0 +1,4 @@
1
+ 0.1.0 / 2016-09-04
2
+
3
+ 1 major enhancement
4
+ Birthday!
@@ -0,0 +1,15 @@
1
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
2
+
3
+ TemporaryDirectory is licensed under the following ISC-style license:
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,219 @@
1
+ TemporaryDirectory
2
+ ==================
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/temporary_directory.png)](https://badge.fury.io/rb/temporary_directory)
5
+ [![Dependency Status](https://gemnasium.com/godobject/temporary_directory.png)](https://gemnasium.com/godobject/temporary_directory)
6
+ [![Code Climate](https://codeclimate.com/github/godobject/temporary_directory.png)](https://codeclimate.com/github/godobject/temporary_directory)
7
+ [![Build Status](https://secure.travis-ci.org/godobject/temporary_directory.png)](https://secure.travis-ci.org/godobject/temporary_directory)
8
+ [![Coverage Status](https://coveralls.io/repos/github/godobject/temporary_directory/badge.svg?branch=master)](https://coveralls.io/github/godobject/temporary_directory?branch=master)
9
+
10
+ * [Documentation][docs]
11
+ * [Project][project]
12
+
13
+ [docs]: http://rdoc.info/github/godobject/temporary_directory/
14
+ [project]: https://github.com/godobject/temporary_directory/
15
+
16
+ Description
17
+ -----------
18
+
19
+ TemporaryDirectory is a Ruby library that contains a service class that
20
+ creates temporary directories and returns Pathname objects to work with them.
21
+ Additionally a helper module for RSpec and Cucumber provides temporary
22
+ directories for examples and scenarios.
23
+
24
+ Features / Problems
25
+ -------------------
26
+
27
+ This project tries to conform to:
28
+
29
+ * [Semantic Versioning (2.0.0)][semver]
30
+ * [Ruby Packaging Standard (0.5-draft)][rps]
31
+ * [Ruby Style Guide][style]
32
+ * [Gem Packaging: Best Practices][gem]
33
+
34
+ [semver]: http://semver.org/spec/v2.0.0.html
35
+ [rps]: http://chneukirchen.github.com/rps/
36
+ [style]: https://github.com/bbatsov/ruby-style-guide
37
+ [gem]: http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices
38
+
39
+ Additional facts:
40
+
41
+ * Written purely in Ruby.
42
+ * Documented with Cucumber.
43
+ * Automatically testable through Cucumber and RSpec.
44
+ * Intended to be used with Ruby 2.1.8 or higher.
45
+ * Cryptographically signed git tags.
46
+
47
+ Requirements
48
+ ------------
49
+
50
+ * Ruby 2.1.8 or higher
51
+
52
+ Installation
53
+ ------------
54
+
55
+ On *nix systems you may need to prefix the command with `sudo` to get root
56
+ privileges.
57
+
58
+ ### Gem
59
+
60
+ gem install temporary_directory
61
+
62
+ ### Automated testing
63
+
64
+ Go into the root directory of the installed gem and run the following command
65
+ to fetch all development dependencies:
66
+
67
+ bundle
68
+
69
+ Afterwards start the test runner:
70
+
71
+ rake spec
72
+
73
+ If something goes wrong you should be notified through failing examples.
74
+
75
+ Usage
76
+ -----
77
+
78
+ This documentation defines the public interface of the software. The version
79
+ number of the software tracks changes to this public interface as described in
80
+ [Semantic Versioning][semver]. Do not use elements that are marked as private.
81
+ These elements are not guaranteed to exist in otherwise compatible future
82
+ versions. Should you really need some parts that are currently marked as
83
+ private, please contact us. We might be able to expose them as public
84
+ interface for your convenience.
85
+
86
+ This is still experimental software, even the public interface may change
87
+ substantially in future releases.
88
+
89
+ [semver]: http://semver.org/spec/v2.0.0.html
90
+
91
+ ### Ruby interface
92
+
93
+ #### Loading
94
+
95
+ In most cases you want to load the code by using the following command:
96
+
97
+ ~~~~~ ruby
98
+ require 'temporary_directory'
99
+ ~~~~~
100
+
101
+ In a bundler Gemfile you should use the following:
102
+
103
+ ~~~~~ ruby
104
+ gem 'temporary_directory'
105
+ ~~~~~
106
+
107
+ #### Namespace
108
+
109
+ This project is contained within a namespace to avoid name collisions with
110
+ other code. If you do not want to specifiy the namespace explicitly you can
111
+ include it into the current scope by executing the following statement:
112
+
113
+ ~~~~~ ruby
114
+ include GodObject::TemporaryDirectory
115
+ ~~~~~
116
+
117
+ Development
118
+ -----------
119
+
120
+ ### Bug reports and feature requests
121
+
122
+ Please use the [issue tracker][issues] on github.com to let me know about errors
123
+ or ideas for improvement of this software.
124
+
125
+ [issues]: https://github.com/godobject/temporary_directory/issues/
126
+
127
+ ### Source code
128
+
129
+ #### Distribution
130
+
131
+ This software is developed in the source code management system Git. There are
132
+ several synchronized mirror repositories available:
133
+
134
+ * [GitHub][github] (located in California, USA)
135
+
136
+ URI: https://github.com/godobject/temporary_directory.git
137
+
138
+ * [GitLab][gitlab] (located in Illinois, USA)
139
+
140
+ URI: https://gitlab.com/godobject/temporary_directory.git
141
+
142
+ * [BitBucket][bitbucket] (located in California, USA)
143
+
144
+ URI: https://bitbucket.org/godobject/temporary_directory.git
145
+
146
+ * [Pikacode][pikacode] (located in France)
147
+
148
+ URI: https://pikacode.com/godobject/temporary_directory.git
149
+
150
+ [github]: https://github.com/godobject/temporary_directory/
151
+ [gitlab]: https://gitlab.com/godobject/temporary_directory/
152
+ [bitbucket]: https://bitbucket.org/godobject/temporary_directory/
153
+ [pikacode]: https://pikacode.com/godobject/temporary_directory/
154
+
155
+ You can get the latest source code with the following command, while
156
+ exchanging the placeholder for one of the mirror URIs:
157
+
158
+ git clone MIRROR_URI
159
+
160
+ #### Tags and cryptographic verification
161
+
162
+ The final commit before each released gem version will be marked by a tag
163
+ named like the version with a prefixed lower-case "v". Every tag will be signed
164
+ by Alexander E. Fischer's [OpenPGP public key][openpgp] which enables you to
165
+ verify your copy of the code cryptographically.
166
+
167
+ [openpgp]: https://aef.name/crypto/aef-openpgp.asc
168
+
169
+ Add the key to your GnuPG keyring by the following command:
170
+
171
+ gpg --import aef-openpgp.asc
172
+
173
+ This command will tell you if your code is of integrity and authentic:
174
+
175
+ git tag --verify [TAG NAME]
176
+
177
+ #### Building gems
178
+
179
+ To package your state of the source code into a gem package use the following
180
+ command:
181
+
182
+ rake build
183
+
184
+ The gem will be generated according to the .gemspec file in the project root
185
+ directory and will be placed into the pkg/ directory.
186
+
187
+ ### Contribution
188
+
189
+ Help on making this software better is always very appreciated. If you want
190
+ your changes to be included in the official release, please clone the project
191
+ on github.com, create a named branch to commit, push your changes into it and
192
+ send a pull request afterwards.
193
+
194
+ Please make sure to write tests for your changes so that no one else will break
195
+ them when changing other things. Also notice that an inclusion of your changes
196
+ cannot be guaranteed before reviewing them.
197
+
198
+ The following people were involved in development:
199
+
200
+ * Alexander E. Fischer <aef@godobject.net>
201
+
202
+ License
203
+ -------
204
+
205
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
206
+
207
+ This file is part of TemporaryDirectory.
208
+
209
+ Permission to use, copy, modify, and/or distribute this software for any
210
+ purpose with or without fee is hereby granted, provided that the above
211
+ copyright notice and this permission notice appear in all copies.
212
+
213
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
214
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
215
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
216
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
217
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
218
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
219
+ PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
4
+
5
+ This file is part of TemporaryDirectory.
6
+
7
+ Permission to use, copy, modify, and/or distribute this software for any
8
+ purpose with or without fee is hereby granted, provided that the above
9
+ copyright notice and this permission notice appear in all copies.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
13
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ =end
19
+
20
+ require 'bundler/gem_tasks'
21
+ require 'rake'
22
+ require 'pathname'
23
+ require 'yard'
24
+ require 'rspec/core/rake_task'
25
+ require 'cucumber/rake/task'
26
+
27
+ RSpec::Core::RakeTask.new
28
+ Cucumber::Rake::Task.new
29
+
30
+ desc 'Run RSpec code examples and Cucumber features'
31
+ task :test => [:spec, :cucumber]
32
+
33
+ YARD::Rake::YardocTask.new('doc')
34
+
35
+ desc 'Removes temporary project files'
36
+ task :clean do
37
+ %w{doc/api coverage pkg .yardoc .rbx Gemfile.lock}.map{|name| Pathname.new(name) }.each do |path|
38
+ path.rmtree if path.exist?
39
+ end
40
+
41
+ Pathname.glob('*.gem').each(&:delete)
42
+ Pathname.glob('**/*.rbc').each(&:delete)
43
+ end
44
+
45
+ desc 'Opens an interactive console with the project code loaded'
46
+ task :console do
47
+ Bundler.setup
48
+ require 'pry'
49
+ require 'temporary_directory'
50
+ Pry.start(GodObject::TemporaryDirectory)
51
+ end
52
+
53
+ task default: :test
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
4
+
5
+ This file is part of TemporaryDirectory.
6
+
7
+ Permission to use, copy, modify, and/or distribute this software for any
8
+ purpose with or without fee is hereby granted, provided that the above
9
+ copyright notice and this permission notice appear in all copies.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
13
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ =end
19
+
20
+ When(/^I run "cucumber ?([^"]*)?"$/) do |arguments|
21
+ create_gemfile(include_gems: %w(cucumber))
22
+ create_root_for_subsequent_temporary_directories
23
+
24
+ execute_in_separate_environment(
25
+ %(TMPDIR="#{subsequent_temporary_directory_root_directory}" bundle exec cucumber #{arguments})
26
+ )
27
+ end
28
+
29
+ Then(/^all scenarios and their steps should pass$/) do
30
+ puts output unless $CHILD_STATUS.success?
31
+
32
+ expect($CHILD_STATUS).to be_success
33
+ expect(output).not_to match /failed|skipped/
34
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
4
+
5
+ This file is part of TemporaryDirectory.
6
+
7
+ Permission to use, copy, modify, and/or distribute this software for any
8
+ purpose with or without fee is hereby granted, provided that the above
9
+ copyright notice and this permission notice appear in all copies.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
13
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ =end
19
+
20
+ When(/^I run "rspec ([^"]*)"$/) do |arguments|
21
+ create_gemfile(include_gems: %w(rspec))
22
+ create_root_for_subsequent_temporary_directories
23
+
24
+ execute_in_separate_environment(
25
+ %(TMPDIR="#{subsequent_temporary_directory_root_directory}" bundle exec rspec #{arguments})
26
+ )
27
+ end
28
+
29
+ Then(/^all examples should pass$/) do
30
+ puts output unless $CHILD_STATUS.success?
31
+
32
+ expect($CHILD_STATUS).to be_success
33
+ expect(output).to include '0 failures'
34
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
4
+
5
+ This file is part of TemporaryDirectory.
6
+
7
+ Permission to use, copy, modify, and/or distribute this software for any
8
+ purpose with or without fee is hereby granted, provided that the above
9
+ copyright notice and this permission notice appear in all copies.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
13
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ =end
19
+
20
+ Given(/^a file called "([^"]*)" with the following content:$/) do |relative_path, file_content|
21
+ file = temporary_directory / relative_path
22
+ file.parent.mkpath
23
+ file.write(file_content)
24
+ end