jt-mobile-kit-rails 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/jt-mobile-kit-rails.gemspec +19 -0
- data/lib/generators/jt/scaffold/scaffold_generator.rb +31 -0
- data/lib/generators/jt/scaffold/templates/_list_page.haml +7 -0
- data/lib/generators/jt/scaffold/templates/_page.haml +4 -0
- data/lib/generators/jt.rb +29 -0
- data/lib/jt-mobile-kit-rails/version.rb +9 -0
- metadata +56 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 TODO: Write your name
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Jt::Mobile::Kit::Rails
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'jt-mobile-kit-rails'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install jt-mobile-kit-rails
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jt-mobile-kit-rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "jt-mobile-kit-rails"
|
8
|
+
gem.version = Jt::Mobile::Kit::Rails::VERSION
|
9
|
+
gem.authors = ["jtong"]
|
10
|
+
gem.email = ["tj19832@gmail.com"]
|
11
|
+
gem.description = %q{generate jt-mobile-kit in rails app}
|
12
|
+
gem.summary = %q{generate jt-mobile-kit in rails app}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'generators/jt'
|
2
|
+
|
3
|
+
module Jt
|
4
|
+
module Generators
|
5
|
+
class ScaffoldGenerator < Base
|
6
|
+
#desc "This generator test gem generator"
|
7
|
+
argument :scaffold_name, :type => :string, :required => true, :banner => 'ModelName'
|
8
|
+
def template_root
|
9
|
+
@_template_root ||= File.expand_path('../templates', __FILE__)
|
10
|
+
end
|
11
|
+
|
12
|
+
def link_page
|
13
|
+
insert_into_file "public/mobile/_pages.haml", "\n=render '#{scaffold_name}_page'", {:after => "// pages"}
|
14
|
+
insert_into_file "public/mobile/_pages.haml", "\n=render '#{scaffold_name}_list_page'", {:after => "// pages"}
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_domain_page
|
18
|
+
content = File.read "#{template_root}/_page.haml"
|
19
|
+
content = content.gsub "@{scaffold_name}", scaffold_name
|
20
|
+
create_file "public/mobile/_#{scaffold_name}_page.haml", content
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_domain_list_page
|
24
|
+
content = File.read "#{template_root}/_list_page.haml"
|
25
|
+
content = content.gsub "@{scaffold_name}", scaffold_name
|
26
|
+
create_file "public/mobile/_#{scaffold_name}_list_page.haml", content
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module Jt
|
4
|
+
module Generators
|
5
|
+
class Base < Rails::Generators::Base #:nodoc:
|
6
|
+
def self.source_root
|
7
|
+
@_jt_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'jt', generator_name, 'templates'))
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.banner
|
11
|
+
"rails generate jt:#{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def add_gem(name, options = {})
|
17
|
+
gemfile_content = File.read(destination_path("Gemfile"))
|
18
|
+
File.open(destination_path("Gemfile"), 'a') { |f| f.write("\n") } unless gemfile_content =~ /\n\Z/
|
19
|
+
gem name, options unless gemfile_content.include? name
|
20
|
+
end
|
21
|
+
|
22
|
+
def print_usage
|
23
|
+
self.class.help(Thor::Base.shell.new)
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jt-mobile-kit-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- jtong
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-11 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: generate jt-mobile-kit in rails app
|
15
|
+
email:
|
16
|
+
- tj19832@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- jt-mobile-kit-rails.gemspec
|
27
|
+
- lib/generators/jt.rb
|
28
|
+
- lib/generators/jt/scaffold/scaffold_generator.rb
|
29
|
+
- lib/generators/jt/scaffold/templates/_list_page.haml
|
30
|
+
- lib/generators/jt/scaffold/templates/_page.haml
|
31
|
+
- lib/jt-mobile-kit-rails/version.rb
|
32
|
+
homepage: ''
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.24
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: generate jt-mobile-kit in rails app
|
56
|
+
test_files: []
|