spade-packager 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.gitmodules +6 -0
- data/bin/spadepkg +8 -0
- data/lib/libgems_ext.rb +8 -0
- data/lib/libgems_ext/config_file.rb +33 -0
- data/lib/libgems_ext/dependency_installer.rb +150 -0
- data/lib/libgems_ext/installer.rb +39 -0
- data/lib/libgems_ext/libgems.rb +39 -0
- data/lib/libgems_ext/spec_fetcher.rb +11 -0
- data/lib/spade-packager.rb +1 -0
- data/lib/spade/packager.rb +18 -0
- data/lib/spade/packager/cli.rb +9 -0
- data/lib/spade/packager/cli/base.rb +196 -0
- data/lib/spade/packager/cli/owner.rb +46 -0
- data/lib/spade/packager/cli/project_generator.rb +117 -0
- data/lib/spade/packager/credentials.rb +38 -0
- data/lib/spade/packager/local.rb +50 -0
- data/lib/spade/packager/package.rb +160 -0
- data/lib/spade/packager/remote.rb +98 -0
- data/lib/spade/packager/repository.rb +18 -0
- data/lib/spade/packager/version.rb +5 -0
- data/packages/coffee-script/.gitignore +8 -0
- data/packages/coffee-script/.npmignore +11 -0
- data/packages/coffee-script/Cakefile +229 -0
- data/packages/coffee-script/LICENSE +22 -0
- data/packages/coffee-script/README +47 -0
- data/packages/coffee-script/Rakefile +78 -0
- data/packages/coffee-script/bin/cake +7 -0
- data/packages/coffee-script/bin/coffee +7 -0
- data/packages/coffee-script/documentation/coffee/aliases.coffee +11 -0
- data/packages/coffee-script/documentation/coffee/array_comprehensions.coffee +2 -0
- data/packages/coffee-script/documentation/coffee/block_comment.coffee +6 -0
- data/packages/coffee-script/documentation/coffee/cake_tasks.coffee +9 -0
- data/packages/coffee-script/documentation/coffee/classes.coffee +25 -0
- data/packages/coffee-script/documentation/coffee/comparisons.coffee +5 -0
- data/packages/coffee-script/documentation/coffee/conditionals.coffee +13 -0
- data/packages/coffee-script/documentation/coffee/default_args.coffee +8 -0
- data/packages/coffee-script/documentation/coffee/do.coffee +4 -0
- data/packages/coffee-script/documentation/coffee/embedded.coffee +5 -0
- data/packages/coffee-script/documentation/coffee/existence.coffee +10 -0
- data/packages/coffee-script/documentation/coffee/expressions.coffee +9 -0
- data/packages/coffee-script/documentation/coffee/expressions_assignment.coffee +3 -0
- data/packages/coffee-script/documentation/coffee/expressions_comprehension.coffee +3 -0
- data/packages/coffee-script/documentation/coffee/expressions_try.coffee +7 -0
- data/packages/coffee-script/documentation/coffee/fat_arrow.coffee +6 -0
- data/packages/coffee-script/documentation/coffee/functions.coffee +2 -0
- data/packages/coffee-script/documentation/coffee/heredocs.coffee +7 -0
- data/packages/coffee-script/documentation/coffee/heregexes.coffee +11 -0
- data/packages/coffee-script/documentation/coffee/interpolation.coffee +6 -0
- data/packages/coffee-script/documentation/coffee/multiple_return_values.coffee +7 -0
- data/packages/coffee-script/documentation/coffee/object_comprehensions.coffee +4 -0
- data/packages/coffee-script/documentation/coffee/object_extraction.coffee +13 -0
- data/packages/coffee-script/documentation/coffee/objects_and_arrays.coffee +19 -0
- data/packages/coffee-script/documentation/coffee/objects_reserved.coffee +5 -0
- data/packages/coffee-script/documentation/coffee/overview.coffee +28 -0
- data/packages/coffee-script/documentation/coffee/parallel_assignment.coffee +6 -0
- data/packages/coffee-script/documentation/coffee/patterns_and_splats.coffee +7 -0
- data/packages/coffee-script/documentation/coffee/prototypes.coffee +3 -0
- data/packages/coffee-script/documentation/coffee/range_comprehensions.coffee +2 -0
- data/packages/coffee-script/documentation/coffee/scope.coffee +5 -0
- data/packages/coffee-script/documentation/coffee/slices.coffee +7 -0
- data/packages/coffee-script/documentation/coffee/soaks.coffee +1 -0
- data/packages/coffee-script/documentation/coffee/splats.coffee +27 -0
- data/packages/coffee-script/documentation/coffee/splices.coffee +5 -0
- data/packages/coffee-script/documentation/coffee/strings.coffee +8 -0
- data/packages/coffee-script/documentation/coffee/switch.coffee +10 -0
- data/packages/coffee-script/documentation/coffee/try.coffee +8 -0
- data/packages/coffee-script/documentation/coffee/while.coffee +10 -0
- data/packages/coffee-script/documentation/css/docs.css +374 -0
- data/packages/coffee-script/documentation/css/idle.css +64 -0
- data/packages/coffee-script/documentation/docs/browser.html +25 -0
- data/packages/coffee-script/documentation/docs/cake.html +43 -0
- data/packages/coffee-script/documentation/docs/coffee-script.html +51 -0
- data/packages/coffee-script/documentation/docs/command.html +161 -0
- data/packages/coffee-script/documentation/docs/docco.css +186 -0
- data/packages/coffee-script/documentation/docs/grammar.html +399 -0
- data/packages/coffee-script/documentation/docs/helpers.html +31 -0
- data/packages/coffee-script/documentation/docs/index.html +3 -0
- data/packages/coffee-script/documentation/docs/lexer.html +490 -0
- data/packages/coffee-script/documentation/docs/nodes.html +1338 -0
- data/packages/coffee-script/documentation/docs/optparse.html +78 -0
- data/packages/coffee-script/documentation/docs/repl.html +24 -0
- data/packages/coffee-script/documentation/docs/rewriter.html +251 -0
- data/packages/coffee-script/documentation/docs/scope.html +54 -0
- data/packages/coffee-script/documentation/docs/underscore.html +295 -0
- data/packages/coffee-script/documentation/images/background.png +0 -0
- data/packages/coffee-script/documentation/images/banding.png +0 -0
- data/packages/coffee-script/documentation/images/button_bg.png +0 -0
- data/packages/coffee-script/documentation/images/button_bg_dark.gif +0 -0
- data/packages/coffee-script/documentation/images/button_bg_green.gif +0 -0
- data/packages/coffee-script/documentation/images/favicon.ico +0 -0
- data/packages/coffee-script/documentation/images/logo.png +0 -0
- data/packages/coffee-script/documentation/images/screenshadow.png +0 -0
- data/packages/coffee-script/documentation/index.html.erb +1607 -0
- data/packages/coffee-script/documentation/js/aliases.js +17 -0
- data/packages/coffee-script/documentation/js/array_comprehensions.js +6 -0
- data/packages/coffee-script/documentation/js/block_comment.js +4 -0
- data/packages/coffee-script/documentation/js/cake_tasks.js +10 -0
- data/packages/coffee-script/documentation/js/classes.js +44 -0
- data/packages/coffee-script/documentation/js/comparisons.js +3 -0
- data/packages/coffee-script/documentation/js/conditionals.js +12 -0
- data/packages/coffee-script/documentation/js/default_args.js +7 -0
- data/packages/coffee-script/documentation/js/do.js +10 -0
- data/packages/coffee-script/documentation/js/embedded.js +4 -0
- data/packages/coffee-script/documentation/js/existence.js +6 -0
- data/packages/coffee-script/documentation/js/expressions.js +15 -0
- data/packages/coffee-script/documentation/js/expressions_assignment.js +2 -0
- data/packages/coffee-script/documentation/js/expressions_comprehension.js +9 -0
- data/packages/coffee-script/documentation/js/expressions_try.js +7 -0
- data/packages/coffee-script/documentation/js/fat_arrow.js +9 -0
- data/packages/coffee-script/documentation/js/functions.js +7 -0
- data/packages/coffee-script/documentation/js/heredocs.js +2 -0
- data/packages/coffee-script/documentation/js/heregexes.js +2 -0
- data/packages/coffee-script/documentation/js/interpolation.js +4 -0
- data/packages/coffee-script/documentation/js/multiple_return_values.js +5 -0
- data/packages/coffee-script/documentation/js/object_comprehensions.js +15 -0
- data/packages/coffee-script/documentation/js/object_extraction.js +10 -0
- data/packages/coffee-script/documentation/js/objects_and_arrays.js +17 -0
- data/packages/coffee-script/documentation/js/objects_reserved.js +4 -0
- data/packages/coffee-script/documentation/js/overview.js +35 -0
- data/packages/coffee-script/documentation/js/parallel_assignment.js +4 -0
- data/packages/coffee-script/documentation/js/patterns_and_splats.js +4 -0
- data/packages/coffee-script/documentation/js/prototypes.js +3 -0
- data/packages/coffee-script/documentation/js/range_comprehensions.js +9 -0
- data/packages/coffee-script/documentation/js/scope.js +8 -0
- data/packages/coffee-script/documentation/js/slices.js +4 -0
- data/packages/coffee-script/documentation/js/soaks.js +2 -0
- data/packages/coffee-script/documentation/js/splats.js +15 -0
- data/packages/coffee-script/documentation/js/splices.js +3 -0
- data/packages/coffee-script/documentation/js/strings.js +2 -0
- data/packages/coffee-script/documentation/js/switch.js +23 -0
- data/packages/coffee-script/documentation/js/try.js +8 -0
- data/packages/coffee-script/documentation/js/while.js +18 -0
- data/packages/coffee-script/documentation/vendor/jquery-1.4.2.js +6240 -0
- data/packages/coffee-script/examples/beautiful_code/binary_search.coffee +16 -0
- data/packages/coffee-script/examples/beautiful_code/quicksort_runtime.coffee +13 -0
- data/packages/coffee-script/examples/beautiful_code/regular_expression_matcher.coffee +34 -0
- data/packages/coffee-script/examples/blocks.coffee +54 -0
- data/packages/coffee-script/examples/code.coffee +167 -0
- data/packages/coffee-script/examples/computer_science/README +4 -0
- data/packages/coffee-script/examples/computer_science/binary_search.coffee +25 -0
- data/packages/coffee-script/examples/computer_science/bubble_sort.coffee +11 -0
- data/packages/coffee-script/examples/computer_science/linked_list.coffee +108 -0
- data/packages/coffee-script/examples/computer_science/luhn_algorithm.coffee +36 -0
- data/packages/coffee-script/examples/computer_science/merge_sort.coffee +19 -0
- data/packages/coffee-script/examples/computer_science/selection_sort.coffee +23 -0
- data/packages/coffee-script/examples/poignant.coffee +181 -0
- data/packages/coffee-script/examples/potion.coffee +206 -0
- data/packages/coffee-script/examples/underscore.coffee +682 -0
- data/packages/coffee-script/examples/web_server.coffee +12 -0
- data/packages/coffee-script/extras/EXTRAS +7 -0
- data/packages/coffee-script/extras/coffee-script.js +8 -0
- data/packages/coffee-script/extras/jsl.conf +44 -0
- data/packages/coffee-script/index.html +2515 -0
- data/packages/coffee-script/lib/browser.js +52 -0
- data/packages/coffee-script/lib/cake.js +76 -0
- data/packages/coffee-script/lib/coffee-script.js +82 -0
- data/packages/coffee-script/lib/command.js +263 -0
- data/packages/coffee-script/lib/grammar.js +581 -0
- data/packages/coffee-script/lib/helpers.js +66 -0
- data/packages/coffee-script/lib/index.js +8 -0
- data/packages/coffee-script/lib/lexer.js +633 -0
- data/packages/coffee-script/lib/nodes.js +2165 -0
- data/packages/coffee-script/lib/optparse.js +111 -0
- data/packages/coffee-script/lib/parser.js +649 -0
- data/packages/coffee-script/lib/repl.js +42 -0
- data/packages/coffee-script/lib/rewriter.js +353 -0
- data/packages/coffee-script/lib/scope.js +120 -0
- data/packages/coffee-script/lib/spade-format.js +45 -0
- data/packages/coffee-script/package.json +26 -0
- data/packages/coffee-script/src/browser.coffee +43 -0
- data/packages/coffee-script/src/cake.coffee +69 -0
- data/packages/coffee-script/src/coffee-script.coffee +92 -0
- data/packages/coffee-script/src/command.coffee +214 -0
- data/packages/coffee-script/src/grammar.coffee +590 -0
- data/packages/coffee-script/src/helpers.coffee +56 -0
- data/packages/coffee-script/src/index.coffee +2 -0
- data/packages/coffee-script/src/lexer.coffee +653 -0
- data/packages/coffee-script/src/nodes.coffee +1754 -0
- data/packages/coffee-script/src/optparse.coffee +99 -0
- data/packages/coffee-script/src/repl.coffee +42 -0
- data/packages/coffee-script/src/rewriter.coffee +326 -0
- data/packages/coffee-script/src/scope.coffee +94 -0
- data/packages/coffee-script/test/arguments.coffee +127 -0
- data/packages/coffee-script/test/assignment.coffee +98 -0
- data/packages/coffee-script/test/break.coffee +18 -0
- data/packages/coffee-script/test/comments.coffee +201 -0
- data/packages/coffee-script/test/conditionals.coffee +181 -0
- data/packages/coffee-script/test/exception_handling.coffee +90 -0
- data/packages/coffee-script/test/helpers.coffee +96 -0
- data/packages/coffee-script/test/importing.coffee +18 -0
- data/packages/coffee-script/test/operators.coffee +225 -0
- data/packages/coffee-script/test/ranges_slices_and_splices.coffee +186 -0
- data/packages/coffee-script/test/regular_expressions.coffee +56 -0
- data/packages/coffee-script/test/test.html +123 -0
- data/packages/coffee-script/test/test_chaining.coffee +77 -0
- data/packages/coffee-script/test/test_classes.coffee +372 -0
- data/packages/coffee-script/test/test_compilation.coffee +26 -0
- data/packages/coffee-script/test/test_comprehensions.coffee +318 -0
- data/packages/coffee-script/test/test_existence.coffee +165 -0
- data/packages/coffee-script/test/test_functions.coffee +379 -0
- data/packages/coffee-script/test/test_heredocs.coffee +111 -0
- data/packages/coffee-script/test/test_literals.coffee +270 -0
- data/packages/coffee-script/test/test_option_parser.coffee +27 -0
- data/packages/coffee-script/test/test_pattern_matching.coffee +162 -0
- data/packages/coffee-script/test/test_returns.coffee +63 -0
- data/packages/coffee-script/test/test_splats.coffee +102 -0
- data/packages/coffee-script/test/test_strings.coffee +118 -0
- data/packages/coffee-script/test/test_switch.coffee +103 -0
- data/packages/coffee-script/test/test_while.coffee +71 -0
- data/packages/ivory/LICENSE.txt +1 -0
- data/packages/ivory/README.md +19 -0
- data/packages/ivory/lib/buffer.js +111 -0
- data/packages/ivory/lib/events.js +137 -0
- data/packages/ivory/lib/fs.js +266 -0
- data/packages/ivory/lib/main.js +13 -0
- data/packages/ivory/lib/path.js +158 -0
- data/packages/ivory/lib/ruby/buffer.rb +145 -0
- data/packages/ivory/lib/ruby/constants.rb +585 -0
- data/packages/ivory/lib/ruby/events.rb +32 -0
- data/packages/ivory/lib/ruby/fs.rb +245 -0
- data/packages/ivory/lib/ruby/process.rb +28 -0
- data/packages/ivory/lib/stream.js +115 -0
- data/packages/ivory/lib/util.js +414 -0
- data/packages/ivory/package.json +11 -0
- data/packages/ivory/spade-boot.js +78 -0
- data/packages/jquery/main.js +7179 -0
- data/packages/jquery/package.json +10 -0
- data/packages/json/lib/main.js +14 -0
- data/packages/json/package.json +8 -0
- data/packages/lproj/README.md +77 -0
- data/packages/lproj/examples/demo-app/en.lproj/localized.strings +2 -0
- data/packages/lproj/examples/demo-app/fr.lproj/localized.strings +3 -0
- data/packages/lproj/examples/demo-app/index.html +8 -0
- data/packages/lproj/examples/demo-app/lib/main.js +7 -0
- data/packages/lproj/examples/demo-app/package.json +9 -0
- data/packages/lproj/lib/main.js +78 -0
- data/packages/lproj/lib/strings-format.js +6 -0
- data/packages/lproj/package.json +9 -0
- data/packages/optparse/README.md +161 -0
- data/packages/optparse/TODO +1 -0
- data/packages/optparse/examples/browser-test.html +75 -0
- data/packages/optparse/examples/nodejs-test.js +90 -0
- data/packages/optparse/lib/optparse.js +309 -0
- data/packages/optparse/package.json +13 -0
- data/packages/optparse/seed.yml +5 -0
- data/packages/text/lib/main.js +8 -0
- data/packages/text/package.json +9 -0
- data/packages/web-file/README.md +7 -0
- data/packages/web-file/lib/errors.js +32 -0
- data/packages/web-file/lib/file-reader.js +10 -0
- data/packages/web-file/lib/file-system.js +234 -0
- data/packages/web-file/lib/file-writer.js +10 -0
- data/packages/web-file/lib/file.js +9 -0
- data/packages/web-file/lib/main.js +34 -0
- data/packages/web-file/lib/platform.js +25 -0
- data/packages/web-file/lib/ruby/file.rb +252 -0
- data/packages/web-file/lib/ruby/file_reader.rb +69 -0
- data/packages/web-file/lib/ruby/file_system.rb +134 -0
- data/packages/web-file/lib/ruby/file_writer.rb +78 -0
- data/packages/web-file/package.json +12 -0
- data/packages/web-typed-array/README.md +7 -0
- data/packages/web-typed-array/lib/array-buffer-view.js +9 -0
- data/packages/web-typed-array/lib/array-buffer.js +7 -0
- data/packages/web-typed-array/lib/main.js +33 -0
- data/packages/web-typed-array/lib/platform.js +20 -0
- data/packages/web-typed-array/lib/ruby/array_buffer.rb +31 -0
- data/packages/web-typed-array/lib/ruby/array_buffer_view.rb +130 -0
- data/packages/web-typed-array/lib/ruby/typed_array.rb +133 -0
- data/packages/web-typed-array/lib/typed-array.js +26 -0
- data/packages/web-typed-array/package.json +9 -0
- data/spade-packager.gemspec +39 -0
- data/spec/cli/build_spec.rb +57 -0
- data/spec/cli/install_spec.rb +119 -0
- data/spec/cli/installed_spec.rb +55 -0
- data/spec/cli/list_spec.rb +74 -0
- data/spec/cli/login_spec.rb +75 -0
- data/spec/cli/new_spec.rb +5 -0
- data/spec/cli/owner_spec.rb +114 -0
- data/spec/cli/push_spec.rb +73 -0
- data/spec/cli/uninstall_spec.rb +58 -0
- data/spec/cli/unpack_spec.rb +72 -0
- data/spec/cli/unyank_spec.rb +73 -0
- data/spec/cli/yank_spec.rb +73 -0
- data/spec/credentials_spec.rb +23 -0
- data/spec/fixtures/badrake-0.8.7.spd +0 -0
- data/spec/fixtures/builder-3.0.0.spd +0 -0
- data/spec/fixtures/bundler-1.1.pre.spd +0 -0
- data/spec/fixtures/coffee-1.0.1.pre.spd +0 -0
- data/spec/fixtures/core-test-0.4.3.spd +0 -0
- data/spec/fixtures/core-test/bin/cot +3 -0
- data/spec/fixtures/core-test/lib/main.js +1 -0
- data/spec/fixtures/core-test/resources/runner.css +0 -0
- data/spec/fixtures/core-test/tests/test.js +1 -0
- data/spec/fixtures/highline-1.6.1.spd +0 -0
- data/spec/fixtures/ivory-0.0.1.spd +0 -0
- data/spec/fixtures/jquery-1.4.3.spd +0 -0
- data/spec/fixtures/optparse-1.0.1.spd +0 -0
- data/spec/fixtures/package.json +30 -0
- data/spec/fixtures/rake-0.8.6.spd +0 -0
- data/spec/fixtures/rake-0.8.7.spd +0 -0
- data/spec/gauntlet_spec.rb +27 -0
- data/spec/package_spec.rb +267 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/support/cli.rb +103 -0
- data/spec/support/fake.rb +48 -0
- data/spec/support/fake_gem_server.rb +67 -0
- data/spec/support/fake_gemcutter.rb +50 -0
- data/spec/support/matchers.rb +32 -0
- data/spec/support/path.rb +61 -0
- data/templates/project/LICENSE +19 -0
- data/templates/project/README.md +21 -0
- data/templates/project/lib/main.js +9 -0
- data/templates/project/project.json +31 -0
- data/templates/project/tests/main-test.js +8 -0
- metadata +484 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "spade unyank" do
|
4
|
+
let(:api_key) { "deadbeef" }
|
5
|
+
let(:creds) { spade_dir("credentials") }
|
6
|
+
|
7
|
+
before do
|
8
|
+
goto_home
|
9
|
+
set_host
|
10
|
+
start_fake(FakeGemcutter.new(api_key))
|
11
|
+
end
|
12
|
+
|
13
|
+
context "with a good api key" do
|
14
|
+
before do
|
15
|
+
write_api_key(api_key)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "unyanks a gem when sent with the right api key" do
|
19
|
+
spade "package", "yank", "core-test", "--undo", "-v", "1.4.3"
|
20
|
+
|
21
|
+
stdout.read.should include("Successfully unyanked gem: core-test (1.4.3)")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "must unyank a valid gem" do
|
25
|
+
spade "package", "yank", "blahblah", "--undo", "-v", "0.0.1"
|
26
|
+
|
27
|
+
stdout.read.should include("This gem could not be found")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "does not unyank and indexed gem" do
|
31
|
+
spade "package", "yank", "core-test", "--undo", "-v", "2.4.3"
|
32
|
+
|
33
|
+
stdout.read.should include("The version 2.4.3 is already indexed.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "shows rejection message if wrong api key is supplied" do
|
38
|
+
write_api_key("beefbeef")
|
39
|
+
|
40
|
+
spade "package", "yank", "core-test", "--undo", "-v", "1.4.3"
|
41
|
+
|
42
|
+
stdout.read.should include("One cannot simply walk into Mordor!")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "spade unyank with invalid api key" do
|
47
|
+
before do
|
48
|
+
cd(home)
|
49
|
+
env["HOME"] = home.to_s
|
50
|
+
env["RUBYGEMS_HOST"] = "http://localhost:9292"
|
51
|
+
write_api_key("beefbeef")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "must require a version" do
|
55
|
+
spade "package", "yank", "core-test", "--undo"
|
56
|
+
|
57
|
+
stdout.read.should include("Version required")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "spade unyank without api key" do
|
62
|
+
before do
|
63
|
+
cd(home)
|
64
|
+
env["HOME"] = home.to_s
|
65
|
+
env["RUBYGEMS_HOST"] = "http://localhost:9292"
|
66
|
+
end
|
67
|
+
|
68
|
+
it "asks for login first if api key does not exist" do
|
69
|
+
spade "package", "yank", "core-test", "-v", "1.4.3", "--undo"
|
70
|
+
|
71
|
+
stdout.read.should include("Please login first with `spade login`")
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "spade yank" do
|
4
|
+
let(:api_key) { "deadbeef" }
|
5
|
+
let(:creds) { spade_dir("credentials") }
|
6
|
+
|
7
|
+
before do
|
8
|
+
goto_home
|
9
|
+
set_host
|
10
|
+
start_fake(FakeGemcutter.new(api_key))
|
11
|
+
end
|
12
|
+
|
13
|
+
context "with a good api key" do
|
14
|
+
before do
|
15
|
+
write_api_key(api_key)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "yanks a gem when sent with the right api key" do
|
19
|
+
spade "package", "yank", "core-test", "-v", "1.4.3"
|
20
|
+
|
21
|
+
stdout.read.should include("Successfully yanked gem: core-test (1.4.3)")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "must yank a valid gem" do
|
25
|
+
spade "package", "yank", "blahblah", "-v", "0.0.1"
|
26
|
+
|
27
|
+
stdout.read.should include("This gem could not be found")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "does not yank a yanked gem" do
|
31
|
+
spade "package", "yank", "core-test", "-v", "2.4.3"
|
32
|
+
|
33
|
+
stdout.read.should include("The version 2.4.3 has already been yanked.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "shows rejection message if wrong api key is supplied" do
|
38
|
+
write_api_key("beefbeef")
|
39
|
+
|
40
|
+
spade "package", "yank", "core-test", "-v", "1.4.3"
|
41
|
+
|
42
|
+
stdout.read.should include("One cannot simply walk into Mordor!")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "spade yank without api key" do
|
47
|
+
before do
|
48
|
+
cd(home)
|
49
|
+
env["HOME"] = home.to_s
|
50
|
+
env["RUBYGEMS_HOST"] = "http://localhost:9292"
|
51
|
+
write_api_key("beefbeef")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "must require a version" do
|
55
|
+
spade "package", "yank", "core-test"
|
56
|
+
|
57
|
+
stdout.read.should include("Version required")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "spade yank without api key" do
|
62
|
+
before do
|
63
|
+
cd(home)
|
64
|
+
env["HOME"] = home.to_s
|
65
|
+
env["RUBYGEMS_HOST"] = "http://localhost:9292"
|
66
|
+
end
|
67
|
+
|
68
|
+
it "asks for login first if api key does not exist" do
|
69
|
+
spade "package", "yank", "core-test", "-v", "1.4.3"
|
70
|
+
|
71
|
+
stdout.read.should include("Please login first with `spade login`")
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spade::Packager::Credentials do
|
4
|
+
def new_creds
|
5
|
+
Spade::Packager::Credentials.new
|
6
|
+
end
|
7
|
+
|
8
|
+
around do |example|
|
9
|
+
cd(home)
|
10
|
+
LibGems.send(:set_home, home)
|
11
|
+
example.call
|
12
|
+
LibGems.clear_paths
|
13
|
+
end
|
14
|
+
|
15
|
+
subject { new_creds }
|
16
|
+
|
17
|
+
it "saves the api key and email" do
|
18
|
+
subject.save("someone@example.com", "secrets")
|
19
|
+
|
20
|
+
new_creds.api_key.should == "secrets"
|
21
|
+
new_creds.email.should == "someone@example.com"
|
22
|
+
end
|
23
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
// Placeholder for test, do not remove
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
// Placeholder for test, do not remove
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,30 @@
|
|
1
|
+
{
|
2
|
+
"name": "core-test",
|
3
|
+
"description": "Flexible testing library for JavaScript.",
|
4
|
+
"summary": "A fully featured asynchronous testing library for JavaScript, compatible with other frameworks.",
|
5
|
+
"keywords": ["javascript", "testing"],
|
6
|
+
"author": "Charles Jolley",
|
7
|
+
"homepage": "https://github.com/strobecorp/core-test",
|
8
|
+
"version": "0.4.3",
|
9
|
+
"licenses": [{
|
10
|
+
"type": "MIT",
|
11
|
+
"url": "https://github.com/strobecorp/core-test/raw/master/LICENSE"
|
12
|
+
}],
|
13
|
+
"engines": ["browser", "all"],
|
14
|
+
"directories": {
|
15
|
+
"lib": "./lib",
|
16
|
+
"resources": "./resources",
|
17
|
+
"test": "./tests"
|
18
|
+
},
|
19
|
+
"main": "./lib/main",
|
20
|
+
"bin": {
|
21
|
+
"cot": "./bin/cot"
|
22
|
+
},
|
23
|
+
"dependencies": {
|
24
|
+
"ivory": "= 0.0.1",
|
25
|
+
"optparse": "= 1.0.1"
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
|
Binary file
|
Binary file
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "spade build the gauntlet" do
|
4
|
+
before do
|
5
|
+
cd(home)
|
6
|
+
env["HOME"] = home.to_s
|
7
|
+
write_creds("user@example.com", "deadbeef")
|
8
|
+
end
|
9
|
+
|
10
|
+
{
|
11
|
+
"ivory" => "0.0.1",
|
12
|
+
"jquery" => "1.4.3",
|
13
|
+
"optparse" => "1.0.1",
|
14
|
+
"web-file" => "0.0.1",
|
15
|
+
"web-typed-array" => "0.0.1",
|
16
|
+
}.each do |package, version|
|
17
|
+
it "builds a spade from #{package}" do
|
18
|
+
FileUtils.cp_r root.join("packages/#{package}"), package
|
19
|
+
cd package
|
20
|
+
spade "package", "build"
|
21
|
+
|
22
|
+
exit_status.should be_success
|
23
|
+
stdout.read.should include("Successfully built package: #{package}-#{version}.spd")
|
24
|
+
File.exist?(tmp.join(package, "#{package}-#{version}.spd"))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,267 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Spade::Packager::Package, "#to_spec" do
|
4
|
+
let(:email) { "user@example.com" }
|
5
|
+
|
6
|
+
before do
|
7
|
+
cd(home)
|
8
|
+
FileUtils.mkdir_p(home("lib"))
|
9
|
+
FileUtils.mkdir_p(home("resources"))
|
10
|
+
FileUtils.mkdir_p(home("tests"))
|
11
|
+
end
|
12
|
+
|
13
|
+
subject do
|
14
|
+
package = Spade::Packager::Package.new(email)
|
15
|
+
package.json_path = fixtures("package.json")
|
16
|
+
if spec = package.to_spec
|
17
|
+
spec
|
18
|
+
else
|
19
|
+
puts "Errors: #{package.errors}"
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "transforms the name" do
|
25
|
+
subject.name.should == "core-test"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "transforms the version" do
|
29
|
+
subject.version.should == LibGems::Version.new("0.4.3")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "transforms the author" do
|
33
|
+
subject.authors.should == ["Charles Jolley"]
|
34
|
+
end
|
35
|
+
|
36
|
+
it "transforms the email" do
|
37
|
+
subject.email.should == email
|
38
|
+
end
|
39
|
+
|
40
|
+
it "transforms the homepage" do
|
41
|
+
subject.homepage.should == "https://github.com/strobecorp/core-test"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "transforms the description" do
|
45
|
+
subject.description.should == "Flexible testing library for JavaScript."
|
46
|
+
end
|
47
|
+
|
48
|
+
it "transforms the description" do
|
49
|
+
subject.summary.should == "A fully featured asynchronous testing library for JavaScript, compatible with other frameworks."
|
50
|
+
end
|
51
|
+
|
52
|
+
it "transforms the dependencies" do
|
53
|
+
subject.dependencies.map{|d| [d.name, d.requirement]}.should == [["ivory", "= 0.0.1"], ["optparse", "= 1.0.1"]]
|
54
|
+
end
|
55
|
+
|
56
|
+
it "packs metadata into requirements" do
|
57
|
+
metadata = JSON.parse(subject.requirements.first)
|
58
|
+
metadata["keywords"].should == %w[javascript testing]
|
59
|
+
metadata["licenses"].should == [
|
60
|
+
{"type" => "MIT",
|
61
|
+
"url" => "https://github.com/strobecorp/core-test/raw/master/LICENSE"}
|
62
|
+
]
|
63
|
+
metadata["engines"].should == ["browser", "all"]
|
64
|
+
metadata["main"].should == "./lib/main"
|
65
|
+
metadata["bin"].should == {"cot" => "./bin/cot"}
|
66
|
+
end
|
67
|
+
|
68
|
+
def expand_sort(files)
|
69
|
+
files.map { |f| File.expand_path(f) }.sort
|
70
|
+
end
|
71
|
+
|
72
|
+
it "expands paths from the directories" do
|
73
|
+
others = ["tmp/blah.js", "tmp/whee.txt"]
|
74
|
+
files = ["bin/cot", "lib/main.js", "lib/core.js", "lib/test.js", "package.json", "resources/additions.css", "resources/runner.css"]
|
75
|
+
test_files = ["tests/apis/core-test.js", "tests/system/test/assert-test.js"]
|
76
|
+
|
77
|
+
FileUtils.mkdir_p(["bin/", "resources/", "lib/", "tests/apis", "tests/system/test", "tmp/"])
|
78
|
+
FileUtils.touch(files + test_files + others)
|
79
|
+
|
80
|
+
expand_sort(subject.files).should == expand_sort(files + test_files)
|
81
|
+
expand_sort(subject.test_files).should == expand_sort(test_files)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "hacks the file name to return .spd" do
|
85
|
+
subject.file_name.should == "core-test-0.4.3.spd"
|
86
|
+
end
|
87
|
+
|
88
|
+
it "sets the rubyforge_project to appease older versions of rubygems" do
|
89
|
+
subject.rubyforge_project.should == "spade"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe Spade::Packager::Package, "#to_s" do
|
94
|
+
let(:email) { "user@example.com" }
|
95
|
+
|
96
|
+
subject do
|
97
|
+
package = Spade::Packager::Package.new
|
98
|
+
package.json_path = fixtures("package.json")
|
99
|
+
package.valid?
|
100
|
+
package
|
101
|
+
end
|
102
|
+
|
103
|
+
it "gives the name and version" do
|
104
|
+
subject.to_full_name.should == "core-test-0.4.3"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe Spade::Packager::Package, "converting" do
|
109
|
+
before do
|
110
|
+
cd(home)
|
111
|
+
end
|
112
|
+
|
113
|
+
subject do
|
114
|
+
package = Spade::Packager::Package.new
|
115
|
+
package.spade = fixtures("core-test-0.4.3.spd")
|
116
|
+
package.as_json
|
117
|
+
end
|
118
|
+
|
119
|
+
it "can recreate the same package.json from the package" do
|
120
|
+
subject.should == JSON.parse(File.read(fixtures("package.json")))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe Spade::Packager::Package, "validating" do
|
125
|
+
before do
|
126
|
+
cd(home)
|
127
|
+
end
|
128
|
+
|
129
|
+
subject { Spade::Packager::Package.new }
|
130
|
+
|
131
|
+
shared_examples_for "a good parser" do
|
132
|
+
it "had a problem parsing package.json" do
|
133
|
+
subject.should have_error("There was a problem parsing package.json")
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context "with a blank file" do
|
138
|
+
before do
|
139
|
+
FileUtils.touch("package.json")
|
140
|
+
subject.json_path = "package.json"
|
141
|
+
end
|
142
|
+
it_should_behave_like "a good parser"
|
143
|
+
end
|
144
|
+
|
145
|
+
context "with bad json" do
|
146
|
+
before do
|
147
|
+
File.open("package.json", "w") do |f|
|
148
|
+
f.write "---bad json---"
|
149
|
+
end
|
150
|
+
subject.json_path = "package.json"
|
151
|
+
end
|
152
|
+
it_should_behave_like "a good parser"
|
153
|
+
end
|
154
|
+
|
155
|
+
context "json can't be read" do
|
156
|
+
before do
|
157
|
+
FileUtils.cp fixtures("package.json"), "."
|
158
|
+
FileUtils.chmod 0000, "package.json"
|
159
|
+
subject.json_path = "package.json"
|
160
|
+
end
|
161
|
+
it_should_behave_like "a good parser"
|
162
|
+
end
|
163
|
+
|
164
|
+
context "json can't be found" do
|
165
|
+
before do
|
166
|
+
subject.json_path = "package.json"
|
167
|
+
end
|
168
|
+
it_should_behave_like "a good parser"
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
describe Spade::Packager::Package, "validation errors" do
|
174
|
+
let(:email) { "user@example.com" }
|
175
|
+
|
176
|
+
before do
|
177
|
+
cd(home)
|
178
|
+
FileUtils.mkdir_p(home("lib"))
|
179
|
+
FileUtils.mkdir_p(home("tests"))
|
180
|
+
end
|
181
|
+
|
182
|
+
subject do
|
183
|
+
Spade::Packager::Package.new(email)
|
184
|
+
end
|
185
|
+
|
186
|
+
def write_package
|
187
|
+
path = home("package.json")
|
188
|
+
package = JSON.parse(File.read(fixtures("package.json")))
|
189
|
+
yield package
|
190
|
+
File.open(path, "w") do |file|
|
191
|
+
file.write package.to_json
|
192
|
+
end
|
193
|
+
subject.json_path = path
|
194
|
+
end
|
195
|
+
|
196
|
+
%w[name description summary homepage author version directories].each do |field|
|
197
|
+
it "is invalid without a #{field} field" do
|
198
|
+
write_package do |package|
|
199
|
+
package.delete(field)
|
200
|
+
end
|
201
|
+
|
202
|
+
subject.should have_error("Package requires a '#{field}' field")
|
203
|
+
end
|
204
|
+
|
205
|
+
it "is invalid with a blank #{field} field" do
|
206
|
+
write_package do |package|
|
207
|
+
package[field] = ""
|
208
|
+
end
|
209
|
+
|
210
|
+
subject.should have_error("Package requires a '#{field}' field")
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
it "is invalid without a proper version number" do
|
215
|
+
write_package do |package|
|
216
|
+
package["version"] = "bad"
|
217
|
+
end
|
218
|
+
|
219
|
+
subject.should have_error("Malformed version number string bad")
|
220
|
+
end
|
221
|
+
|
222
|
+
it "is valid without specifying a test directory" do
|
223
|
+
write_package do |package|
|
224
|
+
package["directories"].delete("test")
|
225
|
+
end
|
226
|
+
|
227
|
+
subject.should be_valid
|
228
|
+
subject.to_spec.test_files.should == []
|
229
|
+
end
|
230
|
+
|
231
|
+
it "is valid and has files without specifying bin" do
|
232
|
+
write_package do |package|
|
233
|
+
package.delete("bin")
|
234
|
+
end
|
235
|
+
|
236
|
+
subject.should be_valid
|
237
|
+
subject.to_spec.files.should == ["package.json"]
|
238
|
+
end
|
239
|
+
|
240
|
+
%w[lib test].each do |dir|
|
241
|
+
it "is invalid without a #{dir} directory that exists" do
|
242
|
+
write_package do |package|
|
243
|
+
package["directories"][dir] = "nope"
|
244
|
+
end
|
245
|
+
|
246
|
+
subject.should have_error("'nope' specified for #{dir} directory, is not a directory")
|
247
|
+
end
|
248
|
+
|
249
|
+
it "is valid without a #{dir} directory that exists" do
|
250
|
+
FileUtils.mkdir_p(home("somewhere", "else"))
|
251
|
+
write_package do |package|
|
252
|
+
package["directories"][dir] = "./somewhere/else"
|
253
|
+
end
|
254
|
+
|
255
|
+
subject.should be_valid
|
256
|
+
end
|
257
|
+
|
258
|
+
it "is invalid if #{dir} points to a file" do
|
259
|
+
FileUtils.touch(home("somefile"))
|
260
|
+
write_package do |package|
|
261
|
+
package["directories"][dir] = "./somefile"
|
262
|
+
end
|
263
|
+
|
264
|
+
subject.should have_error("'./somefile' specified for #{dir} directory, is not a directory")
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|