browse-everything 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +2 -1
- data/Gemfile +6 -0
- data/HISTORY.md +5 -0
- data/README.md +35 -3
- data/Rakefile +2 -1
- data/app/assets/javascripts/browse_everything/behavior.js.coffee +58 -18
- data/app/views/browse_everything/_auth.html.erb +1 -1
- data/app/views/browse_everything/_file.html.erb +10 -8
- data/app/views/browse_everything/_files.html.erb +11 -6
- data/app/views/browse_everything/index.html.erb +5 -4
- data/browse-everything.gemspec +2 -0
- data/lib/browse_everything.rb +1 -0
- data/lib/browse_everything/driver/box.rb +2 -2
- data/lib/browse_everything/driver/drop_box.rb +1 -1
- data/lib/browse_everything/driver/file_system.rb +4 -2
- data/lib/browse_everything/driver/google_drive.rb +7 -2
- data/lib/browse_everything/driver/sky_drive.rb +1 -1
- data/lib/browse_everything/retriever.rb +60 -0
- data/lib/browse_everything/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/dropbox.yml +83 -0
- data/spec/fixtures/vcr_cassettes/retriever.yml +77 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/{support → test_app_templates}/lib/generators/test_app_generator.rb +9 -9
- data/spec/unit/file_system_spec.rb +2 -2
- data/spec/unit/retriever_spec.rb +83 -0
- data/tasks/ci.rake +2 -4
- metadata +81 -51
- data/spec/rake/app_spec.rb +0 -121
- data/tasks/browse-everything-dev.rake +0 -70
data/spec/rake/app_spec.rb
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
# saves original $stdout in variable
|
5
|
-
# set $stdout as local instance of StringIO
|
6
|
-
# yields to code execution
|
7
|
-
# returns the local instance of StringIO
|
8
|
-
# resets $stdout to original value
|
9
|
-
def capture_stdout
|
10
|
-
out = StringIO.new
|
11
|
-
$stdout = out
|
12
|
-
yield
|
13
|
-
return out.string
|
14
|
-
ensure
|
15
|
-
$stdout = STDOUT
|
16
|
-
end
|
17
|
-
|
18
|
-
def loaded_files_excluding_current_rake_file
|
19
|
-
$".reject { |file| file.include? "tasks/sufia-fixtures" }
|
20
|
-
end
|
21
|
-
|
22
|
-
def attempts_max
|
23
|
-
30
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "Rake Tasks" do
|
27
|
-
before (:each) do
|
28
|
-
@rake = Rake::Application.new
|
29
|
-
Rake.application = @rake
|
30
|
-
Rake.application.rake_require("browse-everything-dev", ["#{BrowseEverything::Engine.root}/tasks/"], loaded_files_excluding_current_rake_file)
|
31
|
-
Rake::Task.define_task(:environment)
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "start" do
|
35
|
-
after (:each) do
|
36
|
-
@rake['app:stop'].invoke
|
37
|
-
end
|
38
|
-
it "start an app" do
|
39
|
-
o = capture_stdout do
|
40
|
-
@rake['app:start'].invoke
|
41
|
-
end
|
42
|
-
o.should include "Starting"
|
43
|
-
attempts = 1
|
44
|
-
while ((!File.exists?('spec/internal/tmp/pids/server.pid')) && (attempts=+1 <attempts_max ))
|
45
|
-
sleep(0.01)
|
46
|
-
end
|
47
|
-
|
48
|
-
expect(File).to exist("spec/internal/tmp/pids/server.pid")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "stop" do
|
53
|
-
it "stop a started app" do
|
54
|
-
|
55
|
-
o = capture_stdout do
|
56
|
-
@rake['app:start'].invoke
|
57
|
-
end
|
58
|
-
|
59
|
-
#wait until the app has started
|
60
|
-
while (!File.exists?('spec/internal/tmp/pids/server.pid'))
|
61
|
-
sleep(0.01)
|
62
|
-
end
|
63
|
-
|
64
|
-
o = capture_stdout do
|
65
|
-
@rake['app:stop'].invoke
|
66
|
-
end
|
67
|
-
o.should include "Stopping"
|
68
|
-
attempts = 1
|
69
|
-
while ((File.exists?('spec/internal/tmp/pids/server.pid')) && (attempts=+1 <attempts_max ))
|
70
|
-
sleep(0.01)
|
71
|
-
end
|
72
|
-
expect(File).not_to exist("spec/internal/tmp/pids/server.pid")
|
73
|
-
end
|
74
|
-
|
75
|
-
it "not fail when stopping a stopped app" do
|
76
|
-
|
77
|
-
o = capture_stdout do
|
78
|
-
@rake['app:stop'].invoke
|
79
|
-
end
|
80
|
-
expect(File).not_to exist("spec/internal/tmp/pids/server.pid")
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "clean" do
|
85
|
-
after (:each) do
|
86
|
-
@rake['app:generate'].invoke
|
87
|
-
#wait until the app has generated
|
88
|
-
while (!File.exists?('spec/internal/app/assets/stylesheets/'))
|
89
|
-
sleep(0.01)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
it "remove spec internal app" do
|
94
|
-
|
95
|
-
o = capture_stdout do
|
96
|
-
@rake['app:clean'].invoke
|
97
|
-
end
|
98
|
-
expect(File).not_to exist("spec/internal/app")
|
99
|
-
end
|
100
|
-
|
101
|
-
it "stop server" do
|
102
|
-
o = capture_stdout do
|
103
|
-
@rake['app:start'].invoke
|
104
|
-
end
|
105
|
-
|
106
|
-
#wait until the app has started
|
107
|
-
while (!File.exists?('spec/internal/tmp/pids/server.pid'))
|
108
|
-
sleep(0.01)
|
109
|
-
end
|
110
|
-
|
111
|
-
o = capture_stdout do
|
112
|
-
@rake['app:clean'].invoke
|
113
|
-
end
|
114
|
-
o.should include "Stopping"
|
115
|
-
expect(File).not_to exist("spec/internal/app")
|
116
|
-
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
namespace :app do
|
2
|
-
desc "Create the test rails app"
|
3
|
-
task :generate do
|
4
|
-
unless File.exists?('spec/internal/Rakefile')
|
5
|
-
puts "Generating rails app"
|
6
|
-
`rails new spec/internal`
|
7
|
-
puts "Updating gemfile"
|
8
|
-
|
9
|
-
`echo "gem 'browse-everything', :path=>'../../../browse-everything'
|
10
|
-
gem 'factory_girl_rails'
|
11
|
-
" >> spec/internal/Gemfile`
|
12
|
-
puts "Copying generator"
|
13
|
-
`cp -r spec/support/lib/generators spec/internal/lib`
|
14
|
-
Bundler.with_clean_env do
|
15
|
-
within_test_app do
|
16
|
-
puts "running test_app_generator"
|
17
|
-
system "rails generate test_app"
|
18
|
-
puts "Bundle install"
|
19
|
-
`bundle install`
|
20
|
-
puts "running migrations"
|
21
|
-
puts `rake db:migrate db:test:prepare`
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
puts "Done generating test app"
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Clean out the test rails app"
|
29
|
-
task :clean do
|
30
|
-
if File.directory?('spec/internal')
|
31
|
-
within_test_app do
|
32
|
-
puts "Stopping Spring"
|
33
|
-
`spring stop`
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
Rake::Task["app:stop"].invoke
|
38
|
-
puts "Removing sample rails app"
|
39
|
-
`rm -rf spec/internal`
|
40
|
-
end
|
41
|
-
|
42
|
-
desc "Start the test rails app"
|
43
|
-
task :start do
|
44
|
-
Bundler.with_clean_env do
|
45
|
-
within_test_app do
|
46
|
-
puts "Starting test app"
|
47
|
-
system "rails server -d"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
desc "Stop the test rails app"
|
53
|
-
task :stop do
|
54
|
-
pid_file = 'tmp/pids/server.pid'
|
55
|
-
within_test_app do
|
56
|
-
if (File.exists?(pid_file))
|
57
|
-
pid = File.read(pid_file)
|
58
|
-
puts "Stopping pid #{pid}"
|
59
|
-
system "kill -2 #{pid}"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def within_test_app
|
66
|
-
return unless (File.exists?('spec/internal'))
|
67
|
-
FileUtils.cd('spec/internal')
|
68
|
-
yield
|
69
|
-
FileUtils.cd('../..')
|
70
|
-
end
|