my-simon 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/bin/simon +2 -0
  3. data/lib/simon.rb +36 -2
  4. data/my-simon.gemspec +2 -2
  5. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.3.0
data/bin/simon CHANGED
@@ -51,6 +51,8 @@ command :add do |c|
51
51
  c.action do |args, options|
52
52
  # Do something or c.when_called My-simon::Commands::Add,
53
53
  case args[0]
54
+ when 'js'
55
+ simon_controller.add_js args[1]
54
56
  when 'heroku'
55
57
  simon_controller.check_hidden
56
58
  cmd = "svn export #{svn_path_heroku} ./ --quiet --force"
data/lib/simon.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'commander/import'
4
-
4
+ require 'open-uri'
5
5
 
6
6
  class Simon
7
7
 
@@ -112,7 +112,7 @@ class Simon
112
112
  cmd = "cp #{javascript_startpoint} #{javascript_endpoint}"
113
113
  Kernel::system( cmd );
114
114
  self.replace_once(javascript_endpoint, "CLASS_NAME", @js_section);
115
- self.replace_once("./www/php/template/footer.php", "<!-- END: DEV javascript -->", "<script src=\"/js/#{@section}.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n\t\t<!-- END: DEV javascript -->");
115
+ self.replace_once("./www/php/template/footer.php", "<!-- END: app -->", "<script src=\"/js/#{@section}.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n\t\t<!-- END: app -->");
116
116
  self.replace_once("./www/js/master.js", "\*\/", "\* @depends #{@section}.js \n \*\/");
117
117
  self.msg "#{javascript_endpoint} added"
118
118
 
@@ -183,6 +183,40 @@ class Simon
183
183
  File.open(file_name, "w") {|file| file.puts new_text}
184
184
  end
185
185
 
186
+ def add_js(js_path = nil)
187
+
188
+ self.check_hidden
189
+
190
+ if js_path.nil?
191
+ js_path = ask("What's the URL to the javascript file? : ") { |q| q.echo = true }
192
+ end
193
+
194
+ @js_file_name = js_path.split("/").last
195
+
196
+ @choice = choose("Which directory do you want to download the file to?", :jquery, :plugins)
197
+
198
+ @web_contents = open(js_path) {|f| f.read }
199
+
200
+ js_endpoint = "./www/js/#{@choice}/#{@js_file_name}"
201
+ cmd = "touch #{js_endpoint}"
202
+ self.msg "#{js_endpoint} added"
203
+
204
+ Kernel::system( cmd );
205
+ File.open(js_endpoint, 'w') { |file| file.write(@web_contents) }
206
+
207
+ if @choice === :jquery
208
+ self.replace_once("./www/php/template/footer.php", "<!-- END: jquery -->", "<script src=\"/js/jquery/#{@js_file_name}\" type=\"text/javascript\" charset=\"utf-8\"></script>\n\t\t<!-- END: jquery -->");
209
+ self.replace_once("./www/js/master.js", "\*\/", "\* @depends jquery/#{@js_file_name} \n \*\/");
210
+ else
211
+ self.replace_once("./www/php/template/footer.php", "<!-- END: plugins -->", "<script src=\"/js/plugins/#{@js_file_name}\" type=\"text/javascript\" charset=\"utf-8\"></script>\n\t\t<!-- END: plugins -->");
212
+ self.replace_once("./www/js/master.js", "\*\/", "\* @depends plugins/#{@js_file_name} \n \*\/");
213
+ end
214
+
215
+
216
+ self.complete
217
+
218
+ end
219
+
186
220
  # TODO get beanstalk to fix their shit.
187
221
  # def setup_beanstalk
188
222
  # subdomain = ask("What is the Beanstalk subdomain? : ") { |q| q.echo = true }
data/my-simon.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "my-simon"
8
- s.version = "0.2.7"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aaron McGuire"]
12
- s.date = "2013-07-25"
12
+ s.date = "2013-08-09"
13
13
  s.description = "CLI tool for Simon, the simple PHP project boilerplate!"
14
14
  s.email = "aaron.mcguire@evb.com"
15
15
  s.executables = ["/simon"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my-simon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.0
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: 2013-07-25 00:00:00.000000000 Z
12
+ date: 2013-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline
@@ -194,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  segments:
196
196
  - 0
197
- hash: -2799045922578855653
197
+ hash: 1313642089394545895
198
198
  required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  none: false
200
200
  requirements: