Class: Jqp::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/jqp/cli.rb

Class Method Summary collapse

Class Method Details

.execute(stdout, arguments = []) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/jqp/cli.rb', line 5

def self.execute(stdout, arguments=[])

  options = {
    :project     => 'jqplugin',
    :version     => '0.0.1'
  }
  mandatory_options = %w(project)

  parser = OptionParser.new do |opts|
    opts.banner = "      jQuery plugin generator to help you kick start your plugin\n      development with the following structure:\n      \n       plugin\n         /src\n           /css\n           /images\n           query.plugin.js\n         /test\n           spec_plugin.js\n           acceptance_plugin.js\n           specs.html\n           acceptance.html\n         /lib\n          /jsspec\n          jquery.min.js\n          jquery-ui.js\n          /themes\n            /base\n         example.html\n         Rakefile\n         History.txt\n         README.txt\n \n \n      Dependencies: svn, unzip, sed and perl\n      \n      Note: Windows users require svn, 7zip, sed and perl to \n            be on PATH to be available for use\n      \n      Usage: \#{File.basename($0)} [options]\n\n      Options are:\n    BANNER\n    opts.separator \"\"\n    opts.on(\"-p\", \"--project=Name\", String,\n            \"The project name should be simple eg 'widget'\",\n            \"And it will be transformed to jquery.widget.js - there is currently no override feature on this naming convention\",\n            \"Default: jqplugin\") { |arg| options[:project] = arg }\n    opts.on(\"-v\", \"--version=x.x.x\", String,\n            \"Default: 0.0.1\") { |arg| options[:version] = arg }\n    opts.on(\"-h\", \"--help\",\n            \"Show this help message.\") { stdout.puts opts; exit }\n    opts.parse!(arguments)\n\n    if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }\n      stdout.puts opts; exit\n    end\n  end\n\n  JqueryPluginGen::Generator.execute(options)\n  \n  stdout.puts <<-MSG\n  \n**********************************************************\n\nNow include the jQuery libraries with:\n\n  cd jqplugin [or your plugin]\n  rake first_time\n\nFirst time will:\n - add jquery core, ui and base themes\n - compile js to a packed version (see build directory)\n - load three html files in your browser to demon\n1. Acceptance tests\n2. Spec tests\n3. Example page\n\nNote: you don't have to add jquery core, ui and themes.\nHowever, if you don't you will need to update the html \npages (example.html, test/spec.html). To see other options\nuse rake -T\n\nDependencies: svn, unzip, sed and perl\n\nNote: Windows users require svn, 7zip, sed and perl to \n  be on PATH to be available for use\n\n**********************************************************\n\nMSG\nend\n".gsub(/^          /,'')