railsthemes 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +14 -0
- data/lib/railsthemes/installer.rb +22 -4
- data/lib/railsthemes/version.rb +1 -1
- data/spec/lib/railsthemes/installer_spec.rb +5 -5
- metadata +4 -4
data/README.md
CHANGED
@@ -20,6 +20,20 @@ This has been tested with Ruby 1.8.7, and should work with higher versions. 1.8.
|
|
20
20
|
|
21
21
|
Not sure if this will work for Windows users due to invoking tar on the command-line instead of using native Ruby. This is something that we can change going forward, just a matter of time.
|
22
22
|
|
23
|
+
## Developer notes
|
24
|
+
|
25
|
+
To cut a release, the process I've been using is:
|
26
|
+
|
27
|
+
installer> gem build railsthemes.gemspec
|
28
|
+
Successfully built RubyGem
|
29
|
+
Name: railsthemes
|
30
|
+
Version: 1.0.0
|
31
|
+
File: railsthemes-1.0.0.gem
|
32
|
+
|
33
|
+
installer> gem push railsthemes-1.0.0.gem
|
34
|
+
Pushing gem to https://rubygems.org...
|
35
|
+
Successfully registered gem: railsthemes (1.0.0)
|
36
|
+
|
23
37
|
## Contributing
|
24
38
|
|
25
39
|
1. Fork it
|
@@ -11,7 +11,10 @@ module Railsthemes
|
|
11
11
|
class Installer
|
12
12
|
def initialize logger = nil
|
13
13
|
@logger = logger
|
14
|
-
@server =
|
14
|
+
@server = 'https://railsthemes.com'
|
15
|
+
if File.exist?('railsthemes_server')
|
16
|
+
@server = File.read('railsthemes_server').gsub("\n", '')
|
17
|
+
end
|
15
18
|
@logger ||= Logger.new(STDOUT)
|
16
19
|
# just print out basic information, not all of the extra logger stuff
|
17
20
|
@logger.formatter = proc do |severity, datetime, progname, msg|
|
@@ -91,13 +94,28 @@ module Railsthemes
|
|
91
94
|
def get_download_url server_request_url
|
92
95
|
response = nil
|
93
96
|
begin
|
94
|
-
|
97
|
+
url = URI.parse(server_request_url)
|
98
|
+
http = Net::HTTP.new url.host, url.port
|
99
|
+
http = Net::HTTP.new url.host, url.port
|
100
|
+
if server_request_url =~ /^https/
|
101
|
+
http.use_ssl = true
|
102
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
103
|
+
end
|
104
|
+
path = server_request_url.gsub(%r{https?://[^/]+}, '')
|
105
|
+
response = http.request_get(path)
|
95
106
|
rescue Exception => e
|
96
107
|
#@logger.info e.message
|
97
108
|
#@logger.info e.backtrace
|
98
109
|
end
|
99
110
|
|
100
|
-
|
111
|
+
if response
|
112
|
+
if response.code.to_s == '200'
|
113
|
+
return response.body
|
114
|
+
else
|
115
|
+
@logger.info "Got a #{response.code} error while trying to download."
|
116
|
+
return nil
|
117
|
+
end
|
118
|
+
end
|
101
119
|
end
|
102
120
|
|
103
121
|
def gems_used
|
@@ -144,7 +162,7 @@ module Railsthemes
|
|
144
162
|
end
|
145
163
|
|
146
164
|
def untar_string filepath, newdirpath
|
147
|
-
"tar -zxf #{filepath}"
|
165
|
+
"tar -zxf #{filepath} -C #{newdirpath}"
|
148
166
|
end
|
149
167
|
|
150
168
|
|
data/lib/railsthemes/version.rb
CHANGED
@@ -75,7 +75,7 @@ describe Railsthemes::Installer do
|
|
75
75
|
describe :untar_string do
|
76
76
|
it 'should return correct value for *.tar.gz file' do
|
77
77
|
result = @installer.untar_string 'file.tar.gz', 'newdirpath'
|
78
|
-
result.should == 'tar -zxf file.tar.gz'
|
78
|
+
result.should == 'tar -zxf file.tar.gz -C newdirpath'
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -183,22 +183,22 @@ describe Railsthemes::Installer do
|
|
183
183
|
end
|
184
184
|
|
185
185
|
describe '#get_primary_configuration' do
|
186
|
-
it 'should give haml
|
186
|
+
it 'should give haml,scss when haml and sass are in the Gemfile' do
|
187
187
|
gemfile = using_gems 'haml', 'sass'
|
188
188
|
@installer.get_primary_configuration(gemfile).should == 'haml,scss'
|
189
189
|
end
|
190
190
|
|
191
|
-
it 'should give haml
|
191
|
+
it 'should give haml,css when sass is not in the Gemfile but haml is' do
|
192
192
|
gemfile = using_gems 'haml'
|
193
193
|
@installer.get_primary_configuration(gemfile).should == 'haml,css'
|
194
194
|
end
|
195
195
|
|
196
|
-
it 'should give erb,
|
196
|
+
it 'should give erb,scss when haml is not in the gemfile but sass is' do
|
197
197
|
gemfile = using_gems 'sass'
|
198
198
|
@installer.get_primary_configuration(gemfile).should == 'erb,scss'
|
199
199
|
end
|
200
200
|
|
201
|
-
it 'should give erb,
|
201
|
+
it 'should give erb,css when haml and sass are not in the gemfile' do
|
202
202
|
gemfile = using_gems
|
203
203
|
@installer.get_primary_configuration(gemfile).should == 'erb,css'
|
204
204
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railsthemes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Railsthemes
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: thor
|