ajaxboxlogin 0.0.3
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.
- data/bin/ajaxboxlogin +3 -0
- data/features/ajaxboxlogin.feature +13 -0
- data/features/generator.feature +40 -0
- data/lib/ajaxboxlogin.rb +3 -0
- data/lib/ajaxboxlogin/ajaxboxlogin.rb +4 -0
- data/lib/ajaxboxlogin/cli.rb +21 -0
- data/lib/ajaxboxlogin/generators/ajaxboxlogin.rb +71 -0
- data/spec/ajaxboxlogin_spec.rb +4 -0
- metadata +170 -0
data/bin/ajaxboxlogin
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: AjaxBoxLogin
|
2
|
+
In order to present a Twitter-style login box
|
3
|
+
As an Ajax element
|
4
|
+
I want to be sure its hidden or present as appropriate
|
5
|
+
|
6
|
+
Scenario: Login box is present but hidden
|
7
|
+
When I am on the homepage
|
8
|
+
Then "div.in-login-box" should not be visible
|
9
|
+
|
10
|
+
Scenario: Login box is visible after opening
|
11
|
+
Given I am on the homepage
|
12
|
+
When I click "login"
|
13
|
+
Then "div.in-login-box" should be visible
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Feature: Generating things
|
2
|
+
In order to generate files necessary for AjaxBoxLogin
|
3
|
+
As a developer
|
4
|
+
I want AjaxBoxLogin to hold my hand, tightly
|
5
|
+
|
6
|
+
# These scenarios are why the Aruba gem is required
|
7
|
+
|
8
|
+
Scenario: Generating erb files for Prototype
|
9
|
+
When I run "ajaxboxlogin erb shared"
|
10
|
+
Then the following files should exist:
|
11
|
+
| app/views/shared/_ajaxboxlogin.html.erb |
|
12
|
+
| public/javascripts/ajaxboxlogin.js |
|
13
|
+
| public/stylesheets/ajaxboxlogin.css |
|
14
|
+
Then the file "public/javascripts/ajaxboxlogin.js" should contain:
|
15
|
+
"""
|
16
|
+
Requires prototype.js to already be invoked
|
17
|
+
"""
|
18
|
+
|
19
|
+
Scenario: Generating erb files for jQuery
|
20
|
+
When I run "ajaxboxlogin erb shared jquery"
|
21
|
+
Then the following files should exist:
|
22
|
+
| app/views/shared/_ajaxboxlogin.html.erb |
|
23
|
+
| public/javascripts/ajaxboxlogin.js |
|
24
|
+
| public/stylesheets/ajaxboxlogin.css |
|
25
|
+
Then the file "public/javascripts/ajaxboxlogin.js" should contain:
|
26
|
+
"""
|
27
|
+
Requires jquery.js to already be invoked
|
28
|
+
"""
|
29
|
+
|
30
|
+
Scenario: Generating haml/scss files
|
31
|
+
When I run "ajaxboxlogin haml shared"
|
32
|
+
Then the following files should exist:
|
33
|
+
| app/views/shared/_ajaxboxlogin.html.haml |
|
34
|
+
| public/javascripts/ajaxboxlogin.js |
|
35
|
+
| app/stylesheets/ajaxboxlogin.scss |
|
36
|
+
|
37
|
+
# TODO
|
38
|
+
# Add negative cases to test defaults
|
39
|
+
|
40
|
+
|
data/lib/ajaxboxlogin.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'thor/actions'
|
3
|
+
require 'ajaxboxlogin/ajaxboxlogin'
|
4
|
+
require 'ajaxboxlogin/version'
|
5
|
+
|
6
|
+
module AjaxBoxLogin
|
7
|
+
class CLI < Thor
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
desc "gen view_path view_path javascript_lib", "generates view partial of template_engine in view_path, along with needed JavaScript based on javascript_lib framework and a stylesheet"
|
11
|
+
def gen(template_engine, view_path, javascript_lib)
|
12
|
+
AjaxBoxLogin::AjaxBoxLoginGen.gen_files(template_engine, view_path, javascript_lib)
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "version", "prints out AjaxBoxLogin's version information"
|
16
|
+
def version
|
17
|
+
say "AjaxBoxLogin version #{AjaxBoxLogin::VERSION}"
|
18
|
+
end
|
19
|
+
map %w(-v --version) => :version
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module AjaxBoxLogin
|
4
|
+
module Generators
|
5
|
+
class AjaxBoxLoginGen < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
source_root File.dirname(__FILE__) + "/ajaxboxlogin"
|
9
|
+
|
10
|
+
class_option :template_engine, :type => :string, :aliases => "-t", :default => 'erb', :desc => "Template engine for the views. Available options are 'erb' and 'haml'."
|
11
|
+
argument :view_path, :type => :string
|
12
|
+
argument :js_lib, :type => :string
|
13
|
+
|
14
|
+
def gen_files(view_path, js_lib)
|
15
|
+
copy_view(view_path)
|
16
|
+
copy_js(js_lib)
|
17
|
+
copy_css
|
18
|
+
puts "AjaxBoxLogin file generation completed"
|
19
|
+
end
|
20
|
+
|
21
|
+
def copy_view(view_path)
|
22
|
+
template("base/base.html.#{options[:template_engine]}", "app/views/#{view_path}/_ajaxbox_login.html.#{options[:template_engine]}")
|
23
|
+
puts "Generated partial _ajaxbox_login.html.#{options[:template_engine]} in app/views/#{view_path}/"
|
24
|
+
end
|
25
|
+
|
26
|
+
def copy_js(js_lib)
|
27
|
+
js_lib.downcase!
|
28
|
+
case js_lib
|
29
|
+
when 'protoype'
|
30
|
+
copy_js_prototype
|
31
|
+
when 'jquery'
|
32
|
+
copy_js_jquery
|
33
|
+
else
|
34
|
+
puts "Generator only supports Prototype and jQuery at this time"
|
35
|
+
end
|
36
|
+
puts "Generated ajaxboxlogin.js dependent on #{js_lib} in public/javascripts/"
|
37
|
+
end
|
38
|
+
|
39
|
+
def copy_js_prototype
|
40
|
+
template("base/base.protoype.js", "public/javascripts/ajaxboxlogin.js")
|
41
|
+
end
|
42
|
+
|
43
|
+
def copy_js_jquery
|
44
|
+
template("base/base.jquery.js", "public/javascripts/ajaxboxlogin.js")
|
45
|
+
end
|
46
|
+
|
47
|
+
def copy_css
|
48
|
+
te = options[:template_engine].downcase
|
49
|
+
case te
|
50
|
+
when 'haml'
|
51
|
+
copy_css_haml
|
52
|
+
when 'erb'
|
53
|
+
copy_css_erb
|
54
|
+
else
|
55
|
+
puts "Template engine must be either HAML or ERB"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def copy_css_haml
|
60
|
+
template("base/base.scss", "app/stylesheets/ajaxboxlogin.scss")
|
61
|
+
puts "Generated ajaxboxlogin.scss in app/stylesheets/"
|
62
|
+
end
|
63
|
+
|
64
|
+
def copy_css_erb
|
65
|
+
template("base/base.css", "public/stylesheets/ajaxboxlogin.css")
|
66
|
+
puts "Generated ajaxboxlogin.css in public/stylesheets/"
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ajaxboxlogin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Bill Lazar
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-10-27 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: bundler
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
version: 1.0.0
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 2
|
45
|
+
- 0
|
46
|
+
- 0
|
47
|
+
version: 2.0.0
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: cucumber
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: aruba
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: capybara
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
type: :development
|
88
|
+
version_requirements: *id005
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: activesupport
|
91
|
+
prerelease: false
|
92
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
type: :runtime
|
101
|
+
version_requirements: *id006
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: thor
|
104
|
+
prerelease: false
|
105
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
version: "0"
|
113
|
+
type: :runtime
|
114
|
+
version_requirements: *id007
|
115
|
+
description: AjaxBoxLogin is a small gem that generates the Rails 3 view partial, stylesheet and javascript needed to have a Twitter-style AJAX login box on your app's pages.
|
116
|
+
email:
|
117
|
+
- blazar+abl@gmail.com
|
118
|
+
executables:
|
119
|
+
- ajaxboxlogin
|
120
|
+
extensions: []
|
121
|
+
|
122
|
+
extra_rdoc_files: []
|
123
|
+
|
124
|
+
files:
|
125
|
+
- lib/ajaxboxlogin.rb
|
126
|
+
- lib/ajaxboxlogin/cli.rb
|
127
|
+
- lib/ajaxboxlogin/ajaxboxlogin.rb
|
128
|
+
- lib/ajaxboxlogin/generators/ajaxboxlogin.rb
|
129
|
+
- features/ajaxboxlogin.feature
|
130
|
+
- features/generator.feature
|
131
|
+
- spec/ajaxboxlogin_spec.rb
|
132
|
+
- bin/ajaxboxlogin
|
133
|
+
has_rdoc: true
|
134
|
+
homepage: http://rubygems.org/gems/ajaxboxlogin
|
135
|
+
licenses: []
|
136
|
+
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
segments:
|
148
|
+
- 0
|
149
|
+
version: "0"
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
segments:
|
156
|
+
- 1
|
157
|
+
- 3
|
158
|
+
- 6
|
159
|
+
version: 1.3.6
|
160
|
+
requirements: []
|
161
|
+
|
162
|
+
rubyforge_project: ajaxboxlogin
|
163
|
+
rubygems_version: 1.3.7
|
164
|
+
signing_key:
|
165
|
+
specification_version: 3
|
166
|
+
summary: Generates the Rails 3 view partial, stylesheet and javascript for a Twitter-style AJAX login box
|
167
|
+
test_files:
|
168
|
+
- features/ajaxboxlogin.feature
|
169
|
+
- features/generator.feature
|
170
|
+
- spec/ajaxboxlogin_spec.rb
|