gnarus_exercise 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/app/assets/javascripts/gnarus_exercise/attempt.js +7 -2
- data/bin/gnarus_activity +13 -0
- data/lib/gnarus_exercise/version.rb +1 -1
- data/template.rb +40 -0
- metadata +6 -3
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Configuring a new project
|
|
7
7
|
=========================
|
8
8
|
|
9
9
|
```
|
10
|
-
|
10
|
+
gnarus_activity my_exercise
|
11
11
|
```
|
12
12
|
|
13
13
|
You will be prompted about adding <code>devise</code> into your application, then it is up
|
@@ -2,10 +2,15 @@ var gnarus = {
|
|
2
2
|
attemptForm : function(solution, viewer, returnUri) {
|
3
3
|
|
4
4
|
var finishWith = function(solution) {
|
5
|
-
var form = $('<form
|
5
|
+
var form = $('<form/>');
|
6
|
+
form.attr({
|
7
|
+
action : returnUri,
|
8
|
+
style : "display: none"
|
9
|
+
});
|
6
10
|
var input = $('<input name="solution" />');
|
7
11
|
input.val(solution);
|
8
|
-
|
12
|
+
input.appendTo(form);
|
13
|
+
form.appendTo($('body'));
|
9
14
|
form.submit();
|
10
15
|
};
|
11
16
|
|
data/bin/gnarus_activity
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
lib = File.expand_path("../../lib", __FILE__)
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
|
+
|
5
|
+
template = File.expand_path("../../template.rb", __FILE__)
|
6
|
+
|
7
|
+
if !ARGV[0]
|
8
|
+
puts "qual o nome do projeto?"
|
9
|
+
else
|
10
|
+
command = "rails new #{ARGV[0]} -m #{template}"
|
11
|
+
puts "executando: #{command}"
|
12
|
+
system(command)
|
13
|
+
end
|
data/template.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# clean up rails defaults
|
2
|
+
remove_file 'public/index.html'
|
3
|
+
remove_file 'public/images/rails.png'
|
4
|
+
run 'cp config/database.yml config/database.example'
|
5
|
+
append_file ".gitignore", "config/database.yml"
|
6
|
+
|
7
|
+
# gems
|
8
|
+
gem "gnarus_exercise"
|
9
|
+
|
10
|
+
if yes?("Do you want we configure devise for you?")
|
11
|
+
gem "devise"
|
12
|
+
@devised = true
|
13
|
+
end
|
14
|
+
|
15
|
+
puts "installing gems..."
|
16
|
+
run "bundle install"
|
17
|
+
|
18
|
+
rake "gnarus_exercise:install:migrations", :env => "development"
|
19
|
+
create_file("app/views/gnarus_exercise/attempts/index.html.erb") do
|
20
|
+
"<strong>Your exercise here</strong>"
|
21
|
+
end
|
22
|
+
|
23
|
+
if @devised
|
24
|
+
puts "generating devise"
|
25
|
+
generate "devise:install"
|
26
|
+
generate "devise User"
|
27
|
+
rake "gnarus_exercise:install:migrations", :env => "development"
|
28
|
+
end
|
29
|
+
|
30
|
+
rake "db:create", :env => "development"
|
31
|
+
rake "db:migrate", :env => "development"
|
32
|
+
|
33
|
+
inject_into_file "config/routes.rb", :before => "\nend" do
|
34
|
+
"
|
35
|
+
|
36
|
+
mount GnarusExercise::Engine => \"/\", :as => :gnarus
|
37
|
+
root :to => \"GnarusExercise::Exercises#index\"
|
38
|
+
|
39
|
+
"
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gnarus_exercise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -46,7 +46,8 @@ dependencies:
|
|
46
46
|
description: Create external exercises by mounting this plugin.
|
47
47
|
email:
|
48
48
|
- guilherme.silveira@caelum.com.br
|
49
|
-
executables:
|
49
|
+
executables:
|
50
|
+
- gnarus_activity
|
50
51
|
extensions: []
|
51
52
|
extra_rdoc_files: []
|
52
53
|
files:
|
@@ -79,9 +80,11 @@ files:
|
|
79
80
|
- lib/gnarus_exercise/version.rb
|
80
81
|
- lib/gnarus_exercise.rb
|
81
82
|
- lib/tasks/gnarus_exercise_tasks.rake
|
83
|
+
- bin/gnarus_activity
|
82
84
|
- MIT-LICENSE
|
83
85
|
- Rakefile
|
84
86
|
- README.md
|
87
|
+
- template.rb
|
85
88
|
- test/dummy/app/assets/javascripts/application.js
|
86
89
|
- test/dummy/app/assets/stylesheets/application.css
|
87
90
|
- test/dummy/app/controllers/application_controller.rb
|