quik_start 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -46,6 +46,8 @@ Or install it yourself as:
46
46
 
47
47
  $ qs --help
48
48
  Usage: --library_name
49
+ --rails Use rails as a target (app/assets)
50
+ --node Use node as a target (public directory)
49
51
  --bootstrap
50
52
  --jquery
51
53
  --jqueryui
data/bin/qs CHANGED
@@ -11,7 +11,8 @@ $start_time = Time.now
11
11
 
12
12
  OptionParser.new do |opts|
13
13
  opts.banner = "Usage: --library_name"
14
- # opts.on("--rails", "Use rails as a target (Only target for now)") { $platform = :rails }
14
+ opts.on("--rails", "Use rails as a target (app/assets)") { $platform = :rails }
15
+ opts.on("--node", "Use node as a target (public directory)") { $platform = :node }
15
16
  # opts.on("--django") { $platform = :django }
16
17
  opts.on("--bootstrap") { $to_install << :bootstrap }
17
18
  opts.on("--jquery") { $to_install << :jquery }
@@ -43,5 +44,5 @@ $to_install.each do |lib_name|
43
44
  end
44
45
  end
45
46
 
46
- QuikStart.download_all($assets)
47
+ QuikStart.download_all($platform, $assets)
47
48
  QuikStart.log_duration($start_time)
@@ -1,3 +1,3 @@
1
1
  module QuikStart
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
data/lib/quik_start.rb CHANGED
@@ -6,11 +6,7 @@ module QuikStart
6
6
 
7
7
  def self.install(lib_name)
8
8
  @installed = [] if @installed == nil
9
- unless @installed.include?(lib_name)
10
- check_listing(lib_name)
11
- check_dependencies(lib_name)
12
- resolve(lib_name)
13
- end
9
+ resolve(lib_name) unless @installed.include?(lib_name)
14
10
  @installed
15
11
  end
16
12
 
@@ -27,6 +23,8 @@ module QuikStart
27
23
  end
28
24
 
29
25
  def self.resolve(lib_name)
26
+ check_listing(lib_name)
27
+ check_dependencies(lib_name)
30
28
  @installed << lib_name
31
29
  puts ' resolving ' + lib_name.to_s unless libraries[lib_name].nil?
32
30
  end
@@ -36,7 +34,7 @@ module QuikStart
36
34
  puts " "+duration.to_s + ' seconds'
37
35
  end
38
36
 
39
- def self.download_all(libs)
37
+ def self.download_all(platform, libs)
40
38
  puts ' downloading...'
41
39
  to_install = []
42
40
  libs.keys.each do |l|
@@ -68,32 +66,40 @@ module QuikStart
68
66
 
69
67
 
70
68
  libs.keys.each do |l|
71
- url = QuikStart.libraries[l][:target]
69
+ file_name = QuikStart.libraries[l][:target]
72
70
  if QuikStart.libraries[l][:development]
73
- File.open(File.expand_path('.')+url, 'w') do |f2|
71
+ File.open(File.expand_path('.') + QuikStart.asset_path(platform) + file_name, 'w') do |f2|
74
72
  f2.puts responses[QuikStart.libraries[l][:development]]
75
73
  end
76
74
  else
77
- File.open(File.expand_path('.')+url, 'w') do |f2|
75
+ File.open(File.expand_path('.') + QuikStart.asset_path(platform)+ file_name, 'w') do |f2|
78
76
  f2.puts responses[QuikStart.libraries[l][:package]]
79
77
  end
80
- unzip(File.expand_path('.')+url)
78
+ unzip(platform, File.expand_path('.') + QuikStart.asset_path(platform) + file_name)
81
79
  end
82
80
  end
83
81
  puts
84
- write_asset_files(libs.keys)
82
+ write_asset_files(platform, libs.keys)
83
+ end
84
+
85
+ def self.asset_path(platform)
86
+ if platform == :rails
87
+ '/app/assets'
88
+ elsif platform == :node
89
+ '/public'
90
+ end
85
91
  end
86
92
 
87
- def self.unzip(file)
93
+ def self.unzip(platform, file)
88
94
  Zip::ZipFile.open(file) do |zipfile|
89
95
  zipfile.each do |entry|
90
96
  if File.extname(entry.name) == '.js'
91
- File.open(File.expand_path('.')+'/app/assets/javascripts/'+File.basename(entry.name), 'w') do |f2|
97
+ File.open(File.expand_path('.') + QuikStart.asset_path(platform) + '/javascripts/' + File.basename(entry.name), 'w') do |f2|
92
98
  f2.puts entry.get_input_stream.read
93
99
  end
94
100
  end
95
101
  if File.extname(entry.name) == '.css'
