skeleti 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.5.2"
12
+ gem "rcov", ">= 0"
13
+ end
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.5.2)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.8.7)
10
+ rcov (0.9.9)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.5.2)
19
+ rcov
20
+ shoulda
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Jean-Philippe Boily
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,61 @@
1
+ = skeleti
2
+
3
+ Skeleti is is a generator for Titanium Mobile. It is not a framework but just a skeleton app generator and VCE (View Controller Events) generator.
4
+
5
+ == HOW TO
6
+
7
+ You can generate MVCE skeleton app or add a VCE
8
+
9
+ 1. cd in your new Titanium Mobile project
10
+ 2. To generate app skeleton, at prompt, type:
11
+ ti new (or 'skeleti new')
12
+ 3. to generate another VCE:
13
+ ti g my_controller (where 'my_controller' is a new VCE you want to generate)
14
+
15
+ Usage note: you can use either 'ti' or 'skeleti' at prompt.
16
+
17
+ == WHAT IT GENERATES
18
+
19
+ ti.new generates those directories and files:
20
+
21
+ app/controller/
22
+ application_controller.js (which includes the application view and event files)
23
+ app/event/
24
+ application_events.js
25
+ app/helper/
26
+ general_includes.js (put all your file includes that MUST be all around your app)
27
+ app/model/ (you should put something that could be called model. That could be API interface library or something else. Something that manage data)
28
+ app/view/
29
+ application_view.js (you should put window and tab definition here)
30
+ config/
31
+ application.js (global config should go here)
32
+
33
+ From now on, you do nothing in app.js but instead in the application_*.js.
34
+
35
+
36
+
37
+ ti g my_vce
38
+
39
+ app/controller/my_vce_controller.js (which includes the two files below)
40
+ Business logic for "my_vce" shoud go here
41
+ app/event/my_vce_events.js
42
+ events for window "my_vce"
43
+ app/view/my_vce_view.js
44
+ UI management is here, no events, no logic, only UI.
45
+
46
+
47
+ == Contributing to skeleti
48
+
49
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
50
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
51
+ * Fork the project
52
+ * Start a feature/bugfix branch
53
+ * Commit and push until you are happy with your contribution
54
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
55
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
56
+
57
+ == Copyright
58
+
59
+ Copyright (c) 2011 Jean-Philippe Boily. See LICENSE.txt for
60
+ further details.
61
+
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake'
11
+
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "skeleti"
16
+ gem.homepage = "http://github.com/jipiboily/skeleti"
17
+ gem.license = "MIT"
18
+ gem.summary = "Titanium Mobile skeleton and View Controller Events (VCE) genrator"
19
+ gem.description = "Skeleti is a little tool to generate a basic skeleton app for Titanium Mobile projects. You can also generate VCE (View, Controller and Events)"
20
+ gem.email = "jp@wizestudios.com"
21
+ gem.authors = ["Jean-Philippe Boily"]
22
+ gem.executables = ['skeleti', 'ti']
23
+ gem.require_path = ["lib"]
24
+
25
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
26
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
27
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
28
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
29
+ end
30
+ Jeweler::RubygemsDotOrgTasks.new
31
+
32
+ require 'rake/testtask'
33
+ Rake::TestTask.new(:test) do |test|
34
+ test.libs << 'lib' << 'test'
35
+ test.pattern = 'test/**/test_*.rb'
36
+ test.verbose = true
37
+ end
38
+
39
+ require 'rcov/rcovtask'
40
+ Rcov::RcovTask.new do |test|
41
+ test.libs << 'test'
42
+ test.pattern = 'test/**/test_*.rb'
43
+ test.verbose = true
44
+ end
45
+
46
+ task :default => :test
47
+
48
+ require 'rake/rdoctask'
49
+ Rake::RDocTask.new do |rdoc|
50
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
51
+
52
+ rdoc.rdoc_dir = 'rdoc'
53
+ rdoc.title = "skeleti #{version}"
54
+ rdoc.rdoc_files.include('README*')
55
+ rdoc.rdoc_files.include('lib/**/*.rb')
56
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/ruby
2
+ require 'skeleti.rb'
data/bin/ti ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/ruby
2
+ require 'skeleti.rb'
@@ -0,0 +1,64 @@
1
+ def app_js_content
2
+ <<eos
3
+ // root_path
4
+ var root_path = "";
5
+ Ti.include("app/helper/general_includes.js");
6
+ Ti.include("app/controller/application_controller.js");
7
+
8
+ eos
9
+ end
10
+
11
+ def controller_content mvce
12
+ <<eos
13
+ var win = Titanium.UI.currentWindow;
14
+ // App root path
15
+ var root_path = "../../";
16
+ Ti.include("../helper/general_includes.js");
17
+
18
+ // Current view
19
+ Ti.include("../view/#{mvce}_view.js");
20
+
21
+ // Current events
22
+ Ti.include("../event/#{mvce}_events.js");
23
+ eos
24
+ end
25
+
26
+ def application_controller_content
27
+ <<eos
28
+ var win = Titanium.UI.currentWindow;
29
+
30
+ // Current view
31
+ Ti.include("app/view/application_view.js");
32
+
33
+ // Current events
34
+ Ti.include("app/event/application_events.js");
35
+
36
+ eos
37
+ end
38
+
39
+
40
+ def general_includes_content
41
+ <<eos
42
+ Ti.include(root_path + "config/application.js");
43
+ eos
44
+ end
45
+
46
+
47
+ def usage
48
+ <<eos
49
+ **********************************************************
50
+ You can generate MVCE skeleton app or add a VCE
51
+
52
+ Usage note: you can use either 'ti' or 'skeleti' at prompt. First parameter should be 'new' (n) or 'generate'(g).
53
+
54
+ Step by step to do for new project:
55
+ 1. cd in your new Titanium Mobile project
56
+ 2. To generate app skeleton, at prompt, type:
57
+ ti new (or 'skeleti new')
58
+ 3. to generate another VCE:
59
+ ti g my_controller (where 'my_controller' is a new VCE you want to generate)
60
+
61
+
62
+ **********************************************************
63
+ eos
64
+ end
@@ -0,0 +1,19 @@
1
+ def mkdir name
2
+ d = Dir::pwd + "/Resources/" + name
3
+ if FileTest::directory?(d)
4
+ return
5
+ end
6
+ Dir::mkdir(d)
7
+ end
8
+
9
+ def create_file file, content
10
+ write_to_file file, content, 'w'
11
+ end
12
+
13
+ def append_to_file file, content
14
+ write_to_file file, content, 'a'
15
+ end
16
+
17
+ def write_to_file file, content, mode
18
+ File.open("Resources/" + file, mode) {|f| f.write(content) }
19
+ end
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/ruby
2
+ require 'fileutils'
3
+ require 'file.rb'
4
+ require 'content.rb'
5
+
6
+ def is_ti_app?
7
+ File.exists? 'tiapp.xml'
8
+ end
9
+
10
+ def already_generated?
11
+ File.exists? 'Resources/app/helper/general_includes.js'
12
+ end
13
+
14
+ def msg m
15
+ if ARGV[0]!='n' && ARGV[0]!='new'
16
+ puts m
17
+ end
18
+ end
19
+
20
+ def new_app
21
+ if is_ti_app? && !already_generated?
22
+ puts "generate app skeleton..."
23
+ mkdir 'app'
24
+ mkdir 'app/controller'
25
+ mkdir 'app/event'
26
+ mkdir 'app/helper'
27
+ mkdir 'app/model'
28
+ mkdir 'app/view'
29
+ mkdir 'config'
30
+ create_file 'config/application.js', "// you can put some global variables and settings in here..."
31
+ generate 'application'
32
+
33
+ FileUtils.mv 'Resources/app.js', 'Resources/app/view/application_view.js'
34
+ create_file 'app.js', app_js_content
35
+ create_file 'app/helper/general_includes.js', general_includes_content
36
+ puts 'done!'
37
+ else
38
+ puts "This either an already genetared app or it is not a Titanium Mobile app at all!"
39
+ end
40
+ end
41
+
42
+ def generate mvce
43
+ if !mvce
44
+ puts "no VCE name"
45
+ return false
46
+ end
47
+ if File.exists? "Resources/app/controller/#{mvce}_controller.js"
48
+ puts "This VCE has already been generated or at least the controller is present. Aborted!"
49
+ return false
50
+ end
51
+ msg "generating '" + mvce + "'..."
52
+
53
+ create_file "app/event/#{mvce}_events.js", "// Events for '#{mvce}'"
54
+ create_file "app/view/#{mvce}_view.js", "// View for '#{mvce}'"
55
+ if mvce != "application"
56
+ create_file "app/controller/#{mvce}_controller.js", controller_content(mvce)
57
+ else
58
+ create_file "app/controller/#{mvce}_controller.js", application_controller_content
59
+ end
60
+
61
+ msg 'done!'
62
+ end
63
+
64
+ def parse_command_line a
65
+ if a[0]=="g" || a[0]=="generate"
66
+ generate a[1]
67
+ elsif a[0]=="new" || a[0] == "n"
68
+ new_app
69
+ else
70
+ puts usage
71
+ end
72
+ end
73
+
74
+ parse_command_line ARGV
Binary file
@@ -0,0 +1,68 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{skeleti}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jean-Philippe Boily"]
12
+ s.date = %q{2011-04-14}
13
+ s.description = %q{Skeleti is a little tool to generate a basic skeleton app for Titanium Mobile projects. You can also generate VCE (View, Controller and Events)}
14
+ s.email = %q{jp@wizestudios.com}
15
+ s.executables = ["skeleti", "ti"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "bin/skeleti",
28
+ "bin/ti",
29
+ "lib/content.rb",
30
+ "lib/file.rb",
31
+ "lib/skeleti.rb",
32
+ "pkg/skeleti-0.1.0.gem",
33
+ "skeleti.gemspec",
34
+ "test/helper.rb",
35
+ "test/test_skeleti.rb"
36
+ ]
37
+ s.homepage = %q{http://github.com/jipiboily/skeleti}
38
+ s.licenses = ["MIT"]
39
+ s.require_paths = [["lib"]]
40
+ s.rubygems_version = %q{1.6.2}
41
+ s.summary = %q{Titanium Mobile skeleton and View Controller Events (VCE) genrator}
42
+ s.test_files = [
43
+ "test/helper.rb",
44
+ "test/test_skeleti.rb"
45
+ ]
46
+
47
+ if s.respond_to? :specification_version then
48
+ s.specification_version = 3
49
+
50
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
52
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
53
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
54
+ s.add_development_dependency(%q<rcov>, [">= 0"])
55
+ else
56
+ s.add_dependency(%q<shoulda>, [">= 0"])
57
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
59
+ s.add_dependency(%q<rcov>, [">= 0"])
60
+ end
61
+ else
62
+ s.add_dependency(%q<shoulda>, [">= 0"])
63
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
64
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
65
+ s.add_dependency(%q<rcov>, [">= 0"])
66
+ end
67
+ end
68
+
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'skeleti'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestSkeleti < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: skeleti
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.1
6
+ platform: ruby
7
+ authors:
8
+ - Jean-Philippe Boily
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-14 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: shoulda
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.0
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: jeweler
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.5.2
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: rcov
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: *id004
60
+ description: Skeleti is a little tool to generate a basic skeleton app for Titanium Mobile projects. You can also generate VCE (View, Controller and Events)
61
+ email: jp@wizestudios.com
62
+ executables:
63
+ - skeleti
64
+ - ti
65
+ extensions: []
66
+
67
+ extra_rdoc_files:
68
+ - LICENSE.txt
69
+ - README.rdoc
70
+ files:
71
+ - Gemfile
72
+ - Gemfile.lock
73
+ - LICENSE.txt
74
+ - README.rdoc
75
+ - Rakefile
76
+ - VERSION
77
+ - bin/skeleti
78
+ - bin/ti
79
+ - lib/content.rb
80
+ - lib/file.rb
81
+ - lib/skeleti.rb
82
+ - pkg/skeleti-0.1.0.gem
83
+ - skeleti.gemspec
84
+ - test/helper.rb
85
+ - test/test_skeleti.rb
86
+ has_rdoc: true
87
+ homepage: http://github.com/jipiboily/skeleti
88
+ licenses:
89
+ - MIT
90
+ post_install_message:
91
+ rdoc_options: []
92
+
93
+ require_paths:
94
+ - - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 4418748970705275613
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: "0"
110
+ requirements: []
111
+
112
+ rubyforge_project:
113
+ rubygems_version: 1.6.2
114
+ signing_key:
115
+ specification_version: 3
116
+ summary: Titanium Mobile skeleton and View Controller Events (VCE) genrator
117
+ test_files:
118
+ - test/helper.rb
119
+ - test/test_skeleti.rb