hydra-tutorial 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/hydra-tutorial.gemspec +2 -2
- data/open-repositories-tutorial.thor +35 -15
- metadata +8 -8
data/hydra-tutorial.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "hydra-tutorial"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.2"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.authors = ["Chris Beer"]
|
6
6
|
s.email = ["hydra-tech@googlegroups.com"]
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.summary = "Hydra head tutorial walkthrough"
|
9
9
|
s.description = "Tutorial that works through setting up a hydra head"
|
10
10
|
|
11
|
-
s.add_dependency "thor"
|
11
|
+
s.add_dependency "thor", "~> 0.15"
|
12
12
|
s.add_dependency "rails"
|
13
13
|
s.add_dependency "bundler"
|
14
14
|
|
@@ -209,7 +209,7 @@ class HydraOpenRepositoriesTutorialApp < Thor::Group
|
|
209
209
|
#{ruby_executable}
|
210
210
|
}, STATEMENT
|
211
211
|
|
212
|
-
if ruby_executable =~ /rvm/ or ruby_executable =~ /rbenv/ or ruby_executable =~ /home/ or
|
212
|
+
if ruby_executable =~ /rvm/ or ruby_executable =~ /rbenv/ or ruby_executable =~ /home/ or ruby_executable =~ /Users/
|
213
213
|
say %Q{
|
214
214
|
It looks like you're using rvm/rbenv/etc. (with a gemset?) We'll use
|
215
215
|
this environment to build the application.
|
@@ -432,7 +432,7 @@ class HydraOpenRepositoriesTutorialApp < Thor::Group
|
|
432
432
|
Instead of working with the Nokogiri XML document directly, we
|
433
433
|
can use OM to make querying an XML document easier. We'll replace the
|
434
434
|
previous Record with a OM-enabled document.
|
435
|
-
}
|
435
|
+
}, STATEMENT
|
436
436
|
copy_file "basic_om_model.rb", "app/models/record.rb"
|
437
437
|
end
|
438
438
|
|
@@ -694,6 +694,11 @@ class HydraOpenRepositoriesTutorialApp < Thor::Group
|
|
694
694
|
|
695
695
|
|
696
696
|
def install_rspec
|
697
|
+
say %Q{
|
698
|
+
One of the great things about the Rails framework is the strong
|
699
|
+
testing ethic. We'll use rspec to write a couple tests for
|
700
|
+
this application.
|
701
|
+
}, STATEMENT
|
697
702
|
gem_group :development, :test do
|
698
703
|
gem 'rspec'
|
699
704
|
gem 'rspec-rails'
|
@@ -704,22 +709,23 @@ class HydraOpenRepositoriesTutorialApp < Thor::Group
|
|
704
709
|
end
|
705
710
|
|
706
711
|
def write_our_first_test
|
712
|
+
say %Q{
|
713
|
+
Here's a quick example of a test.
|
714
|
+
}
|
707
715
|
copy_file 'records_controller_spec.rb', 'spec/controllers/records_controller_spec.rb'
|
708
|
-
end
|
709
|
-
|
710
|
-
def run_tests
|
711
716
|
run 'rspec'
|
712
717
|
end
|
713
718
|
|
714
719
|
def a_model_test
|
715
720
|
# copy_file 'record_test.rb', 'spec/models/record_test.rb'
|
716
|
-
|
717
|
-
|
718
|
-
def run_tests_again
|
719
|
-
run 'rspec'
|
721
|
+
#run 'rspec'
|
720
722
|
end
|
721
723
|
|
722
724
|
def install_capybara
|
725
|
+
say %Q{
|
726
|
+
We also want to write integration tests to test the end-result that
|
727
|
+
a user may see. We'll add the capybara gem to do that.
|
728
|
+
}, STATEMENT
|
723
729
|
gem_group :development, :test do
|
724
730
|
gem 'capybara'
|
725
731
|
end
|
@@ -730,6 +736,9 @@ class HydraOpenRepositoriesTutorialApp < Thor::Group
|
|
730
736
|
end
|
731
737
|
|
732
738
|
def an_integration_test
|
739
|
+
say %Q{
|
740
|
+
Here's a quick integration test that proves deposit works.
|
741
|
+
}, STATEMENT
|
733
742
|
copy_file 'integration_spec.rb', 'spec/integration/integration_spec.rb'
|
734
743
|
end
|
735
744
|
|
@@ -746,11 +755,9 @@ class HydraOpenRepositoriesTutorialApp < Thor::Group
|
|
746
755
|
Instead, we need to add a new Rake task that knows how to wrap the
|
747
756
|
test suite -- start jetty before running the tests and stop jetty
|
748
757
|
at the end. We can use a feature provided by jettywrapper to do this.
|
749
|
-
}
|
758
|
+
}, STATEMENT
|
750
759
|
copy_file 'ci.rake', 'lib/tasks/ci.rake'
|
751
|
-
end
|
752
760
|
|
753
|
-
def run_ci_task
|
754
761
|
rake 'jetty:stop'
|
755
762
|
rake 'ci'
|
756
763
|
rake 'jetty:start'
|
@@ -779,9 +786,7 @@ if ENV['COVERAGE'] == "true"
|
|
779
786
|
end
|
780
787
|
}
|
781
788
|
end
|
782
|
-
end
|
783
789
|
|
784
|
-
def run_ci_task_again
|
785
790
|
rake 'jetty:stop'
|
786
791
|
rake 'ci'
|
787
792
|
rake 'jetty:start'
|
@@ -791,7 +796,7 @@ end
|
|
791
796
|
say %Q{
|
792
797
|
Go take a look at the coverage report, open the file ./coverage/index.html
|
793
798
|
in your browser.
|
794
|
-
}
|
799
|
+
}, STATEMENT
|
795
800
|
continue_prompt
|
796
801
|
end
|
797
802
|
end
|
@@ -807,6 +812,10 @@ end
|
|
807
812
|
|
808
813
|
|
809
814
|
def fix_add_assets_links
|
815
|
+
say %Q{
|
816
|
+
We'll add a little styling to the Hydra app and add a link to add a new
|
817
|
+
Record in the header of the layout.
|
818
|
+
}, STATEMENT
|
810
819
|
copy_file "_add_assets_links.html.erb", "app/views/_add_assets_links.html.erb"
|
811
820
|
end
|
812
821
|
|
@@ -837,12 +846,20 @@ end
|
|
837
846
|
end
|
838
847
|
|
839
848
|
def add_file_uploads
|
849
|
+
say %Q{
|
850
|
+
Now that we have a basic Hydra application working with metadata-only, we
|
851
|
+
want to enhance that with the ability to upload files. Let's add a new
|
852
|
+
datastream to our model.
|
853
|
+
}, STATEMENT
|
840
854
|
inject_into_class 'app/models/record.rb', 'Record' do
|
841
855
|
"has_file_datastream :name => 'content', :type => ActiveFedora::Datastream\n"
|
842
856
|
end
|
843
857
|
end
|
844
858
|
|
845
859
|
def add_file_upload_controller
|
860
|
+
say %Q{
|
861
|
+
And educate our controller for managing file objects.
|
862
|
+
}, STATEMENT
|
846
863
|
inject_into_class "app/controllers/records_controller.rb", "RecordsController" do
|
847
864
|
" include Hydra::Controller::UploadBehavior\n"
|
848
865
|
end
|
@@ -853,6 +870,9 @@ end
|
|
853
870
|
end
|
854
871
|
|
855
872
|
def add_file_upload_ui
|
873
|
+
say %Q{
|
874
|
+
And add a file upload field on the form.
|
875
|
+
}, STATEMENT
|
856
876
|
copy_file "_form.html.erb", "app/views/records/_form.html.erb"
|
857
877
|
end
|
858
878
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-tutorial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
21
|
+
version: '0.15'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
29
|
+
version: '0.15'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rails
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
segments:
|
115
115
|
- 0
|
116
|
-
hash:
|
116
|
+
hash: 1643192011115769523
|
117
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
segments:
|
124
124
|
- 0
|
125
|
-
hash:
|
125
|
+
hash: 1643192011115769523
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
128
|
rubygems_version: 1.8.24
|