96
- File.open(File.expand_path('.')+'/app/assets/stylesheets/'+File.basename(entry.name), 'w') do |f2|
102
+ File.open(File.expand_path('.') + QuikStart.asset_path(platform) + '/stylesheets/' + File.basename(entry.name), 'w') do |f2|
97
103
  f2.puts entry.get_input_stream.read
98
104
  end
99
105
  end
@@ -102,29 +108,31 @@ module QuikStart
102
108
  File.delete(file)
103
109
  end
104
110
 
105
- def self.write_asset_files(installed=[])
106
- write_css_file(installed)
107
- write_js_file(installed)
111
+ def self.write_asset_files(platform, installed=[])
112
+ write_css_file(platform, installed)
113
+ write_js_file(platform, installed)
108
114
  end
109
115
 
110
- def self.write_css_file(installed)
111
-
116
+ def self.write_css_file(platform, installed)
117
+ if platform == :rails
112
118
  puts
113
119
  if installed.include?(:bootstrap)
114
120
  puts 'puts the following in your application.css file: '
115
121
  puts ' *= require "bootstrap" '
116
122
  puts
117
123
  end
118
-
124
+ end
119
125
  end
120
126
 
121
- def self.write_js_file(installed)
127
+ def self.write_js_file(platform, installed)
128
+ if platform == :rails
122
129
  puts
123
130
  puts 'puts the following in your application.js file: '
124
131
  installed.each do |i|
125
132
  puts ' //= require '+ i.to_s
126
133
  end
127
134
  puts
135
+ end
128
136
  end
129
137
 
130
138
  def self.libraries
@@ -133,44 +141,44 @@ module QuikStart
133
141
  :development => 'http://backbonejs.org/backbone.js',
134
142
  :production => 'http://backbonejs.org/backbone-min.js',
135
143
  :dependencies => [:underscore, :json2],
136
- :target => '/app/assets/javascripts/backbone.js'
144
+ :target => '/javascripts/backbone.js'
137
145
  },
138
146
  :bootstrap => {
139
147
  :package => 'http://twitter.github.com/bootstrap/assets/bootstrap.zip',
140
148
  :dependencies => [:jquery],
141
149
  :extraction_method => :extract_bootstrap,
142
- :target => '/app/assets/javascripts/bootstrap.zip'
150
+ :target => '/javascripts/bootstrap.zip'
143
151
  },
144
152
  :underscore => {
145
153
  :development => 'http://underscorejs.org/underscore.js',
146
154
  :production => 'http://underscorejs.org/underscore-min.js',
147
- :target => '/app/assets/javascripts/underscore.js'
155
+ :target => '/javascripts/underscore.js'
148
156
  },
149
157
  :json2 => {
150
158
  :development => 'https://raw.github.com/douglascrockford/JSON-js/master/json2.js',
151
159
  :production => 'https://raw.github.com/douglascrockford/JSON-js/master/json2.js',
152
- :target => '/app/assets/javascripts/json2.js'
160
+ :target => '/javascripts/json2.js'
153
161
  },
154
162
  :jqueryui => {
155
163
  :production => 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js',
156
164
  :development => 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.js',
157
165
  :dependencies => [:jquery],
158
- :target => '/app/assets/javascripts/jquery-ui.js'
166
+ :target => '/javascripts/jquery-ui.js'
159
167
  },
160
168
  :jquery => {
161
169
  :production => 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js',
162
170
  :development => 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js',
163
- :target => '/app/assets/javascripts/jquery.js'
171
+ :target => '/javascripts/jquery.js'
164
172
  },
165
173
  :angular => {
166
174
  :development => 'https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js',
167
175
  :production => 'https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js',
168
- :target => '/app/assets/javascripts/angular.js'
176
+ :target => '/javascripts/angular.js'
169
177
  },
170
178
  :d3 => {
171
179
  :development => 'https://raw.github.com/mbostock/d3/master/d3.min.js',
172
180
  :production => 'https://raw.github.com/mbostock/d3/master/d3.js',
173
- :target => '/app/assets/javascripts/d3.js'
181
+ :target => '/javascripts/d3.js'
174
182
  }
175
183
  }
176
184
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quik_start
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -37,7 +37,7 @@ cert_chain:
37
37
  N2xDUGFqVEpXOE1mMXQ3VU5BUk5QYVpOdzZaS3pTYS9VMFZQTG5rOEJET1Ix
38
38
  cHUzenhMdwo4Y0szM3FyNWtFYXlVOWE3dnVCMUdRPT0KLS0tLS1FTkQgQ0VS
39
39
  VElGSUNBVEUtLS0tLQo=
40
- date: 2013-03-14 00:00:00.000000000 Z
40
+ date: 2013-03-15 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: curb
metadata.gz.sig CHANGED
Binary file